setwd("~/Documents/Dropbox/Research/Adrian")
a<-read.csv ("AI_conservatism_new_intervention_study.csv", header=T, sep=",")

names(a)
##  [1] "v1"                "V2"                "V3"               
##  [4] "V4"                "V5"                "V6"               
##  [7] "V7"                "V8"                "V9"               
## [10] "V10"               "Q26"               "Q28"              
## [13] "Q30"               "Q34"               "control"          
## [16] "risk"              "downwards"         "upwards"          
## [19] "car_risk_1"        "car_trust_1"       "age"              
## [22] "gender"            "inc"               "edu"              
## [25] "poli_1"            "poli_2"            "poli_3"           
## [28] "LocationLatitude"  "LocationLongitude" "LocationAccuracy"
a$cond[a$control==1]<-"control"
a$cond[a$risk==1]<-"risk"
a$cond[a$downwards==1]<-"down"
a$cond[a$upwards==1]<-"up"

main effects of condition

summary(lm(car_risk_1 ~ cond, data=a))
## 
## Call:
## lm(formula = car_risk_1 ~ cond, data = a)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -65.464 -21.550   6.301  20.263  48.450 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   63.699      1.760  36.192  < 2e-16 ***
## conddown       1.765      2.671   0.661    0.509    
## condrisk     -12.149      2.568  -4.731 2.65e-06 ***
## condup         1.038      2.697   0.385    0.700    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 27.04 on 797 degrees of freedom
## Multiple R-squared:  0.04337,    Adjusted R-squared:  0.03977 
## F-statistic: 12.04 on 3 and 797 DF,  p-value: 1.023e-07
summary(lm(car_trust_1 ~ cond, data=a))
## 
## Call:
## lm(formula = car_trust_1 ~ cond, data = a)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -49.895 -24.558  -2.558  26.105  57.442 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  43.0847     1.9236  22.398   <2e-16 ***
## conddown     -0.5267     2.9197  -0.180   0.8569    
## condrisk      6.8100     2.8068   2.426   0.0155 *  
## condup       -0.1819     2.9479  -0.062   0.9508    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 29.55 on 797 degrees of freedom
## Multiple R-squared:  0.01087,    Adjusted R-squared:  0.007151 
## F-statistic: 2.921 on 3 and 797 DF,  p-value: 0.03326

main effects of conservatism

summary(lm(car_risk_1 ~ poli_2, data=a))
## 
## Call:
## lm(formula = car_risk_1 ~ poli_2, data = a)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -74.553 -21.208   6.299  20.618  46.299 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  74.5527     2.3007  32.404  < 2e-16 ***
## poli_2       -0.2085     0.0326  -6.396 2.71e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 26.93 on 799 degrees of freedom
## Multiple R-squared:  0.0487, Adjusted R-squared:  0.04751 
## F-statistic: 40.91 on 1 and 799 DF,  p-value: 2.715e-10
summary(lm(car_trust_1 ~ poli_2, data=a))
## 
## Call:
## lm(formula = car_trust_1 ~ poli_2, data = a)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -53.598 -23.644  -3.404  25.858  69.794 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 28.71321    2.45806  11.681  < 2e-16 ***
## poli_2       0.24885    0.03483   7.145 2.03e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 28.77 on 799 degrees of freedom
## Multiple R-squared:  0.06005,    Adjusted R-squared:  0.05887 
## F-statistic: 51.05 on 1 and 799 DF,  p-value: 2.035e-12

interactions between condition and conservatism - upwards only significant one

