# symbolic beliefs
x <- cbind(d$symbolic_beliefs_1, d$symbolic_beliefs_2, d$symbolic_beliefs_3)
d$avgSymbBelief <- rowMeans(x, na.rm = T)
d$avgSymbBelief[d$avgSymbBelief == "NaN"] <- NA
d$avgSymbBelief.c <- d$avgSymbBelief - mean(d$avgSymbBelief, na.rm = T)

# media index
d$index_ANexp_w1.c <- d$index_ANexp_w1 - mean(d$index_ANexp_w1, na.rm = T)
d$index_ANexp_w2.c <- d$index_ANexp_w2 - mean(d$index_ANexp_w2, na.rm = T)
d$index_ANexp_w3.c <- d$index_ANexp_w3 - mean(d$index_ANexp_w3, na.rm = T)

# educatoin and SES
d$education.c <- d$education - mean(d$education, na.rm = T)

# trust in science
x <- cbind(d$sciTrust_1, 
           d$sciTrust_2,
           d$sciTrust_3, 
           d$sciTrust_4,
           d$sciTrust_5, 
           d$sciTrust_6,
           d$sciTrust_7, 
           d$sciTrust_8,
           d$sciTrust_9, 
           d$sciTrust_10,
           d$sciTrust_11, 
           d$sciTrust_12,
           d$sciTrust_13,
           d$sciTrust_14,
           d$sciTrust_15)

d$avgTrustSci <- rowMeans(x, na.rm = T)
d$avgTrustSci[d$avgTrustSci == "NaN"] <- NA
d$avgTrustSci.c <- d$avgTrustSci - mean(d$avgTrustSci, na.rm = T)

d$white_1 <- NA
d$white_1[d$race == 1] <- 0
d$white_1[d$race == 2] <- 0
d$white_1[d$race == 3] <- 0
d$white_1[d$race == 4] <- 0
d$white_1[d$race == 5] <- 0
d$white_1[d$race == 6] <- 1

#exclude over/under aged pts
d$age <- as.numeric(d$age)
d$age[d$age > 120] <- NA #no pts > 120
d <- d[is.na(d$age) | d$age > 17,] #no pts < 17 and no NAs

d$age.c <- d$age - mean(d$age, na.rm = T)

ANALYSES

mediation path: analytical media -> trust in science -> vaccine behaviors

1. including age, ethnicity, & education

without interaction

summary(model.xm <- lm(avgTrustSci.c ~ index_ANexp_w3.c + avgSymbBelief.c + 
                         age.c + white_1 + education.c, data = d))
## 
## Call:
## lm(formula = avgTrustSci.c ~ index_ANexp_w3.c + avgSymbBelief.c + 
##     age.c + white_1 + education.c, data = d)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.38361 -0.45205 -0.00018  0.51664  1.77369 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -0.1682559  0.0450496  -3.735 0.000199 ***
## index_ANexp_w3.c  0.0006579  0.0003423   1.922 0.054922 .  
## avgSymbBelief.c  -0.2248660  0.0140743 -15.977  < 2e-16 ***
## age.c             0.0069866  0.0016073   4.347 1.53e-05 ***
## white_1           0.2186464  0.0538765   4.058 5.34e-05 ***
## education.c       0.0303636  0.0087332   3.477 0.000530 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7169 on 979 degrees of freedom
##   (2641 observations deleted due to missingness)
## Multiple R-squared:  0.2426, Adjusted R-squared:  0.2387 
## F-statistic: 62.71 on 5 and 979 DF,  p-value: < 2.2e-16
summary(model.xmy <- lm(vaxxBehavior ~ avgTrustSci.c + index_ANexp_w3.c + avgSymbBelief.c + 
                          age.c + white_1 + education.c, data = d)) 
## 
## Call:
## lm(formula = vaxxBehavior ~ avgTrustSci.c + index_ANexp_w3.c + 
##     avgSymbBelief.c + age.c + white_1 + education.c, data = d)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.6576 -0.4639  0.2702  0.6859  2.1453 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       3.326429   0.064265  51.761  < 2e-16 ***
## avgTrustSci.c     0.437943   0.045356   9.656  < 2e-16 ***
## index_ANexp_w3.c  0.003315   0.000488   6.794 1.89e-11 ***
## avgSymbBelief.c  -0.052354   0.022424  -2.335 0.019762 *  
## age.c             0.014022   0.002298   6.102 1.51e-09 ***
## white_1          -0.204531   0.077050  -2.655 0.008072 ** 
## education.c       0.041400   0.012445   3.327 0.000911 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.015 on 976 degrees of freedom
##   (2643 observations deleted due to missingness)
## Multiple R-squared:  0.2436, Adjusted R-squared:  0.239 
## F-statistic: 52.39 on 6 and 976 DF,  p-value: < 2.2e-16

