#Filter out participants who didn't trust the reading materials
dat<- read.csv("~/Downloads/GG_identification_Muslim_Americans_Experimental - 20190722.csv") %>%
dplyr::select(CONDITION:Gender, Trust_levelup_4)%>%
mutate(CONDITION=recode(CONDITION, '1'="1", '2'="2",'3'="3",'4'="4")) %>%
dplyr::filter(Trust_levelup_4 > 1) %>%
dplyr::select(CONDITION:Gender)
#Mean.depvar<-dat %>%
# group_by(CONDITION) %>%
# summarise_all(list(mean, sd), na.rm=TRUE) #%>%
# gather(key = "depvar", value = "Mean", GC_level_3:Gender)
Scaled.dat<-dat
Scaled.dat[,-1]<-scale(dat[,-1])
meantable <- Scaled.dat %>%
group_by(CONDITION) %>%
summarize_all(mean, na.rm=TRUE) %>%
gather( "var", "mean", GC_level_3:Gender)
meantable
## # A tibble: 168 x 3
## CONDITION var mean
## <chr> <chr> <dbl>
## 1 1 GC_level_3 0.386
## 2 2 GC_level_3 0.299
## 3 3 GC_level_3 -0.665
## 4 4 GC_level_3 -0.0870
## 5 1 GC_level_4 0.0260
## 6 2 GC_level_4 -0.395
## 7 3 GC_level_4 0.378
## 8 4 GC_level_4 0.0296
## 9 1 GG_level 0.420
## 10 2 GG_level -0.0473
## # … with 158 more rows
sdtable<- Scaled.dat %>%
group_by(CONDITION) %>%
summarize_all(sd, na.rm=TRUE) %>%
gather("var", "sd", GC_level_3:Gender)
sdtable
## # A tibble: 168 x 3
## CONDITION var sd
## <chr> <chr> <dbl>
## 1 1 GC_level_3 0.767
## 2 2 GC_level_3 0.774
## 3 3 GC_level_3 1.06
## 4 4 GC_level_3 1.05
## 5 1 GC_level_4 0.922
## 6 2 GC_level_4 1.22
## 7 3 GC_level_4 0.539
## 8 4 GC_level_4 1.02
## 9 1 GG_level 0.769
## 10 2 GG_level 0.946
## # … with 158 more rows
meantable$sd<-sdtable$sd
mergedtable<-meantable
mergedtable
## # A tibble: 168 x 4
## CONDITION var mean sd
## <chr> <chr> <dbl> <dbl>
## 1 1 GC_level_3 0.386 0.767
## 2 2 GC_level_3 0.299 0.774
## 3 3 GC_level_3 -0.665 1.06
## 4 4 GC_level_3 -0.0870 1.05
## 5 1 GC_level_4 0.0260 0.922
## 6 2 GC_level_4 -0.395 1.22
## 7 3 GC_level_4 0.378 0.539
## 8 4 GC_level_4 0.0296 1.02
## 9 1 GG_level 0.420 0.769
## 10 2 GG_level -0.0473 0.946
## # … with 158 more rows
cdot <- ggplot(mergedtable, aes(y = mean,
x = fct_reorder2(var, CONDITION, -mean),
color = CONDITION)) +
geom_point() + ylab("") +
ggtitle("Scaled Mean Value Sorted by Condition 4")
cdot+geom_pointrange(mapping = aes(ymin = mean-sd, ymax=mean+sd))+
coord_flip()
##only show group 2 & 3
gp2<-mergedtable %>%
filter(CONDITION=="2")
cdot2<-ggplot(gp2, aes(y = mean, x = fct_reorder2(var, CONDITION, -mean))) +
geom_point() + ylab("") +
ggtitle("Scaled Mean Value Sorted W/ sd for group 2")+
geom_pointrange(mapping = aes(ymin = mean-sd, ymax=mean+sd))+
coord_flip()
gp3<-mergedtable %>%
filter(CONDITION=="3")
cdot3<-ggplot(gp3, aes(y = mean, x = fct_reorder2(var, CONDITION, -mean))) +
geom_point() + ylab("") +
ggtitle("Scaled Mean Value Sorted W/ sd for group 3")+
geom_pointrange(mapping = aes(ymin = mean-sd, ymax=mean+sd))+
coord_flip()
grid.arrange(cdot2, cdot3, ncol = 2)
Similarily as what we found out in RA_exercise report, condition 1 has more extreme values, condition 4 are more neutral to each measurement with standardized values approximating zero. When comparing condition 2 and 3 in same frame, we observe the order of assessment is quite different in the left and right plots. For example, ITT and Essentialism_SCL ranked middle and bottom in condition 2 but they ranked top in the right plot. This may indicate that reading different articles may affect how people perceive Muslim Americans.
ANOVA(one-way analysis of variance) is an extension of independent two-samples t-test for comparing means when there’re more than two groups. In our one-way ANOVA, the data is organized into 4 Conditions in given in the experiment (factor variable).
ANOVA test hypothesis:
library(multcomp)
dat$CONDITION<-as.factor(dat$CONDITION)
Here, I used GC_level_3 as an example to show how the ANOVA test was conducted and then will apply the function to all remaining variables in the dataset.
# Compute the analysis of variance
res.aov<-aov(GG_level ~ CONDITION, data = dat)
# Summary of the analysis
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## CONDITION 3 42716 14239 7.615 7.72e-05 ***
## Residuals 193 360863 1870
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#summary(aov(Humanization~ CONDITION, data = dat))
#The output includes the columns F valye and Pr(>F) corresponding to the p-value of the test.
#The function TukeyHD() takes the fitted ANOVE as an argument
TukeyHSD(res.aov)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = GG_level ~ CONDITION, data = dat)
##
## $CONDITION
## diff lwr upr p adj
## 2-1 -21.212766 -44.208381 1.782849 0.0822750
## 3-1 -43.500000 -67.330614 -19.669386 0.0000255
## 4-1 -16.000000 -37.621235 5.621235 0.2239837
## 3-2 -22.287234 -46.234352 1.659884 0.0782011
## 4-2 5.212766 -16.536811 26.962343 0.9252218
## 4-3 27.500000 4.869403 50.130597 0.0101652
#diff: difference between means of the two groups
#lwr, upr: the lower and the upper end point of the confidence interval at 95% (default)
#p adj: p-value after adjustment for the multiple comparisons.
lm<-lm(GC_level_3 ~ CONDITION, data = dat)
#glht stands for general linear hypothesis tests
#model: a fitted model, for example an object returned by aov().
#lincft(): a specification of the linear hypotheses to be tested. Multiple comparisons in ANOVA models are specified by objects returned from the function mcp().
summary(glht(lm, linfct = mcp(CONDITION = "Tukey")))
##
## Simultaneous Tests for General Linear Hypotheses
##
## Multiple Comparisons of Means: Tukey Contrasts
##
##
## Fit: lm(formula = GC_level_3 ~ CONDITION, data = dat)
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## 2 - 1 == 0 -2.728 5.966 -0.457 0.9681
## 3 - 1 == 0 -32.938 6.183 -5.327 <0.001 ***
## 4 - 1 == 0 -14.824 5.610 -2.643 0.0438 *
## 3 - 2 == 0 -30.210 6.213 -4.862 <0.001 ***
## 4 - 2 == 0 -12.097 5.643 -2.144 0.1429
## 4 - 3 == 0 18.114 5.872 3.085 0.0122 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)
#we use glht() to perform multiple pairwise-comparisons for a one-way ANOVA
Apply the ANOVA function to all columns & gather the data using SQL:
aov.fn<-function(x){
summary(glht(lm(x ~ CONDITION, data = dat), linfct = mcp(CONDITION = "Tukey")))
}
summary(glht(lm(Gender ~ CONDITION, data = dat), linfct = mcp(CONDITION = "Tukey")))
##
## Simultaneous Tests for General Linear Hypotheses
##
## Multiple Comparisons of Means: Tukey Contrasts
##
##
## Fit: lm(formula = Gender ~ CONDITION, data = dat)
##
## Linear Hypotheses:
## Estimate Std. Error t value Pr(>|t|)
## 2 - 1 == 0 -0.074025 0.103293 -0.717 0.890
## 3 - 1 == 0 -0.081809 0.107044 -0.764 0.870
## 4 - 1 == 0 -0.060833 0.101715 -0.598 0.932
## 3 - 2 == 0 -0.007784 0.107567 -0.072 1.000
## 4 - 2 == 0 0.013191 0.102266 0.129 0.999
## 4 - 3 == 0 0.020976 0.106053 0.198 0.997
## (Adjusted p values reported -- single-step method)
Finally, we get the following dataframe can be used for drawing heatmap:
htmap.p<-read.csv("~/Desktop/anova_results_p.csv"); htmap.f<-read.csv("~/Desktop/anova_results_f.csv")
##wide to long, using Base R
htmap.mp<-melt(htmap.p) #wide to long base R, equivalently as the following
## Using var as id variables
htmap.mf<-melt(htmap.f)
## Using var as id variables
#equivalently, using dplyr
#htmap.mp<-htmap.p %>% gather("comparison", "p_value", Ingroup.dual.p:control.outgroup.p)
#htmap.mt<-htmap.t %>% gather("comparison", "t_value", Ingroup.dual.t:control.outgroup.t)
htmap.mp$f_val<-htmap.mf$value; names(htmap.mp)<-c("var", "comparison", "p_val", "f_val")
combine.pf<-htmap.mp
combine.pf
## var comparison p_val f_val
## 1 GC_level_3 Ingroup.dual 0.968100000 -0.457
## 2 GC_level_4 Ingroup.dual 0.154020000 -2.108
## 3 GG_level Ingroup.dual 0.081870000 -2.391
## 4 Simon_Dual_identity_SCL Ingroup.dual 0.995000000 -0.242
## 5 Angst_SCL Ingroup.dual 1.000000000 -0.060
## 6 Stereotype_SCL Ingroup.dual 0.997000000 0.199
## 7 Symb_Threat_SCL Ingroup.dual 0.995000000 -0.242
## 8 Real_Threat_SCL Ingroup.dual 1.000000000 -0.038
## 9 ITT Ingroup.dual 1.000000000 -0.017
## 10 Sympathy_with_GC Ingroup.dual 0.997000000 -0.209
## 11 GG_Dehumanization Ingroup.dual 0.999300000 0.126
## 12 Humanization Ingroup.dual 0.737000000 -1.020
## 13 Peception_of_GC_mediator Ingroup.dual 0.795000000 -0.917
## 14 Peception_of_GC_bridge Ingroup.dual 0.370000000 -1.619
## 15 Peception_of_GC_fifth_column Ingroup.dual 0.997000000 0.210
## 16 Peception_of_GC_traitors Ingroup.dual 0.975790000 0.415
## 17 Peception_of_GC_unique Ingroup.dual 0.127200000 -2.198
## 18 Peception_of_GC_weak Ingroup.dual 0.795500000 0.917
## 19 Peception_of_GC_lmlm Ingroup.dual 0.270170000 -1.812
## 20 Positive_perception_of_GC_SCL Ingroup.dual 0.276000000 -1.799
## 21 Negative_perception_of_GC_SCL Ingroup.dual 0.986030000 0.343
## 22 GC_intentions_9 Ingroup.dual 0.700720000 -1.082
## 23 GC_intentions_10 Ingroup.dual 0.928500000 -0.610
## 24 Surprise Ingroup.dual 0.000658000 3.812
## 25 Common_fate_SCL Ingroup.dual 0.903800000 -0.682
## 26 CIIM_SCL Ingroup.dual 0.792000000 -0.923
## 27 Outgtoup_similarity_SCL Ingroup.dual 0.984000000 -0.362
## 28 IOS Ingroup.dual 0.943000000 0.562
## 29 SDO_SCL Ingroup.dual 0.881000000 -0.739
## 30 Identification_SCL Ingroup.dual 0.278100000 1.797
## 31 Essentialism_SCL Ingroup.dual 0.909480000 0.667
## 32 Hatered Ingroup.dual 0.879300000 -0.743
## 33 Fear Ingroup.dual 0.998000000 0.172
## 34 Anger Ingroup.dual 0.507400000 1.389
## 35 Hope Ingroup.dual 0.361000000 -1.635
## 36 Empathy Ingroup.dual 0.980000000 -0.391
## 37 Despair Ingroup.dual 0.064200000 -2.494
## 38 Policy_SCL Ingroup.dual 0.999000000 -0.140
## 39 Resource_allocation_SCL Ingroup.dual 0.997000000 0.193
## 40 Social_Distance_SCL Ingroup.dual 0.914000000 -0.654
## 41 Age Ingroup.dual 0.970000000 0.450
## 42 Gender Ingroup.dual 0.890000000 -0.717
## 43 GC_level_3 outgroup.dual 0.001000000 -5.327
## 44 GC_level_4 outgroup.dual 0.324850000 1.702
## 45 GG_level outgroup.dual 0.001000000 -4.731
## 46 Simon_Dual_identity_SCL outgroup.dual 0.038200000 -2.689
## 47 Angst_SCL outgroup.dual 0.270000000 1.813
## 48 Stereotype_SCL outgroup.dual 0.122000000 2.218
## 49 Symb_Threat_SCL outgroup.dual 0.168000000 2.064
## 50 Real_Threat_SCL outgroup.dual 0.075200000 2.427
## 51 ITT outgroup.dual 0.048200000 2.605
## 52 Sympathy_with_GC outgroup.dual 0.549000000 -1.322
## 53 GG_Dehumanization outgroup.dual 0.082500000 2.389
## 54 Humanization outgroup.dual 0.731000000 -1.032
## 55 Peception_of_GC_mediator outgroup.dual 0.418000000 -1.534
## 56 Peception_of_GC_bridge outgroup.dual 0.559000000 -1.306
## 57 Peception_of_GC_fifth_column outgroup.dual 0.124000000 2.209
## 58 Peception_of_GC_traitors outgroup.dual 0.001720000 3.674
## 59 Peception_of_GC_unique outgroup.dual 0.072900000 -2.441
## 60 Peception_of_GC_weak outgroup.dual 0.079100000 2.406
## 61 Peception_of_GC_lmlm outgroup.dual 0.590250000 -1.258
## 62 Positive_perception_of_GC_SCL outgroup.dual 0.191000000 -2.002
## 63 Negative_perception_of_GC_SCL outgroup.dual 0.007640000 3.237
## 64 GC_intentions_9 outgroup.dual 0.083240000 -2.384
## 65 GC_intentions_10 outgroup.dual 0.078200000 -2.411
## 66 Surprise outgroup.dual 0.987584000 -0.151
## 67 Common_fate_SCL outgroup.dual 0.015100000 -3.019
## 68 CIIM_SCL outgroup.dual 0.141000000 -2.150
## 69 Outgtoup_similarity_SCL outgroup.dual 0.396000000 -1.572
## 70 IOS outgroup.dual 0.411000000 -1.547
## 71 SDO_SCL outgroup.dual 0.361900000 1.634
## 72 Identification_SCL outgroup.dual 0.081900000 2.393
## 73 Essentialism_SCL outgroup.dual 0.003910000 3.441
## 74 Hatered outgroup.dual 0.119600000 2.227
## 75 Fear outgroup.dual 0.158000000 2.097
## 76 Anger outgroup.dual 0.029400000 2.789
## 77 Hope outgroup.dual 0.117000000 -2.237
## 78 Empathy outgroup.dual 0.468000000 -1.453
## 79 Despair outgroup.dual 0.634400000 -1.189
## 80 Policy_SCL outgroup.dual 0.095000000 2.329
## 81 Resource_allocation_SCL outgroup.dual 0.187000000 -2.011
## 82 Social_Distance_SCL outgroup.dual 0.595000000 -1.251
## 83 Age outgroup.dual 0.970000000 0.447
## 84 Gender outgroup.dual 0.870000000 -0.764
## 85 GC_level_3 control.dual 0.043600000 -2.643
## 86 GC_level_4 control.dual 1.000000000 0.019
## 87 GG_level control.dual 0.223460000 -1.918
## 88 Simon_Dual_identity_SCL control.dual 0.178500000 -2.035
## 89 Angst_SCL control.dual 1.000000000 -0.029
## 90 Stereotype_SCL control.dual 0.711000000 1.064
## 91 Symb_Threat_SCL control.dual 0.807000000 0.895
## 92 Real_Threat_SCL control.dual 0.267000000 1.819
## 93 ITT control.dual 0.696100000 1.089
## 94 Sympathy_with_GC control.dual 0.595000000 -1.251
## 95 GG_Dehumanization control.dual 0.280000000 1.792
## 96 Humanization control.dual 0.384000000 -1.593
## 97 Peception_of_GC_mediator control.dual 0.441000000 -1.496
## 98 Peception_of_GC_bridge control.dual 0.635000000 -1.187
## 99 Peception_of_GC_fifth_column control.dual 0.581000000 1.272
## 100 Peception_of_GC_traitors control.dual 0.103550000 2.291
## 101 Peception_of_GC_unique control.dual 0.230900000 -1.900
## 102 Peception_of_GC_weak control.dual 0.184500000 2.018
## 103 Peception_of_GC_lmlm control.dual 0.007810000 -3.230
## 104 Positive_perception_of_GC_SCL control.dual 0.309000000 -1.733
## 105 Negative_perception_of_GC_SCL control.dual 0.207130000 1.958
## 106 GC_intentions_9 control.dual 0.007090000 -3.251
## 107 GC_intentions_10 control.dual 0.245600000 -1.866
## 108 Surprise control.dual NA NA
## 109 Common_fate_SCL control.dual 0.111600000 -2.257
## 110 CIIM_SCL control.dual 0.254000000 -1.848
## 111 Outgtoup_similarity_SCL control.dual 0.659000000 -1.149
## 112 IOS control.dual 0.768000000 -0.967
## 113 SDO_SCL control.dual 0.425500000 1.523
## 114 Identification_SCL control.dual 0.386200000 1.591
## 115 Essentialism_SCL control.dual 0.027540000 2.811
## 116 Hatered control.dual 0.569200000 1.292
## 117 Fear control.dual 0.994000000 0.263
## 118 Anger control.dual 0.536800000 1.343
## 119 Hope control.dual 0.114000000 -2.249
## 120 Empathy control.dual 0.530000000 -1.354
## 121 Despair control.dual 0.298500000 -1.755
## 122 Policy_SCL control.dual 0.219000000 1.930
## 123 Resource_allocation_SCL control.dual 0.343000000 -1.667
## 124 Social_Distance_SCL control.dual 0.425000000 -1.525
## 125 Age control.dual 0.993000000 -0.273
## 126 Gender control.dual 0.932000000 -0.598
## 127 GC_level_3 outgroup.ingroup 0.001000000 -4.862
## 128 GC_level_4 outgroup.ingroup 0.001480000 3.718
## 129 GG_level outgroup.ingroup 0.077770000 -2.412
## 130 Simon_Dual_identity_SCL outgroup.ingroup 0.072000000 -2.443
## 131 Angst_SCL outgroup.ingroup 0.248000000 1.862
## 132 Stereotype_SCL outgroup.ingroup 0.185000000 2.016
## 133 Symb_Threat_SCL outgroup.ingroup 0.104000000 2.286
## 134 Real_Threat_SCL outgroup.ingroup 0.071000000 2.452
## 135 ITT outgroup.ingroup 0.047900000 2.609
## 136 Sympathy_with_GC outgroup.ingroup 0.680000000 -1.115
## 137 GG_Dehumanization outgroup.ingroup 0.112000000 2.256
## 138 Humanization outgroup.ingroup 1.000000000 -0.047
## 139 Peception_of_GC_mediator outgroup.ingroup 0.917000000 -0.646
## 140 Peception_of_GC_bridge outgroup.ingroup 0.994000000 0.255
## 141 Peception_of_GC_fifth_column outgroup.ingroup 0.192000000 1.997
## 142 Peception_of_GC_traitors outgroup.ingroup 0.007190000 3.258
## 143 Peception_of_GC_unique outgroup.ingroup 0.988700000 -0.319
## 144 Peception_of_GC_weak outgroup.ingroup 0.430500000 1.514
## 145 Peception_of_GC_lmlm outgroup.ingroup 0.961510000 0.488
## 146 Positive_perception_of_GC_SCL outgroup.ingroup 0.994000000 -0.264
## 147 Negative_perception_of_GC_SCL outgroup.ingroup 0.022050000 2.892
## 148 GC_intentions_9 outgroup.ingroup 0.542050000 -1.334
## 149 GC_intentions_10 outgroup.ingroup 0.269600000 -1.813
## 150 Surprise outgroup.ingroup 0.000640000 -3.810
## 151 Common_fate_SCL outgroup.ingroup 0.090500000 -2.350
## 152 CIIM_SCL outgroup.ingroup 0.593000000 -1.254
## 153 Outgtoup_similarity_SCL outgroup.ingroup 0.616000000 -1.217
## 154 IOS outgroup.ingroup 0.163000000 -2.079
## 155 SDO_SCL outgroup.ingroup 0.093600000 2.336
## 156 Identification_SCL outgroup.ingroup 0.913400000 0.656
## 157 Essentialism_SCL outgroup.ingroup 0.029890000 2.784
## 158 Hatered outgroup.ingroup 0.019900000 2.930
## 159 Fear outgroup.ingroup 0.222000000 1.922
## 160 Anger outgroup.ingroup 0.475000000 1.442
## 161 Hope outgroup.ingroup 0.913000000 -0.656
## 162 Empathy outgroup.ingroup 0.708000000 -1.070
## 163 Despair outgroup.ingroup 0.620000000 1.212
## 164 Policy_SCL outgroup.ingroup 0.071000000 2.452
## 165 Resource_allocation_SCL outgroup.ingroup 0.130000000 -2.187
## 166 Social_Distance_SCL outgroup.ingroup 0.927000000 -0.617
## 167 Age outgroup.ingroup 1.000000000 0.014
## 168 Gender outgroup.ingroup 1.000000000 -0.072
## 169 GC_level_3 control.ingroup 0.142700000 -2.144
## 170 GC_level_4 control.ingroup 0.113940000 2.248
## 171 GG_level control.ingroup 0.925060000 0.621
## 172 Simon_Dual_identity_SCL control.ingroup 0.292000000 -1.767
## 173 Angst_SCL control.ingroup 1.000000000 0.034
## 174 Stereotype_SCL control.ingroup 0.831000000 0.847
## 175 Symb_Threat_SCL control.ingroup 0.661000000 1.146
## 176 Real_Threat_SCL control.ingroup 0.253600000 1.848
## 177 ITT control.ingroup 0.689200000 1.100
## 178 Sympathy_with_GC control.ingroup 0.736000000 -1.022
## 179 GG_Dehumanization control.ingroup 0.354000000 1.648
## 180 Humanization control.ingroup 0.958000000 -0.505
## 181 Peception_of_GC_mediator control.ingroup 0.955000000 -0.517
## 182 Peception_of_GC_bridge control.ingroup 0.951000000 0.532
## 183 Peception_of_GC_fifth_column control.ingroup 0.724000000 1.043
## 184 Peception_of_GC_traitors control.ingroup 0.258080000 1.838
## 185 Peception_of_GC_unique control.ingroup 0.972300000 0.435
## 186 Peception_of_GC_weak control.ingroup 0.727500000 1.037
## 187 Peception_of_GC_lmlm control.ingroup 0.566930000 -1.295
## 188 Positive_perception_of_GC_SCL control.ingroup 0.998000000 0.180
## 189 Negative_perception_of_GC_SCL control.ingroup 0.389620000 1.584
## 190 GC_intentions_9 control.ingroup 0.160350000 -2.088
## 191 GC_intentions_10 control.ingroup 0.620700000 -1.210
## 192 Surprise control.ingroup NA NA
## 193 Common_fate_SCL control.ingroup 0.425300000 -1.523
## 194 CIIM_SCL control.ingroup 0.824000000 -0.861
## 195 Outgtoup_similarity_SCL control.ingroup 0.872000000 -0.760
## 196 IOS control.ingroup 0.406000000 -1.555
## 197 SDO_SCL control.ingroup 0.111000000 2.262
## 198 Identification_SCL control.ingroup 0.995600000 -0.232
## 199 Essentialism_SCL control.ingroup 0.149740000 2.123
## 200 Hatered control.ingroup 0.178700000 2.036
## 201 Fear control.ingroup 1.000000000 0.088
## 202 Anger control.ingroup 0.999900000 -0.068
## 203 Hope control.ingroup 0.936000000 -0.585
## 204 Empathy control.ingroup 0.777000000 -0.952
## 205 Despair control.ingroup 0.866200000 0.774
## 206 Policy_SCL control.ingroup 0.170000000 2.061
## 207 Resource_allocation_SCL control.ingroup 0.248000000 -1.861
## 208 Social_Distance_SCL control.ingroup 0.827000000 -0.856
## 209 Age control.ingroup 0.887000000 -0.725
## 210 Gender control.ingroup 0.999000000 0.129
## 211 GC_level_3 control.outgroup 0.012200000 3.085
## 212 GC_level_4 control.outgroup 0.288560000 -1.774
## 213 GG_level control.outgroup 0.009970000 3.149
## 214 Simon_Dual_identity_SCL control.outgroup 0.811100000 0.887
## 215 Angst_SCL control.outgroup 0.216000000 -1.937
## 216 Stereotype_SCL control.outgroup 0.551000000 -1.319
## 217 Symb_Threat_SCL control.outgroup 0.552000000 -1.318
## 218 Real_Threat_SCL control.outgroup 0.845700000 -0.818
## 219 ITT control.outgroup 0.324500000 -1.703
## 220 Sympathy_with_GC control.outgroup 0.997000000 0.197
## 221 GG_Dehumanization control.outgroup 0.852200000 -0.804
## 222 Humanization control.outgroup 0.972000000 -0.435
## 223 Peception_of_GC_mediator control.outgroup 0.998000000 0.187
## 224 Peception_of_GC_bridge control.outgroup 0.995000000 0.241
## 225 Peception_of_GC_fifth_column control.outgroup 0.683000000 -1.111
## 226 Peception_of_GC_traitors control.outgroup 0.336140000 -1.681
## 227 Peception_of_GC_unique control.outgroup 0.874200000 0.755
## 228 Peception_of_GC_weak control.outgroup 0.930100000 -0.606
## 229 Peception_of_GC_lmlm control.outgroup 0.294820000 -1.761
## 230 Positive_perception_of_GC_SCL control.outgroup 0.969000000 0.452
## 231 Negative_perception_of_GC_SCL control.outgroup 0.416500000 -1.538
## 232 GC_intentions_9 control.outgroup 0.933220000 -0.595
## 233 GC_intentions_10 control.outgroup 0.873700000 0.756
## 234 Surprise control.outgroup NA NA
## 235 Common_fate_SCL control.outgroup 0.735900000 1.023
## 236 CIIM_SCL control.outgroup 0.959000000 0.499
## 237 Outgtoup_similarity_SCL control.outgroup 0.944000000 0.557
## 238 IOS control.outgroup 0.895000000 0.706
## 239 SDO_SCL control.outgroup 0.997600000 -0.188
## 240 Identification_SCL control.outgroup 0.810400000 -0.889
## 241 Essentialism_SCL control.outgroup 0.864790000 -0.777
## 242 Hatered control.outgroup 0.744400000 -1.009
## 243 Fear control.outgroup 0.247000000 -1.864
## 244 Anger control.outgroup 0.423000000 -1.528
## 245 Hope control.outgroup 1.000000000 0.101
## 246 Empathy control.outgroup 0.998000000 0.168
## 247 Despair control.outgroup 0.962800000 -0.483
## 248 Policy_SCL control.outgroup 0.959000000 -0.500
## 249 Resource_allocation_SCL control.outgroup 0.953000000 0.525
## 250 Social_Distance_SCL control.outgroup 0.997000000 -0.200
## 251 Age control.outgroup 0.892000000 -0.713
## 252 Gender control.outgroup 0.997000000 0.198
## 253 GC_level_3 ANOVA 0.000000506 11.600
## 254 GC_level_4 ANOVA 0.003550000 4.675
## 255 GG_level ANOVA 0.000077200 7.615
## 256 Simon_Dual_identity_SCL ANOVA 0.017500000 3.457
## 257 Angst_SCL ANOVA 0.177000000 1.659
## 258 Stereotype_SCL ANOVA 0.116000000 1.993
## 259 Symb_Threat_SCL ANOVA 0.099400000 2.117
## 260 Real_Threat_SCL ANOVA 0.026800000 3.132
## 261 ITT ANOVA 0.032800000 2.976
## 262 Sympathy_with_GC ANOVA 0.422000000 0.942
## 263 GG_Dehumanization ANOVA 0.040200000 2.820
## 264 Humanization ANOVA 0.455000000 0.875
## 265 Peception_of_GC_mediator ANOVA 0.385000000 1.020
## 266 Peception_of_GC_bridge ANOVA 0.390000000 1.010
## 267 Peception_of_GC_fifth_column ANOVA 0.109000000 2.046
## 268 Peception_of_GC_traitors ANOVA 0.000910000 5.714
## 269 Peception_of_GC_unique ANOVA 0.061700000 2.488
## 270 Peception_of_GC_weak ANOVA 0.072900000 2.359
## 271 Peception_of_GC_lmlm ANOVA 0.015200000 3.567
## 272 Positive_perception_of_GC_SCL ANOVA 0.162000000 1.729
## 273 Negative_perception_of_GC_SCL ANOVA 0.004990000 4.415
## 274 GC_intentions_9 ANOVA 0.007390000 4.115
## 275 GC_intentions_10 ANOVA 0.066200000 2.434
## 276 Surprise ANOVA 0.000109000 9.779
## 277 Common_fate_SCL ANOVA 0.011000000 3.812
## 278 CIIM_SCL ANOVA 0.135000000 1.875
## 279 Outgtoup_similarity_SCL ANOVA 0.387000000 1.016
## 280 IOS ANOVA 0.157000000 1.755
## 281 SDO_SCL ANOVA 0.048200000 2.683
## 282 Identification_SCL ANOVA 0.100000000 2.113
## 283 Essentialism_SCL ANOVA 0.001300000 5.455
## 284 Hatered ANOVA 0.018500000 3.418
## 285 Fear ANOVA 0.136000000 1.869
## 286 Anger ANOVA 0.053900000 2.595
## 287 Hope ANOVA 0.081900000 2.271
## 288 Empathy ANOVA 0.382000000 1.027
## 289 Despair ANOVA 0.089700000 2.199
## 290 Policy_SCL ANOVA 0.023100000 3.250
## 291 Resource_allocation_SCL ANOVA 0.059200000 2.521
## 292 Social_Distance_SCL ANOVA 0.430000000 0.925
## 293 Age ANOVA 0.859000000 0.254
## 294 Gender ANOVA 0.859000000 0.254
#htmap.m<-ddply(htmap.m, .(variable), transform, rescale = rescale(value)) make the discrete p-val to continuous scale
combine.pf$cols <- ifelse(combine.pf$p_val <= 0.05, "very_sig",
ifelse(combine.pf$p_val > 0.1, "non_sig", "sig")) #nested if_else statements to classify p-val into 3 groups: 0-0.05 very sig, 0.05-0.1 sig, >0.1 non_sig
combine.pf$dir <- ifelse(combine.pf$f_val > 0, "positive", "negative")
ggplot(combine.pf, aes(comparison, var, fill = factor(cols), colour = dir)) + #x-axis comparison
geom_tile() +
scale_fill_manual(values = c(very_sig = "black",sig = "gray",non_sig = "white")) +
scale_colour_manual(values = c(positive = "green", negative = "red", size=50))+
xlab("") +
theme(axis.text.x = element_text( angle = 90, hjust = 1))
In the heatmap above, low p-val<0.05 are marked in black, 0.05 < p-val < 0.1 are in gray and high p-val>0.1 are colored in white. Since Surprise:Control group is missing, there are three box colored in dotted gray. The cell border displays the direction of the f-value, green for positive and red for negative.