-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall_analyses.Rmd
3922 lines (3200 loc) · 157 KB
/
all_analyses.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
title: "Needs versus Ranks. Analyses"
output:
word_document:
toc: FALSE
reference_docx: "___reference.docx"
---
```{r settings, include = FALSE}
# Global options ####
knitr::opts_chunk$set(echo = FALSE,
message = FALSE,
results = "asis",
error = FALSE,
warning = FALSE,
dpi = 400,
st_options = "rmarkdown")
options(knitr.table.format = "markdown")
options("scipen" = 999, "digits" = 5)
# Pander ####
pander::panderOptions("table.emphasize.rownames", FALSE)
pander::panderOptions("knitr.auto.asis", FALSE)
pander::panderOptions("table.split.table", Inf)
pander::panderOptions("table.alignment.rownames", "left")
pander::panderOptions("table.split.cells", Inf)
# Load dplyr ####
library(dplyr)
# Font ####
library(extrafont)
grDevices::windowsFonts(
sans = grDevices::windowsFont("TT Times New Roman"),
serif = grDevices::windowsFont("TT Times New Roman"),
mono = grDevices::windowsFont("TT Times New Roman"),
Times = grDevices::windowsFont("TT Times New Roman")
)
```
```{r load data, echo=FALSE, message=FALSE, warning=FALSE}
# Load data
base::load(file = "data.RData")
# Make data for all participants
all_participants <- nrow(oTree$all_apps_wide)
# Reason for that is to keep the Rmd flexible to include/exclude dictators
# DF_socio <- oTree$sociodemographics
# DF_sco <- oTree$sco
# DF_all <- oTree$all_apps_wide
# DF_end <- oTree$end
# Make data only dictators
DF_socio <-
oTree$sociodemographics[oTree$sociodemographics$dictator == 1, ]
DF_sco <- oTree$sco[oTree$sco$dictator == 1, ]
DF_all <- oTree$all_apps_wide[oTree$all_apps_wide$dictator == 1, ]
DF_end <- oTree$end[oTree$end$dictator == 1, ]
```
```{r load my function}
source("functions_base.R")
```
```{r start captioner, include=FALSE}
table_nums <- captioner(prefix = "Table 5.",
suffix = " ",
auto_space = FALSE)
figure_nums <- captioner(prefix = "Fig. 5.",
suffix = " ",
auto_space = FALSE)
table_E_nums <- captioner(prefix = "Table D",
suffix = " ",
auto_space = FALSE)
figure_E_nums <- captioner(prefix = "Fig. D",
suffix = " ",
auto_space = FALSE)
# Changer order of citations in appendix ####
table_E_nums(name = "socdem1", display = "cite")
figure_E_nums(name = "corrofsoc2neu", display = "cite")
table_E_nums(name = "soccorrr", display = "cite")
table_E_nums(name = "soccorrrP", display = "cite")
table_E_nums(name = "ranking_of_principles_ALL", display = "cite")
table_E_nums(name = "smeGLM", display = "cite")
table_E_nums(name = "smeGLM_PP", display = "cite")
figure_E_nums(name = "pp_treatmentseveral_groups", display = "cite")
table_E_nums(name = "covariates_GLM", display = "cite")
table_E_nums(name = "covariates_PP", display = "cite")
table_E_nums(name = "ModelRobust", display = "cite")
table_E_nums(name = "SocioDems_GLM", display = "cite")
table_E_nums(name = "SocioDems_PP", display = "cite")
table_E_nums(name = "polgroups_GLM", display = "cite")
table_E_nums(name = "polgroups_PP", display = "cite")
table_E_nums(name = "SCO_GLM", display = "cite")
table_E_nums(name = "SCO_PP", display = "cite")
table_E_nums(name = "ranking_GLM", display = "cite")
table_E_nums(name = "ranking_PP", display = "cite")
table_E_nums(name = "Same_chooser_Table12", display = "cite")
```
```{r ci settings}
this_ci <- 0.95
```
```{r ggsave settings}
# Plot size
normal_font <- 10
# In cm
height_bar_1row <- 4.5
height_bar_2rows <- 8
height_bar_2rows_extra <- 8 # Because of two rows-axis
heigth_interation_1row_extra <- 6
heigth_interation_1row <- 4.5
heigth_interation_3rows <- 11
# Inches
height_bar_1row_in <- height_bar_1row * 0.394
height_bar_2rows_in <- height_bar_2rows * 0.394
height_bar_2rows_extra_in <- height_bar_2rows_extra * 0.394
heigth_int_1row_in <- heigth_interation_1row * 0.394
heigth_int_1row_extra_in <- heigth_interation_1row_extra * 0.394
heigth_int_3row_in <- heigth_interation_3rows * 0.394
# Width
width <- 12.2
width_in <- width * 0.394
width_small <- 8.0
width_small_in <- width_small * 0.394
```
```{r numbers behind main effectsss only}
# Must be up here because it is already used in the text below
# DF and formulas
DF <- oTree$RTotal
myformula_intercept <- "player.acceptance ~ 1"
# Make predicted probabilities ####
# Make predicted probabilities table for intercept - extra ####
model_intercept <- glm(
data = DF,
formula = as.formula(myformula_intercept),
family = binomial(link = "logit"))
# VCOV
all_main_intercept_vcov <- sandwich::vcovCL(model_intercept,
cluster = DF$participant.code,
type = "HC1")
# Model corrected
model_intercept_corr <- coefficients_CL(model = model_intercept, DF = DF)
all_main_intercept_pp <- gpredict2_cl_only1(
model = model_intercept,
x = "1", # Intercept
xlab = "Overall",
cluster = DF$participant.code,
ci.lvl = 0.95
)$prediction
all_main_intercept_pp <- all_main_intercept_pp[, -1]
all_main_intercept_pp <- beautify_pp(all_main_intercept_pp)
```
```{r lwd settings}
global_lwd <- 0.6 # früher 1.2
# Interaction plot lwds
sco_interaction_lwd <- 0.6
sociodemo_lwd <- 0.6 # Früher 0.9
ranking_interaction_lwd <- 0.6
```
# Results
# The participants
## Included and excluded
```{r}
voluntary_stop <- nrow(oTree$info$deleted_cases$unique[
oTree$info$deleted_cases$unique$end_app != "dismiss" &
oTree$info$deleted_cases$unique$end_app != "", ])
# "" is me or people who restarted
dismissal <- nrow(oTree$info$deleted_cases$unique[
oTree$info$deleted_cases$unique$end_app == "dismiss", ])
programming_error <- nrow(oTree$info$deleted_cases$full[
oTree$info$deleted_cases$full$reason ==
"Wrong catch trial chosen for AB", ])
completion_rate <- nrow(oTree$all_apps_wide) /
(oTree$info$initial_n - programming_error)
# Text ####
cat0("\n\nA total of ",
oTree$info$initial_n,
" participants opened the HITs, but ")
# Voluntarily stopped ####
cat0(voluntary_stop,
" participants stopped the study, either voluntarily or because of technical errors. Of these, ",
# Consent ####
nrow(oTree$info$deleted_cases$unique[
oTree$info$deleted_cases$unique$end_page == "ConsentEn", ]),
" participants did not accept the consent form, ",
# Intro ####
nrow(oTree$info$deleted_cases$unique[
oTree$info$deleted_cases$unique$end_app == "rankIntro" &
oTree$info$deleted_cases$unique$end_page == "Intro", ]),
" participants left the experiment during the introduction, ",
# Intro-questions ####
xfun::numbers_to_words(nrow(oTree$info$deleted_cases$unique[
oTree$info$deleted_cases$unique$end_app == "rankIntro" &
oTree$info$deleted_cases$unique$end_page != "Intro", ])),
" participants left the experiment when confronted with the comprehension questions, ",
# Rank-aversion ####
xfun::numbers_to_words(nrow(oTree$info$deleted_cases$unique[
oTree$info$deleted_cases$unique$end_app == "rankaversion", ])),
" participants left the experiment in the redistribution game, and ",
# Level 2 ####
nrow(oTree$info$deleted_cases$unique[
oTree$info$deleted_cases$unique$end_app == "level2", ]),
" participants left the experiment in level 2.",
# Level 2 additional ####
" However, only ",
xfun::numbers_to_words(
nrow(oTree$info$deleted_cases$unique[
oTree$info$deleted_cases$unique$session.config.dictator == 1 &
oTree$info$deleted_cases$unique$end_app == "level2", ]) +
nrow(oTree$info$deleted_cases$unique[
oTree$info$deleted_cases$unique$session.config.dictator == 1 &
oTree$info$deleted_cases$unique$end_app == "rankaversion", ])),
" participants who left after answering the comprehension questions were dictators.",
"\n\n")
# #############################
# Exclusion from experiment ####
cat0("A further ",
dismissal,
" participants were excluded from the experiment: ")
cat0(
length(oTree$info$breakupreasons$reason[oTree$info$breakupreasons$reason == "comprehension"]),
" were disqualified for giving incorrect answers to comprehension questions, and ",
xfun::numbers_to_words(length(oTree$info$breakupreasons$reason[oTree$info$breakupreasons$reason == "honeypot"])),
" was disqualified for using bots. ")
# Data exclusion ####
# Programming error
cat0("Additionally, the data of ",
xfun::numbers_to_words(nrow(oTree$info$deleted_cases$full[
oTree$info$deleted_cases$full$reason ==
"Wrong catch trial chosen for AB", ])),
" participants had to be removed from the data set due to programming errors.^[The computer program chose the assignments of the catch trials; hence, these assignments could not be paid out to real persons. This error occurred only during the first session, as the bug was corrected afterward.]"
)
# Rushing through
cat0(" Nobody was disqualified from the experiment for rushing through it or responding randomly to open questions. ")
# Final number ####
cat0(
" As a result, the final data frame contained the data of ",
all_participants,
" participants. Of these, 100 were dictators and used to test my hypotheses.")
cat0(" Based on the above numbers, this study had a completion rate of ",
digit1(100 * completion_rate),
"%.")
cat0("^[The ",
xfun::numbers_to_words(nrow(oTree$info$deleted_cases$full[
oTree$info$deleted_cases$full$reason ==
"Wrong catch trial chosen for AB", ])),
" participants, whose data were omitted due to a programming error, were not considered in this calculation of the completion rate. Furthermore, after the comprehension questions, two participants restarted the experiment. Their aborted first attempt was also not included in this calculation.]")
```
## Sociodemographics, political attitudes, and traits
```{r text at beginning}
cat0("Because the participants were not a representative sample of the U.S. population and may have reacted differently to the treatments than the general population, the remainder of this section describes the experimental subjects in detail so that their behavior can be evaluated in light of these characteristics. ")
# Different texts if only dictators or all are considered
if (unique(c(nrow(DF_socio), nrow(DF_sco), nrow(DF_all), nrow(DF_end))) == 100) {
cat0("In the following, I present the data of the 100 dictators, not the receivers. ",
"However, as we can see in ",
table_E_nums(name = "socdem1", display = "cite"),
" in ESM Appendix D, these numbers do not differ substantially between the dictators and receivers.")
} else {
cat0("In the following, I will present the data of all 300 participants, not only the dictators. ",
"However, as we can see in ",
table_E_nums(name = "socdem1", display = "cite"),
"in ESM Appendix D, these numbers do not differ substantially between the dictators and receivers.")
# Only participants who completed the experiment filled out the following questions,
# therefore, one person whose needs were not satisfied are considered here.
}
cat0(" ESM Appendix D, ",
table_E_nums(name = "soccorrr", display = "cite"),
" shows the correlations between the discussed variables in this subsection. ")
```
#### [[Class and age]]
```{r}
cat0("The participants' ages ranged from ",
min(DF_socio$player.age_rec, na.rm = TRUE),
" to ",
max(DF_socio$player.age_rec, na.rm = TRUE),
" years (*M*\u00a0=\u00a0",
formatC(mean(DF_socio$player.age_rec, na.rm = TRUE),
digits = 1, format = "f"),
", *SD*\u00a0=\u00a0",
formatC(sd(DF_socio$player.age_rec, na.rm = TRUE),
digits = 1, format = "f"),
").")
```
<!-- The original variables of the dictators do not contain NAs -->
Most of the sample was male (`r perc1(DF_socio$player.male)`), White (`r perc1(DF_socio$player.race)`), and without a migration background (`r perc1(DF_socio$USorigin)`).
```{r income and education text}
cat0("Regarding socioeconomic status (SES), ")
# Education ####
# Info: Include NAs
cat0(percentx(
(length(DF_socio$edu_rec[
!is.na(DF_socio$edu_rec) & DF_socio$edu_rec >= 4]) / length(DF_socio$edu_rec))),
" of the participants held at least an associate's or bachelor's degree, which was a larger proportion than in the general population, where 44.9% in 2020 held such degrees (U.S. Census Bureau 2021).")
# Income ####
cat0(
" The participants’ median household income in 2019 was ",
dollar(median(DF_socio$income_rec, na.rm = TRUE)),
" (*M*\ua0=\ua0",
dollar(mean(DF_socio$income_rec, na.rm = TRUE)),
", *SD*\ua0=\ua0",
dollar(sd(DF_socio$income_rec, na.rm = TRUE)),
") and, as such, only slightly below the median household income of $64,994 in the US measured in 2020 (U.S. Census Bureau n.d.).",
" The median equivalence-adjusted income was ",
dollar(median(DF_socio$income_equi, na.rm = TRUE)),
" (*M*\ua0=\ua0",
dollar(mean(DF_socio$income_equi, na.rm = TRUE)),
", *SD*\ua0=\ua0",
dollar(sd(DF_socio$income_equi, na.rm = TRUE)),
"), which was also similar to the median equivalence-adjusted income in the US in 2017, as measured by the OECD (2020), which was $35,600.",
"^[The year 2017 is the most recent entry for the United States in the OECD (2020) database.]",
" The median subjective class was ",
formatC(median(DF_socio$player.subjective_class, na.rm = TRUE),
format = "f", big.mark = ",", digits = 0),
" on a ladder between 1 and 10 (*M*\ua0=\ua0",
formatC(mean(DF_socio$player.subjective_class, na.rm = TRUE),
format = "f", big.mark = ",", digits = 0),
", *SD*\ua0=\ua0",
formatC(sd(DF_socio$player.subjective_class, na.rm = TRUE),
format = "f", big.mark = ",", digits = 0),
"). ")
# Correlations ####
cat0(
"The subjective class correlated strongly with the equivalence-adjusted income, with a Spearman correlation of ",
spearrhoWithP_nonexact(
DF_socio$income_equi,
DF_socio$player.subjective_class), ", ",
"but only weakly with the educational level, ",
spearrhoWithP_nonexact(DF_socio$edu_rec, DF_socio$player.subjective_class),
".")
# Other wealth measures ####
cat0("^[When we examine the respondents' financial status in greater detail, we see that most of them owned (",
myperc(DF_socio$wealth_house.f, "Own your home"),
") or rented (",
myperc(DF_socio$wealth_house.f, "Rent your home"),
") their homes. Only ",
myperc(DF_socio$wealth_house.f, c("Live with family or friends and not pay rent", "Live with family or friends and contribute part of rent", " Live in a group shelter")),
" lived with family or friends, with and without contribution to the rent, or in a group shelter. ",
# Money set aside
"Most respondents had money set aside for emergencies (",
myperc(DF_socio$wealth_emergency_bf, "Yes"),
"), while ",
myperc(DF_socio$jobloss_bf, "Yes"),
" of the participants lost their jobs in 2020.]"
)
```
#### [[Political Attitudes]]
```{r text on political attitudes}
# Caption reference
citefigure <- figure_nums(name = "political2",
display = "cite")
# Text ####
cat0(citefigure,
" presents the political attitudes of the participants.^[The percentages in this paragraph were only calculated in proportion to valid (not empty) entries.] ")
# Liberal #####
cat0(
citefigure,
"a depicts their political orientation, ranging from very liberal to very conservative. ",
"Most respondents identified as liberal (",
myperc(DF_socio$pol_conservative3.f, "Liberal"), "), ",
myperc(DF_socio$pol_conservative3.f, "Moderate"),
" identified as moderate, and ",
myperc(DF_socio$pol_conservative3.f, "Conservative"),
" as conservative. ")
# Affiliation ####
cat0(citefigure,
"b displays the respondents' party affiliation. ",
myperc(DF_socio$pol_affiliation3.f, "Democrat"),
" thought of themselves as Democrats compared to ",
myperc(DF_socio$pol_affiliation3.f, "Republican"),
" as Republicans and ",
myperc(DF_socio$pol_affiliation3.f, "Independent"),
" as Independents. ")
# Left - Right ####
cat0(
citefigure,
"c shows their self-rating from 0 = left-wing orientation to 10 = right-wing orientation.",
" The average value of the respondents was ",
digit1(mean(DF_socio$pol_right_rec, na.rm = TRUE)),
" (*SD*\ua0=\ua0",
digit1(sd(DF_socio$pol_right_rec, na.rm = TRUE)),
"), indicating that they were more left-wing than right-wing. "
)
# Correlations ####
cat0(
citefigure,
"d presents the bivariate Spearman correlations of these three variables. ",
"Conservatism and right orientation correlated almost perfectly (",
spearrhoWithP_nonexact(
DF_socio$pol_right_rec, DF_socio$pol_conservative_rec),
"). Party affiliation correlated highly, but not that extremely, with conservatism (",
spearrhoWithP_nonexact(
DF_socio$pol_republican_rec, DF_socio$pol_conservative_rec),
") and left–right orientation (",
spearrhoWithP_nonexact(
DF_socio$pol_republican_rec, DF_socio$pol_right_rec), ").")
# Further info: Skewness ####
# cat0("Skewness Leftright: ",
# digit1(moments::skewness(DF_socio$pol_right_rec, na.rm = TRUE)))
# cat0("Skewness Orientation: ",
# digit1(moments::skewness(DF_socio$pol_conservative_rec, na.rm = TRUE)))
# cat0("Skewness Affiliation: ",
# digit1(moments::skewness(DF_socio$pol_republican_rec, na.rm = TRUE)))
```
```{r part 1 make plot 1 to 3, fig.height = 5, fig.width = 10}
# NA answers included
# Plots ####
# Political orientation ####
polplot1 <-
gg_bar_custom_n(
data = DF_socio[!is.na(DF_socio$player.pol_conservative), ],
mapping = ggplot2::aes(x = pol_conservative.f)) +
ggplot2::ggtitle("(a) Political orientation") +
ggplot2::scale_x_discrete(
guide = ggplot2::guide_axis(n.dodge = 2),
labels = function(x) {sub("\\s", "\n", x)}) +
tsset_politicalbars() +
ggplot2::theme(axis.line.y = ggplot2::element_blank()) # Remove double y-axis
# Affiliation ####
polplot2 <-
gg_bar_custom_n(
data = DF_socio[!is.na(DF_socio$player.pol_affiliation), ],
mapping = ggplot2::aes(x = factor(pol_affiliation.f))) +
ggplot2::ggtitle("(b) Party affiliation") +
ggplot2::scale_x_discrete(
guide = ggplot2::guide_axis(n.dodge = 2),
labels = function(x) {sub("\\s", "\n", x)}) +
tsset_politicalbars() +
ggplot2::theme(axis.line.y = ggplot2::element_blank()) # Remove double y-axis
# Please ignore the "Scale for x is already present"-message.
# Scale was set in gg_bar_custom_n but here we need also dodging
# Left - Right ####
polplot3 <- gg_bar_custom_n(data = DF_socio[
!is.na(DF_socio$player.pol_leftright), ],
ggplot2::aes(x = factor(pol_leftright.f))) +
ggplot2::ggtitle("(c) Left or right") +
tsset_politicalbars() +
ggplot2::theme(axis.line.y = ggplot2::element_blank()) # Remove double y-axis
```
```{r part 2 make plot 4, fig.height = 5, fig.width = 10}
# Correlations plot
# Show nothing, run code
# Get variables ####
DF <- DF_socio[, c("pol_right_rec",
"pol_republican_rec",
"pol_conservative_rec")]
colnames(DF) <- c("Left,Right", "Affiliation", "Orientation")
# Background numbers ####
spearmancormat_pol <- cor(DF,
use = "pairwise.complete.obs",
method = "spearman")
# Plot ####
polplot4 <- make_corrplot_black_white(corr_mat = spearmancormat_pol) +
ggplot2::labs(
title = "(d) Correlations") +
ggplot2::theme(
text = ggplot2::element_text(size = 11), #
panel.background = ggplot2::element_rect(colour = "black",
linewidth = rectwidth),
plot.title = ggplot2::element_text(
hjust = 0.5,
size = global_plot_title # Sets the size for the plot title 11
)) +
ggplot2::theme(axis.line.y = ggplot2::element_blank()) # Remove double y-axis
```
```{r part3 combine plots, fig.height = 5, fig.width = 10}
# Old setting: fig.height = 5, fig.width = 10
# Caption ####
if (nrow(DF_socio) == 100) {
caption(figure_nums(name = "political2",
caption = "Distribution of the dictators' political attitudes"))
} else {
caption(figure_nums(name = "political2",
caption = "Distribution of the participants' political attitudes"))
}
# Combined plot ####
plot <- gridExtra::arrangeGrob(
polplot1,
polplot2,
polplot3,
polplot4,
nrow = 2,
ncol = 2)
# Save graph for Springer
ggplot2::ggsave(plot = plot,
filename = "_figures/Zauchner-Fig5.1.tiff",
width = 12.2,
height = height_bar_2rows_extra,
units = "cm",
scale = 1.5, # 1.5 is good doch nicht so ganz # Je kleinder desto größere schriften?
dpi = 400)
ggplot2::ggsave(plot = plot,
filename = "_figures/Zauchner-Fig5.1.eps",
width = 12.2,
height = height_bar_2rows_extra,
units = "cm",
scale = 1.5,
family = "Times",
dpi = 400,
devic = cairo_ps)
# Import again ####
knitr::include_graphics("_figures/Zauchner-Fig5.1.tiff")
# Note ####
note(
# "N= ", nrow(DF_socio), " participants. ",
"Bivariate Spearman correlations in graph (d).")
```
#### [[Social Comparison Orientation]]
```{r Numbers for SCO text}
# min(DF_sco$sco_ability)
# max(DF_sco$sco_ability)
# nrow(DF_sco)
# Info:
# "is.na not necessary with the dictator data set because it only contains valid values; however, if all participants are used, there is one NA
# 3 is the middle category, only categories 1 and 5 are named in the HMTL
abilityprop3 <- length(DF_sco$sco_ability[!is.na(DF_sco$sco_ability) &
DF_sco$sco_ability > 3]) /
length(DF_sco$sco_ability[!is.na(DF_sco$sco_ability)])
opinionprop3 <- length(DF_sco$sco_opinion[!is.na(DF_sco$sco_opinion) &
DF_sco$sco_opinion > 3]) /
length(DF_sco$sco_opinion[!is.na(DF_sco$sco_opinion)])
# Test for normality - Only SCO TOTAL is significantly non-normally distributed ####
# cat("p-value of SCO opinion: ", (shapiro.test(DF_sco$sco_opinion)$p.value))
# cat("\np-value of SCO ability: ", (shapiro.test(DF_sco$sco_ability)$p.value))
# cat("\np-value of SCO TOTAL: ", (shapiro.test(DF_sco$player.TotalScore)$p.value))
```
The distribution of the (a) total social comparison orientation (SCO) and its components, (b) SCO-opinion, and (c) SCO-ability is illustrated in `r figure_nums(name = "sco", display = "cite")`. <!--
-->Because the total SCO, like its dimensions, ranged from the possible minimum to maximum, the sample included both extreme comparers and extreme non-comparers in both dimensions. <!--
-->However, the dimensions of the SCO differed in their distributions. <!--
-->The respondents indicated that they compared their opinions more frequently than their abilities. <!--
-->While only `r percentx(abilityprop3)` of the dictators, on average, agreed on the ability questions, `r percentx(opinionprop3)` agreed on the opinion questions. <!--
-->As expected from the literature (Schneider & Schupp 2011), the distribution of opinions was, hence, skewed to the left. However, the distribution of abilities was almost uniform, thereby contradicting the findings of Schneider and Schupp (2011), who found an extremely right-skewed distribution regarding the comparison of abilities. <!--
-->The total SCO – the combination of SCO-opinion and SCO-ability – was consequently rather normally distributed. <!--
-->The Spearman correlation of `r spearrhoWithP_nonexact(x = DF_sco$sco_ability, y= DF_sco$sco_opinion)` indicated a positive but not perfect relationship between the proclivity to compare abilities and opinions. <!--
-->This correlation meant that the greater the proclivity to compare one’s abilities, the greater the proclivity to compare one’s opinions, but not to the same degree.
```{r fig.width = width_in, fig.height = height_bar_1row_in}
# Old settings fig.width = 10, fig.height = 3
population <- ifelse(nrow(DF_sco) == 100, "dictators", "all")
# Caption ####
if (nrow(DF_sco) == 100) {
thiscaption <- "Distribution of the dictators’ SCOs"
} else {
thiscaption <- "Distribution of the participants' SCOs"
}
caption(figure_nums(name = "sco",
caption = thiscaption))
# Plots
# Total SCO ####
plot_total <-
gghistSCO(data = DF_sco,
ggplot2::aes(x = player.TotalScore, na.rm = TRUE),
population = population) +
ggplot2::ggtitle("(a) Total SCO") +
ggplot2::labs(x = "Score",
y = "Count",
caption = paste0(
"Median: ",
round(median(DF_sco$player.TotalScore,
na.rm = TRUE),
digits = 1),
"\nSkewness: ",
round(psych::skew(DF_sco$player.TotalScore,
na.rm = TRUE),
digits = 1))) +
tsset_sco() +
sco_plots_scale_y() +
ggplot2::theme(axis.line.y = ggplot2::element_blank()) # Remove double y-axis
# Ability ####
plot_ability <- gghistSCO(data = DF_sco,
ggplot2::aes(x = sco_ability,
na.rm = TRUE),
population = population) +
ggplot2::ggtitle("(c) SCO-ability") +
ggplot2::labs(x = "Score",
y = "Count",
caption = paste0(
"Median: ",
round(median(DF_sco$sco_ability,
na.rm = TRUE),
digits = 1),
"\nSkewness: ",
round(psych::skew(DF_sco$sco_ability,
na.rm = TRUE),
digits = 1))) +
tsset_sco() +
sco_plots_scale_y() +
ggplot2::theme(axis.line.y = ggplot2::element_blank()) # Remove double y-axis
# Opinion ####
plot_opinion <- gghistSCO(data = DF_sco,
ggplot2::aes(x = sco_opinion,
na.rm = TRUE),
population = population) +
ggplot2::ggtitle("(b) SCO-opinion") +
ggplot2::labs(x = "Score",
y = "Count",
caption = paste0(
"Median: ",
round(median(DF_sco$sco_opinion,
na.rm = TRUE),
digits = 1),
"\nSkewness: ",
round(psych::skew(DF_sco$sco_opinion,
na.rm = TRUE),
digits = 1))) +
tsset_sco() +
sco_plots_scale_y() +
ggplot2::theme(axis.line.y = ggplot2::element_blank()) # Remove double y-axis
# Combined plot ####
sco_plot <- gridExtra::arrangeGrob(
plot_total,
plot_opinion,
plot_ability,
nrow = 1, ncol = 3)
height <- (3 / 10) * 12.2
# Save graph for Springer
ggplot2::ggsave(plot = sco_plot,
filename = "_figures/Zauchner-Fig5.2.tiff",
width = 12.2,
height = height_bar_1row,
scale = 1.5,
units = "cm",
dpi = 400)
ggplot2::ggsave(plot = sco_plot,
filename = "_figures/Zauchner-Fig5.2.eps",
width = 12.2,
height = height_bar_1row,
units = "cm",
scale = 1.5, # 1.5 is good doch nicht so ganz # Je kleinder desto größere schriften?
family = "Times",
dpi = 400,
device = cairo_ps)
# Import again ####
knitr::include_graphics("_figures/Zauchner-Fig5.2.tiff")
# Note ####
note(
"Value 1 means that respondents answered all questions with \"strongly disagree,\"",
" and value 5 means that the respondent answered all questions with \"strongly agree.\" ",
"SCO = social comparison orientation."
)
```
## Ranking of principles
```{r make table and data for text}
# Table for text ####
table1 <- table(DF_end$player.hierNeeds)
table2 <- table(DF_end$player.hierEquality)
table3 <- table(DF_end$player.hierRank)
fulltable <- rbind(table1, table2, table3)
rownames(fulltable) <- c("Needs", "Equality", "Rank")
```
At the end of the experiment, the participants were asked to rank the three principles: equality, needs, and no-reranking (worded as "principle of stable rankings"). <!--
-->`r table_nums(name = "ranking_of_principles_DICT", display = "cite")` shows how the dictators ranked the principles (see `r table_E_nums(name = "ranking_of_principles_ALL", display = "cite")` in ESM Appendix D for the numbers observed for all participants; <!--
-->the pattern remained the same for Persons A and B). <!--
-->The need principle was predominantly ranked as the most important, receiving the highest ranking from `r nrow(DF_end[DF_end$player.hierNeeds == 1, ])` participants.<!--
--> Following this, “equality” was ranked highest by `r nrow(DF_end[DF_end$player.hierEquality == 1, ])` participants, and “no-reranking” was ranked as the most important principle by `r xfun::numbers_to_words(nrow(DF_end[DF_end$player.hierRank == 1, ]))` participants.<!--
--> Despite the no-reranking principle being the least important principle for `r nrow(DF_end[DF_end$player.hierRank == 3, ])` dictators, `r xfun::numbers_to_words(nrow(DF_end[DF_end$player.hierNeeds == 3, ]))` dictators chose the need principle, and `r nrow(DF_end[DF_end$player.hierEquality == 3, ])` chose the equality principle as the least important principle. <!--
-->Hence, `r digit1(sum(fulltable[1:2, 3]) / sum(fulltable[, 3]) * 100)`% of the dictators did not rank the no-reranking principle as the least important.
```{r show ranking only for dictators}
# Data ####
DF <- oTree$end[oTree$end$dictator == 1, ]
# Caption ####
if (nrow(DF) == 100) {
thiscaption <- "Distribution of the dictators' rankings of the principles"
} else {
thiscaption <- "Distribution of the rankings of the principles"
}
caption(table_nums(name = "ranking_of_principles_DICT",
caption = thiscaption))
# Table ####
# N
tableN1 <- table(DF$player.hierNeeds)
tableN2 <- table(DF$player.hierEquality)
tableN3 <- table(DF$player.hierRank)
tableN <- rbind(tableN1, tableN2, tableN3)
rownames(tableN) <- c("Needs", "Equality", "No-reranking")
# P
tableP <- prop.table(tableN, 2)
rownames(tableP) <- c("Needs %", "Equality %", "No-reranking %")
# Combine
whole_table <- rbind(tableN, tableP) # Combine N and P
whole_table <- whole_table[c(1, 4, 2, 5, 3, 6), ] # Reorder
whole_table <- addmargins(whole_table, 2) # Sum
# Colnames
colnames(whole_table) <- c("1^st^", "2^nd^", "3^rd^", "Sum")
# Format
whole_table[c(2, 4, 6), ] <- paste0("(",
percentx(whole_table[c(2, 4, 6), ],
digits = 1), ")")
pander::pander(whole_table)
# Note ####
# Not necessary
```
# General acceptance of redistribution
<!-- Numbers of Xie et al. -->
```{r}
# Supplement p. 14 Model 1
# 1 - because they framed it in terms of rejection and not acceptance
x_rr <- -0.115
x_constant <- 1 - 0.230 # In the text they write 23.13%
x_diff_outcomes <- -0.0316
x_diff_between_endowments <- 0.0467
x_transfer_size <- -0.1000
type2 <- x_constant
type2_rej <- 1 - type2 # 0.23 but Xie et al: 23.13%
# Rank reversing
type1 <- x_constant + x_rr
type1_rej <- 1 - type1 # 0.345 but 55.2 in Xie et al. but the transfer sizes are also higher there than in type 2. But they also only mention non-Tibetans
# Mean acceptance when all other variables are 0
x_mean <- (x_constant + x_rr + x_constant) / 2
# I think that is the 55.2% Xie et al. talk about in their paper:
# 1 - (x_constant+x_rr / 2 + x_diff_outcomes * 3 + x_diff_between_endowments * 3 + x_transfer_size * 3)
```
<!-- Text on intercept -->
```{r}
# Text ####
cat0("Now that we know more about the dictators, the question arises of how they behaved in the redistribution game and when they accepted or rejected a transfer. ",
"Before proceeding to the hypotheses tests in the next section, this section covers the acceptance of redistribution without considering the treatment variables. ")
cat0("Following the results of Xie et al. (2017b), we could expect an overall high number of acceptances at about 70%",
# percentx(x_mean),
".^[Notably, Xie et al. (2017b) did not mention the average acceptance rates in their experiments. I hence calculated the average by considering only the baseline and the rank reversal effect in their first model in Table S2, thereby ignoring the other variables. Consequently, the calculated average may deviate from the actual average.]")
cat0(" Indeed, the dictators accepted a redistribution in ",
est_ci_percent_string_p(all_main_intercept_pp, 1)$Estimate,
" of the cases, independent of the treatments, with ",
est_ci_percent_string_p(all_main_intercept_pp, 1)$CI,
", which was slightly higher than expected.")
# Footnote ####
cat0("^[The confidence interval was calculated using Model 1 in ESM Appendix D, ",
table_E_nums(name = "smeGLM", display = "cite"),
", a logit model with clustered standard errors that only considers the intercept. The model’s predicted probabilities are presented in ",
table_E_nums(name = "smeGLM_PP", display = "cite"),
" of ESM Appendix D.]")
```
<!-- ICC calculation -->
```{r}
# Calculate Null-Model ####
re_model0 <- myglmer_NEW(player.acceptance ~ 1 + (1 | participant.code),
data = oTree$RTotal)$model
# Calculation by hand ####
icc <- re_model0@theta[1] ^ 2 / (re_model0@theta[1] ^ 2 + (3.14159 ^ 2 / 3)) # 0.64685
# The same as
# performance::icc(re_model0)
```
<!-- ICC text -->
```{r}
cat0("Regarding the variance of acceptances, we can see a high intraclass correlation (ICC) of ",
digit2(icc),
", indicating that the variation between the individuals was higher than the variation at the level of the individual question.",
"^[The ICC was calculated with the formula of Snijders and Bosker (2003, p. 224).] ")
```
<!-- Background: Sociodemographics -->
```{r background general acceptance}
# Model and odds ratios
formula_participants_wt1 <- "player.acceptance ~
white_bf +
male_bf +
USorigin +
age.c +
equivalence_income.c +
edu_rec.f +
subjective_class.c +
player.wealth_house_bf +
wealth_emergency_bf +
sco_ability.c +
sco_opinion.c +
pol_conservative3.f +
pol_affiliation3.f +
pol_leftright3.f +
player.ranking.f"
base <- GLM_cl(DF = oTree$RTotal,
listofformulas = list(formula_participants_wt1))
model_corrected <- base$models_corrected[[1]]
rownames(model_corrected) <- beautifynames(rownames(model_corrected))
ormodel <- exp(cbind(coef(model_corrected),
confint(model_corrected, level = this_ci)))
```
<!-- Text sociodemographics -->
```{r}
# Text at the beginning ####
cat0(table_nums(name = "regression_general_acceptance", display = "cite"),
" presents a kitchen sink regression of the effects of the participants’ sociodemographic characteristics, SCOs, political attitudes, and ranking of the principles on their acceptance of redistribution. ",
"Notably, the effects in multivariate regressions should always be interpreted as holding other variables constant, that is, ceteris paribus. However, emphasizing this point in this situation is particularly necessary due to the substantial multicollinearity among some of the variables. ",
"The regression results showed that almost all groups did not differ significantly from each other; all but one of the effects were unsubstantial and not significant. The only variable that significantly influenced acceptance was the ranking of the principles. ")
cat0("Ranking equality 1^st^ did not differ significantly from ranking needs 1^st^, with ",
ORregstats_NEW(ormodel, "Ranking: Equality 1^st^", level = this_ci), ". ",
"However, ranking the no-reranking principle 1^st^ made a significant difference. Dictators who ranked the no-reranking principle 1^st^ had a significantly lower chance of accepting a transfer than dictators who ranked needs 1^st^, with ",
ORregstats_NEW(ormodel, "Ranking: No-Reranking 1^st^", level = this_ci),
".")
cat0("\n\nThe nonsignificant results of ",
table_nums(name = "regression_general_acceptance", display = "cite"),
" show some unexpected and some expected patterns. ")
cat0("While Whites, men, and people of U.S. origin were more likely to accept redistribution, age was negatively correlated. ",
"Regarding SES, participants with higher equivalence income, higher education, and higher housing wealth showed higher acceptance rates. Conversely, lower acceptance rates were observed among participants who had money set aside for emergencies, as well as among those who rated their subjective SES higher. ")
cat0("The table reveals the expected pattern regarding political attitudes: Republicans, Independents, right-wingers and participants on the political middle were less accepting of redistribution than Democrats and left-wingers. However, being moderate or conservative was associated with more acceptance than being liberal. ",
"Additionally, the SCO variables suggested that the higher the SCO-ability, the less a redistribution was accepted, while a higher SCO-opinion led to more acceptance. ")
# R2 ####
cat0("Nonetheless, the model's explanatory power, as measured by McFadden’s adj. *R*^2^, was relatively low at ",
digit2(DescTools::PseudoR2(base$models[[1]], c("McFaddenAdj"))),
", indicating that these variables did not explain the acceptance of redistribution well.")
```
<!-- Show regression sociodemographics -->
```{r sociodem regression}
# Caption ####
caption(
table_nums(name = "regression_general_acceptance",
caption = "Logistic regression results of the effects on general acceptance"))
# Table ####
# Set digits and minuss signs
table <- beautify_reg_table_1model(model_corrected[, ])