with interaction

summary(model.xm <- lm(avgTrustSci.c ~ index_ANexp_w3.c * avgSymbBelief.c + 
                         age.c + white_1 + education.c, data = d))
## 
## Call:
## lm(formula = avgTrustSci.c ~ index_ANexp_w3.c * avgSymbBelief.c + 
##     age.c + white_1 + education.c, data = d)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.38535 -0.47918 -0.00555  0.51378  1.79664 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      -0.1565650  0.0451010  -3.471 0.000540 ***
## index_ANexp_w3.c                  0.0007471  0.0003427   2.180 0.029508 *  
## avgSymbBelief.c                  -0.2243094  0.0140289 -15.989  < 2e-16 ***
## age.c                             0.0073454  0.0016073   4.570 5.50e-06 ***
## white_1                           0.2235030  0.0537264   4.160 3.46e-05 ***
## education.c                       0.0288002  0.0087227   3.302 0.000996 ***
## index_ANexp_w3.c:avgSymbBelief.c  0.0005065  0.0001844   2.747 0.006121 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7145 on 978 degrees of freedom
##   (2641 observations deleted due to missingness)
## Multiple R-squared:  0.2484, Adjusted R-squared:  0.2438 
## F-statistic: 53.87 on 6 and 978 DF,  p-value: < 2.2e-16
summary(model.xmy <- lm(vaxxBehavior ~ (avgTrustSci.c + index_ANexp_w3.c) * avgSymbBelief.c + 
                          age.c + white_1 + education.c, data = d)) 
## 
## Call:
## lm(formula = vaxxBehavior ~ (avgTrustSci.c + index_ANexp_w3.c) * 
##     avgSymbBelief.c + age.c + white_1 + education.c, data = d)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.3707 -0.3907  0.2518  0.6559  2.2354 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                       3.3625717  0.0650223  51.714  < 2e-16 ***
## avgTrustSci.c                     0.4237276  0.0453573   9.342  < 2e-16 ***
## index_ANexp_w3.c                  0.0033594  0.0004884   6.878 1.08e-11 ***
## avgSymbBelief.c                  -0.0562735  0.0223690  -2.516  0.01204 *  
## age.c                             0.0147093  0.0022981   6.401 2.40e-10 ***
## white_1                          -0.1886669  0.0768662  -2.454  0.01428 *  
## education.c                       0.0407214  0.0124123   3.281  0.00107 ** 
## avgTrustSci.c:avgSymbBelief.c     0.0487120  0.0227414   2.142  0.03244 *  
## index_ANexp_w3.c:avgSymbBelief.c  0.0006070  0.0002662   2.280  0.02280 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.01 on 974 degrees of freedom
##   (2643 observations deleted due to missingness)
## Multiple R-squared:  0.252,  Adjusted R-squared:  0.2458 
## F-statistic: 41.01 on 8 and 974 DF,  p-value: < 2.2e-16

sobel test 1: Main effect (no interaction model)

sobel test 2: Interaction between mediator and ideology

sobel test 3: Main effect (interaction model)

2. including ONLY age & education

without interaction

summary(model.xm <- lm(avgTrustSci.c ~ index_ANexp_w3.c + avgSymbBelief.c + 
                         age.c + education.c, data = d))
## 
## Call:
## lm(formula = avgTrustSci.c ~ index_ANexp_w3.c + avgSymbBelief.c + 
##     age.c + education.c, data = d)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.34243 -0.46201 -0.00436  0.51287  1.77456 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -0.0159112  0.0240257  -0.662 0.507961    
## index_ANexp_w3.c  0.0003895  0.0003367   1.157 0.247635    
## avgSymbBelief.c  -0.2196552  0.0140541 -15.629  < 2e-16 ***
## age.c             0.0070894  0.0016068   4.412 1.14e-05 ***
## education.c       0.0308629  0.0088048   3.505 0.000477 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7247 on 988 degrees of freedom
##   (2633 observations deleted due to missingness)
## Multiple R-squared:  0.2305, Adjusted R-squared:  0.2274 
## F-statistic:    74 on 4 and 988 DF,  p-value: < 2.2e-16
summary(model.xmy <- lm(vaxxBehavior ~ avgTrustSci.c + index_ANexp_w3.c + avgSymbBelief.c + 
                          age.c + education.c, data = d)) 