summary(lm(car_risk_1 ~ poli_2 * cond, data=a))
## 
## Call:
## lm(formula = car_risk_1 ~ poli_2 * cond, data = a)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -71.714 -18.747   4.656  19.490  60.058 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      77.24220    4.29658  17.978  < 2e-16 ***
## poli_2           -0.20634    0.06009  -3.434 0.000626 ***
## conddown          6.62627    6.37547   1.039 0.298964    
## condrisk         -5.52827    6.09298  -0.907 0.364515    
## condup          -10.88118    6.30627  -1.725 0.084835 .  
## poli_2:conddown  -0.08228    0.09020  -0.912 0.361930    
## poli_2:condrisk  -0.11138    0.08620  -1.292 0.196681    
## poli_2:condup     0.18090    0.08876   2.038 0.041866 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 26.19 on 793 degrees of freedom
## Multiple R-squared:  0.1073, Adjusted R-squared:  0.09941 
## F-statistic: 13.62 on 7 and 793 DF,  p-value: < 2.2e-16
summary(lm(car_trust_1 ~ poli_2* cond, data=a))
## 
## Call:
## lm(formula = car_trust_1 ~ poli_2 * cond, data = a)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -58.819 -23.296  -1.917  24.150  68.616 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     24.49893    4.68238   5.232 2.15e-07 ***
## poli_2           0.28317    0.06549   4.324 1.73e-05 ***
## conddown        -6.79081    6.94794  -0.977   0.3287    
## condrisk         9.89365    6.64009   1.490   0.1366    
## condup          12.77179    6.87253   1.858   0.0635 .  
## poli_2:conddown  0.10653    0.09829   1.084   0.2788    
## poli_2:condrisk -0.03890    0.09394  -0.414   0.6789    
## poli_2:condup   -0.19494    0.09673  -2.015   0.0442 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 28.54 on 793 degrees of freedom
## Multiple R-squared:  0.08222,    Adjusted R-squared:  0.07412 
## F-statistic: 10.15 on 7 and 793 DF,  p-value: 3.327e-12
control<-subset(a, cond=="control")
up<-subset(a, cond=="up")
down<-subset(a, cond=="down")
risk<-subset(a, cond=="risk")

summary(lm(car_risk_1 ~ poli_2, data=control))
## 
## Call:
## lm(formula = car_risk_1 ~ poli_2, data = control)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -62.799 -18.136   5.963  20.761  43.391 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 77.24220    4.35374  17.742  < 2e-16 ***
## poli_2      -0.20634    0.06089  -3.389 0.000824 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 26.53 on 234 degrees of freedom
## Multiple R-squared:  0.04678,    Adjusted R-squared:  0.04271 
## F-statistic: 11.48 on 1 and 234 DF,  p-value: 0.0008238

no effect of conservatism in upwards condition only

summary(lm(car_risk_1 ~ poli_2, data=up))
## 
## Call:
## lm(formula = car_risk_1 ~ poli_2, data = up)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -65.089 -18.924   5.402  20.369  36.183 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 66.36102    4.77863  13.887   <2e-16 ***
## poli_2      -0.02544    0.06762  -0.376    0.707    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 27.11 on 173 degrees of freedom
## Multiple R-squared:  0.0008172,  Adjusted R-squared:  -0.004958 
## F-statistic: 0.1415 on 1 and 173 DF,  p-value: 0.7073
summary(lm(car_risk_1 ~ poli_2, data=down))
## 
## Call:
## lm(formula = car_risk_1 ~ poli_2, data = down)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -70.405 -12.169   3.965  17.395  41.530 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 83.86847    4.42156  18.968  < 2e-16 ***
## poli_2      -0.28861    0.06314  -4.571 9.03e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 24.58 on 179 degrees of freedom
## Multiple R-squared:  0.1045, Adjusted R-squared:  0.09952 
## F-statistic: 20.89 on 1 and 179 DF,  p-value: 9.03e-06
summary(lm(car_risk_1 ~ poli_2, data=risk))
## 
## Call:
## lm(formula = car_risk_1 ~ poli_2, data = risk)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -71.71 -20.94   0.49  19.49  60.06 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 71.71393    4.34724  16.496  < 2e-16 ***
## poli_2      -0.31772    0.06219  -5.109 7.34e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 26.35 on 207 degrees of freedom
## Multiple R-squared:  0.112,  Adjusted R-squared:  0.1077 
## F-statistic:  26.1 on 1 and 207 DF,  p-value: 7.34e-07
summary(lm(car_trust_1 ~ poli_2, data=control))
## 
## Call:
## lm(formula = car_trust_1 ~ poli_2, data = control)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -52.82 -24.62  -2.86  26.00  60.19 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 24.49893    4.75659   5.151 5.51e-07 ***
## poli_2       0.28317    0.06652   4.257 3.00e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 28.99 on 234 degrees of freedom
## Multiple R-squared:  0.07187,    Adjusted R-squared:  0.0679 
## F-statistic: 18.12 on 1 and 234 DF,  p-value: 3.004e-05
summary(lm(car_trust_1 ~ poli_2, data=up))
## 
## Call:
## lm(formula = car_trust_1 ~ poli_2, data = up)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -46.09 -25.99  -3.77  22.44  62.20 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 37.27072    5.27072   7.071 3.64e-11 ***
## poli_2       0.08822    0.07459   1.183    0.238    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 29.9 on 173 degrees of freedom
## Multiple R-squared:  0.008022,   Adjusted R-squared:  0.002288 
## F-statistic: 1.399 on 1 and 173 DF,  p-value: 0.2385
summary(lm(car_trust_1 ~ poli_2, data=down))
## 
## Call:
## lm(formula = car_trust_1 ~ poli_2, data = down)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -54.729 -18.164  -3.789  20.859  68.616 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 17.70812    4.68079   3.783 0.000211 ***
## poli_2       0.38969    0.06684   5.830 2.54e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 26.02 on 179 degrees of freedom
## Multiple R-squared:  0.1596, Adjusted R-squared:  0.1549 
## F-statistic: 33.99 on 1 and 179 DF,  p-value: 2.536e-08
summary(lm(car_trust_1 ~ poli_2, data=risk))
## 
## Call:
## lm(formula = car_trust_1 ~ poli_2, data = risk)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -58.819 -24.393   3.486  25.607  51.661 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 34.39258    4.77330   7.205 1.06e-11 ***
## poli_2       0.24427    0.06828   3.577 0.000432 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 28.93 on 207 degrees of freedom
## Multiple R-squared:  0.05822,    Adjusted R-squared:  0.05367 
## F-statistic:  12.8 on 1 and 207 DF,  p-value: 0.0004323
library(visreg)
all1<-lm(car_trust_1 ~ poli_2*cond, data=a)
contup<-subset(a, cond=="control" | cond=="up")
contup1<-lm(car_trust_1 ~ poli_2*cond, data=contup)

plotting just the control and upwards conditions

visreg(contup1, "poli_2", by="cond", overlay=TRUE, partial=FALSE,  scale="response", xlab="cons", ylab="trust")

#plotting all conditions

visreg(all1, "poli_2", by="cond", overlay=TRUE, partial=FALSE,  scale="response", xlab="cons", ylab="trust")

summary(a$poli_2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    0.00   50.00   68.00   64.25   90.00  100.00
cons<-subset(a, poli_2 <=60)
lib<-subset(a, poli_2>60)

looking at main effects of condition among conservatives and liberals

(defining this as above or below 50 would be most natural, but the conservatism sample is quite small in that case)

summary(lm(car_trust_1~ cond, data=cons))
## 
## Call:
## lm(formula = car_trust_1 ~ cond, data = cons)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -43.357 -23.357  -5.451  25.293  63.560 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   34.440      2.856  12.060   <2e-16 ***
## conddown      -4.978      4.283  -1.162   0.2460    
## condrisk       8.917      4.059   2.197   0.0287 *  
## condup         7.586      4.346   1.746   0.0817 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 28.56 on 350 degrees of freedom
## Multiple R-squared:  0.03718,    Adjusted R-squared:  0.02893 
## F-statistic: 4.505 on 3 and 350 DF,  p-value: 0.00407
summary(lm(car_trust_1~ cond, data=lib))
## 
## Call:
## lm(formula = car_trust_1 ~ cond, data = lib)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -55.667 -24.186   1.559  24.333  56.424 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   49.441      2.461  20.087   <2e-16 ***
## conddown       3.490      3.770   0.925   0.3552    
## condrisk       6.225      3.672   1.696   0.0907 .  
## condup        -5.865      3.792  -1.547   0.1226    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 28.7 on 443 degrees of freedom
## Multiple R-squared:  0.02265,    Adjusted R-squared:  0.01603 
## F-statistic: 3.422 on 3 and 443 DF,  p-value: 0.01725
summary(lm(car_risk_1~ cond, data=cons))
## 
## Call:
## lm(formula = car_risk_1 ~ cond, data = cons)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -74.613 -10.418   5.171  18.333  38.582 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   70.310      2.519  27.913   <2e-16 ***
## conddown       4.303      3.778   1.139   0.2556    
## condrisk      -8.892      3.580  -2.483   0.0135 *  
## condup        -5.481      3.833  -1.430   0.1536    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 25.19 on 350 degrees of freedom
## Multiple R-squared:  0.03893,    Adjusted R-squared:  0.0307 
## F-statistic: 4.726 on 3 and 350 DF,  p-value: 0.003017
summary(lm(car_risk_1~ cond, data=lib))
## 
## Call:
## lm(formula = car_risk_1 ~ cond, data = lib)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -64.667 -22.252   4.782  21.248  57.162 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  58.8382     2.3156  25.410  < 2e-16 ***
## conddown     -0.6204     3.5471  -0.175    0.861    
## condrisk    -16.0004     3.4542  -4.632 4.76e-06 ***
## condup        5.8284     3.5676   1.634    0.103    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 27 on 443 degrees of freedom
## Multiple R-squared:  0.08044,    Adjusted R-squared:  0.07421 
## F-statistic: 12.92 on 3 and 443 DF,  p-value: 4.193e-08