## 
## Call:
## lm(formula = vaxxBehavior ~ avgTrustSci.c + index_ANexp_w3.c + 
##     avgSymbBelief.c + age.c + education.c, data = d)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.5638 -0.4874  0.2673  0.7109  2.0821 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       3.175867   0.033983  93.455  < 2e-16 ***
## avgTrustSci.c     0.430198   0.045040   9.551  < 2e-16 ***
## index_ANexp_w3.c  0.003687   0.000478   7.713 2.99e-14 ***
## avgSymbBelief.c  -0.061078   0.022217  -2.749  0.00608 ** 
## age.c             0.012671   0.002293   5.525 4.23e-08 ***
## education.c       0.040679   0.012523   3.248  0.00120 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.024 on 985 degrees of freedom
##   (2635 observations deleted due to missingness)
## Multiple R-squared:  0.238,  Adjusted R-squared:  0.2341 
## F-statistic: 61.52 on 5 and 985 DF,  p-value: < 2.2e-16

with interaction

summary(model.xm <- lm(avgTrustSci.c ~ index_ANexp_w3.c * avgSymbBelief.c + 
                         age.c + education.c, data = d))
## 
## Call:
## lm(formula = avgTrustSci.c ~ index_ANexp_w3.c * avgSymbBelief.c + 
##     age.c + education.c, data = d)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -2.34609 -0.47600 -0.00753  0.52069  1.83684 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      -0.0006880  0.0245878  -0.028 0.977682    
## index_ANexp_w3.c                  0.0004708  0.0003370   1.397 0.162612    
## avgSymbBelief.c                  -0.2187190  0.0140125 -15.609  < 2e-16 ***
## age.c                             0.0074815  0.0016080   4.653 3.72e-06 ***
## education.c                       0.0293542  0.0087936   3.338 0.000875 ***
## index_ANexp_w3.c:avgSymbBelief.c  0.0005073  0.0001858   2.731 0.006428 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.7224 on 987 degrees of freedom
##   (2633 observations deleted due to missingness)
## Multiple R-squared:  0.2363, Adjusted R-squared:  0.2324 
## F-statistic: 61.08 on 5 and 987 DF,  p-value: < 2.2e-16
summary(model.xmy <- lm(vaxxBehavior ~ (avgTrustSci.c + index_ANexp_w3.c) * avgSymbBelief.c + 
                          age.c + education.c, data = d)) 
## 
## Call:
## lm(formula = vaxxBehavior ~ (avgTrustSci.c + index_ANexp_w3.c) * 
##     avgSymbBelief.c + age.c + education.c, data = d)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.2796 -0.4031  0.2571  0.6571  2.1900 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                       3.2234797  0.0370860  86.919  < 2e-16 ***
## avgTrustSci.c                     0.4154318  0.0450532   9.221  < 2e-16 ***
## index_ANexp_w3.c                  0.0037074  0.0004787   7.745 2.38e-14 ***
## avgSymbBelief.c                  -0.0639515  0.0221452  -2.888  0.00396 ** 
## age.c                             0.0134682  0.0022963   5.865 6.13e-09 ***
## education.c                       0.0402301  0.0124922   3.220  0.00132 ** 
## avgTrustSci.c:avgSymbBelief.c     0.0480043  0.0226707   2.117  0.03447 *  
## index_ANexp_w3.c:avgSymbBelief.c  0.0006213  0.0002680   2.319  0.02063 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.019 on 983 degrees of freedom
##   (2635 observations deleted due to missingness)
## Multiple R-squared:  0.2465, Adjusted R-squared:  0.2411 
## F-statistic: 45.93 on 7 and 983 DF,  p-value: < 2.2e-16

sobel test 1: Main effect (no interaction model; exclude ethnicity)

sobel test 2: Interaction between mediator and ideology (exclude ethnicity)

sobel test 3: Main effect (interaction model; exclude ethnicity)