# continuous party
d$partyCont <- NA
d$partyCont[d$demStrength == 1] <- -3
d$partyCont[d$demStrength == 2] <- -2
d$partyCont[d$partyClose == 1] <- -1
d$partyCont[d$partyClose == 3] <- 0
d$partyCont[d$repStrength == 1] <- 3
d$partyCont[d$repStrength == 2] <- 2
d$partyCont[d$partyClose == 2] <- 1
# policy group proposer
d$Policy_Group <- NA
d$Policy_Group[d$FL_71_DO == 'proportional_dem' | d$FL_71_DO == 'US1st_dem'] <- "Democratic"
d$Policy_Group[d$FL_71_DO == 'proportional_rep' | d$FL_71_DO == 'US1st_rep'] <- "Republican"
d$Policy_Group[d$FL_71_DO == 'proportional_bipart' | d$FL_71_DO == 'US1st_bipart'] <- "Bipartisan"
d$Policy_Group[d$FL_71_DO == 'proportional_expert' | d$FL_71_DO == 'US1st_expert'] <- "Expert"
d$Policy_Group <- factor(d$Policy_Group, levels = c('Democratic', 'Republican', 'Bipartisan','Expert'))
# policy frame
d$Policy_Frame <- NA
d$Policy_Frame[d$FL_71_DO == 'proportional_dem' | d$FL_71_DO == 'proportional_rep' | d$FL_71_DO == 'proportional_bipart' | d$FL_71_DO == 'proportional_expert'] <- "Proportional"
d$Policy_Frame[d$FL_71_DO == 'US1st_dem' | d$FL_71_DO == 'US1st_rep' | d$FL_71_DO == 'US1st_bipart' | d$FL_71_DO == 'US1st_expert'] <- "US1st"
# party factor
d$party_factor <- NA
d$party_factor[d$partyCont < 0] <- 'Democrat'
d$party_factor[d$partyCont == 0] <- 'Independent'
d$party_factor[d$partyCont > 0] <- 'Republican'
## Order of timing var
d$election_timing <- factor(d$election_timing, levels = c('Pre-election', 'During-election','Post-election'))
d$party_factor <- factor(d$party_factor, levels = c('Democrat', 'Republican','Independent'))
d$anger <- d$emotion_1
## Only Pre-election!
d <- d[d$election_timing != 'Pre-election',]
### Partisan framing codes
# Code 1: Left vs. Right
d$fDem_Rep <- NA
d$fDem_Rep[d$Policy_Group == 'Democratic'] <- -.5
d$fDem_Rep[d$Policy_Group == 'Republican'] <- .5
d$fDem_Rep[d$Policy_Group == 'Bipartisan' | d$Policy_Group == 'Expert'] <- 0
# Code 2: Bi vs. Exp
d$fBi_Exp <- NA
d$fBi_Exp[d$Policy_Group == 'Democratic' | d$Policy_Group == 'Republican'] <- 0
d$fBi_Exp[d$Policy_Group == 'Bipartisan'] <- -.5
d$fBi_Exp[d$Policy_Group == 'Expert'] <- .5
# Code 3 = Dem and Rep vs. Exp and Bi
d$fParties_BiExp <- NA
d$fParties_BiExp[d$Policy_Group == 'Democratic' | d$Policy_Group == 'Republican'] <- -.5
d$fParties_BiExp[d$Policy_Group == 'Bipartisan' | d$Policy_Group == 'Expert'] <- .5
### Timing codes
## Contrast
d$tDur_Post <- NA
d$tDur_Post[d$election_timing == 'During-election'] <- -.5
d$tDur_Post[d$election_timing == 'Post-election'] <- .5
## Dummy
# During!
d$tDur <- NA
d$tDur[d$election_timing == 'During-election'] <- 0
d$tDur[d$election_timing == 'Post-election'] <- 1
# Post!
d$tPost <- NA
d$tPost[d$election_timing == 'During-election'] <- 1
d$tPost[d$election_timing == 'Post-election'] <- 0
### Party Factor
## Contrasts
d$pDem_Rep <- NA
d$pDem_Rep[d$party_factor == 'Democrat'] <- -.5
d$pDem_Rep[d$party_factor == 'Independent'] <- 0
d$pDem_Rep[d$party_factor == 'Republican'] <- .5
d$pInd_Not <- NA
d$pInd_Not[d$party_factor == 'Democrat'] <- .33
d$pInd_Not[d$party_factor == 'Independent'] <- -.67
d$pInd_Not[d$party_factor == 'Republican'] <- .33
## Dummy codes
d$pDemR[d$party_factor == 'Democrat'] <- 0
d$pDemR[d$party_factor == 'Republican'] <- 1
d$pDemR[d$party_factor == 'Independent'] <- 0
d$pDemI[d$party_factor == 'Democrat'] <- 0
d$pDemI[d$party_factor == 'Republican'] <- 0
d$pDemI[d$party_factor == 'Independent'] <- 1
d$pRepD[d$party_factor == 'Democrat'] <- 1
d$pRepD[d$party_factor == 'Republican'] <- 0
d$pRepD[d$party_factor == 'Independent'] <- 0
d$pRepI[d$party_factor == 'Democrat'] <- 0
d$pRepI[d$party_factor == 'Republican'] <- 0
d$pRepI[d$party_factor == 'Independent'] <- 1
d$pIndD[d$party_factor == 'Democrat'] <- 1
d$pIndD[d$party_factor == 'Republican'] <- 0
d$pIndD[d$party_factor == 'Independent'] <- 0
d$pIndR[d$party_factor == 'Democrat'] <- 0
d$pIndR[d$party_factor == 'Republican'] <- 1
d$pIndR[d$party_factor == 'Independent'] <- 0
### centering
d$ownvote.c <- d$ownvote_conf - mean(d$ownvote_conf, na.rm = T)
d$overallvote.c <- d$overallvote_conf - mean(d$overallvote_conf, na.rm = T)
# Media Measures - All, including Fox
d$mediaExposure_all <- rowMeans(d[,c("mediaExposure_1","mediaExposure_2","mediaExposure_3","mediaExposure_4","mediaExposure_5","mediaExposure_6","mediaExposure_7","mediaExposure_8","mediaExposure_9","mediaExposure_10","mediaExposure_11","mediaExposure_12","mediaExposure_13","mediaExposure_14","mediaExposure_15")], na.rm = T)
#psych::alpha(d[,c("mediaExposure_1","mediaExposure_2","mediaExposure_3","mediaExposure_4","mediaExposure_6","mediaExposure_7","mediaExposure_8","mediaExposure_9","mediaExposure_10","mediaExposure_11","mediaExposure_12","mediaExposure_13","mediaExposure_14","mediaExposure_15", "mediaExposure_5")])
# alpha is .92
d$mediaTrust_all <- rowMeans(d[,c("mediaTrust_1","mediaTrust_2","mediaTrust_3","mediaTrust_4","mediaTrust_5","mediaTrust_6","mediaTrust_7","mediaTrust_8","mediaTrust_9","mediaTrust_10","mediaTrust_11","mediaTrust_12","mediaTrust_13","mediaTrust_14","mediaTrust_15")], na.rm = T)
#psych::alpha(d[,c("mediaTrust_1","mediaTrust_2","mediaTrust_3","mediaTrust_4","mediaTrust_6","mediaTrust_7","mediaTrust_8","mediaTrust_9","mediaTrust_10","mediaTrust_11","mediaTrust_12","mediaTrust_13","mediaTrust_14","mediaTrust_15", "mediaTrust_5")])
# asks if mediaTrust_5 was reverse scored; alpha still .95
# Media Measures - Excluding Fox
d$mediaExposure <- rowMeans(d[,c("mediaExposure_1","mediaExposure_2","mediaExposure_3","mediaExposure_4","mediaExposure_6","mediaExposure_7","mediaExposure_8","mediaExposure_9","mediaExposure_10","mediaExposure_11","mediaExposure_12","mediaExposure_13","mediaExposure_14","mediaExposure_15")], na.rm = T)
#psych::alpha(d[,c("mediaExposure_1","mediaExposure_2","mediaExposure_3","mediaExposure_4","mediaExposure_6","mediaExposure_7","mediaExposure_8","mediaExposure_9","mediaExposure_10","mediaExposure_11","mediaExposure_12","mediaExposure_13","mediaExposure_14","mediaExposure_15")])
# alpha is .93
d$mediaTrust <- rowMeans(d[,c("mediaTrust_1","mediaTrust_2","mediaTrust_3","mediaTrust_4","mediaTrust_6","mediaTrust_7","mediaTrust_8","mediaTrust_9","mediaTrust_10","mediaTrust_11","mediaTrust_12","mediaTrust_13","mediaTrust_14","mediaTrust_15")], na.rm = T)
#psych::alpha(d[,c("mediaTrust_1","mediaTrust_2","mediaTrust_3","mediaTrust_4","mediaTrust_6","mediaTrust_7","mediaTrust_8","mediaTrust_9","mediaTrust_10","mediaTrust_11","mediaTrust_12","mediaTrust_13","mediaTrust_14","mediaTrust_15")])
# alpha is .97
#psych::alpha(d[,c("mediaTrust_1","mediaTrust_2","mediaTrust_3","mediaTrust_4","mediaTrust_6","mediaTrust_7","mediaTrust_8","mediaTrust_9","mediaTrust_10","mediaTrust_11","mediaTrust_12","mediaTrust_13","mediaTrust_14","mediaTrust_15","mediaExposure_1","mediaExposure_2","mediaExposure_3","mediaExposure_4","mediaExposure_6","mediaExposure_7","mediaExposure_8","mediaExposure_9","mediaExposure_10","mediaExposure_11","mediaExposure_12","mediaExposure_13","mediaExposure_14","mediaExposure_15")])
# alpha is .96
### Composite Media variables
#average own and overall vote
d$voteLegit <- (d$ownvote_conf + d$overallvote_conf)/2
d$voteLegit.c <- d$voteLegit - mean(d$voteLegit, na.rm = T)
#recenter media/fox trust to match media/fox exposure scale
d$mediaTrust5 <- d$mediaTrust_5 + 3
d$mediaTrust <- d$mediaTrust + 3
d$foxPerception <- (d$mediaExposure_5 + d$mediaTrust5)/2
d$mediaPerception <- (d$mediaExposure + d$mediaTrust)/2
d$foxPerception.c <- d$foxPerception - mean(d$foxPerception, na.rm = T)
d$mediaPerception.c <- d$mediaPerception - mean(d$mediaPerception, na.rm = T)
### Indices
During <- d$election_timing == 'During-election'
Post <- d$election_timing == 'Post-election'
# mean center fox exposure
d$foxExposure.c <- d$mediaExposure_5 - mean(d$mediaExposure_5, na.rm = T)
# mean center other media exposure
d$otherMediaExposure.c <- d$mediaExposure - mean(d$mediaExposure, na.rm = T)
#create difference score
d$diffFoxOther <- d$mediaExposure_5 - d$mediaExposure
#reverse code biden to trump rating win --> trump definitely win = 1; biden definitely win = 9
d$electPredict_T_B2 <- 10 - d$electPredict_B_T
d$electPredict_T_B3 <- 10 - d$electPredict_B_T.1
#combine to make 1 column
d$electPredictTB <- ifelse(!is.na(d$electPredict_T_B), d$electPredict_T_B,
ifelse(!is.na(d$electPredict_T_B2), d$electPredict_T_B2,
ifelse(!is.na(d$electPredict_T_B3), d$electPredict_T_B3, NA)))
d$electPredictTB.plot <- d$electPredictTB - 5
m <- lm(anger ~ (pDem_Rep + pInd_Not) * foxPerception.c * mediaPerception.c, data = d)
summary(m)
##
## Call:
## lm(formula = anger ~ (pDem_Rep + pInd_Not) * foxPerception.c *
## mediaPerception.c, data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.4902 -1.7239 -0.3375 1.5668 5.7631
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.82527 0.08045 35.119 < 2e-16
## pDem_Rep 0.15957 0.17963 0.888 0.3745
## pInd_Not 0.38765 0.18506 2.095 0.0364
## foxPerception.c -0.02642 0.07388 -0.358 0.7207
## mediaPerception.c -0.08416 0.09644 -0.873 0.3830
## pDem_Rep:foxPerception.c 0.62435 0.13768 4.535 6.34e-06
## pInd_Not:foxPerception.c 0.16776 0.18796 0.893 0.3723
## pDem_Rep:mediaPerception.c -1.05898 0.19825 -5.342 1.10e-07
## pInd_Not:mediaPerception.c -0.29482 0.23394 -1.260 0.2078
## foxPerception.c:mediaPerception.c 0.13952 0.06374 2.189 0.0288
## pDem_Rep:foxPerception.c:mediaPerception.c 0.02073 0.13271 0.156 0.8759
## pInd_Not:foxPerception.c:mediaPerception.c -0.07782 0.15350 -0.507 0.6123
##
## (Intercept) ***
## pDem_Rep
## pInd_Not *
## foxPerception.c
## mediaPerception.c
## pDem_Rep:foxPerception.c ***
## pInd_Not:foxPerception.c
## pDem_Rep:mediaPerception.c ***
## pInd_Not:mediaPerception.c
## foxPerception.c:mediaPerception.c *
## pDem_Rep:foxPerception.c:mediaPerception.c
## pInd_Not:foxPerception.c:mediaPerception.c
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.019 on 1201 degrees of freedom
## (29 observations deleted due to missingness)
## Multiple R-squared: 0.06126, Adjusted R-squared: 0.05266
## F-statistic: 7.125 on 11 and 1201 DF, p-value: 7.949e-12
No
There is an interaction between partisanship (Dem vs. Rep) and media exposure/trust (p < .001) as well as partisanship (Dem vs. Rep) and Fox exposure/trust (p < .001).
media.plot <- ggplot(d[!is.na(d$party_factor),], aes(x = mediaPerception, y = anger)) +
geom_smooth(method = 'lm', aes(x = mediaPerception, y = anger, col = "darkgreen")) +
facet_wrap(~party_factor)
media.plot + theme_classic() +
xlab("Media Trust/Exposure") +
ylab("Anger") +
theme(legend.position = c(1000,1000)) +
coord_cartesian(ylim = c(1, 7)) +
scale_y_continuous(breaks = c(1,2,3,4,5,6,7)) +
scale_color_manual(values = c("darkgreen"))
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 15 rows containing non-finite values (stat_smooth).
fox.plot <- ggplot(d[!is.na(d$party_factor),], aes(x = foxPerception, y = anger)) +
geom_smooth(method = 'lm', aes(x = foxPerception, y = anger, col = "darkred")) +
facet_wrap(~party_factor)
fox.plot + theme_classic() +
xlab("Fox Trust/Exposure") +
ylab("Anger") +
theme(legend.position = c(1000,1000)) +
coord_cartesian(ylim = c(1, 7)) +
scale_y_continuous(breaks = c(1,2,3,4,5,6,7)) +
scale_color_manual(values = c("darkred"))
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 15 rows containing non-finite values (stat_smooth).
angermed.i <- lm(voteLegit ~ (pDem_Rep + pInd_Not), data = d)
summary(angermed.i)
##
## Call:
## lm(formula = voteLegit ~ (pDem_Rep + pInd_Not), data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.1667 -0.8920 0.1080 0.8333 2.1080
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.34407 0.03644 91.78 < 2e-16 ***
## pDem_Rep -1.27466 0.07151 -17.82 < 2e-16 ***
## pInd_Not 0.56142 0.09055 6.20 7.73e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.138 on 1205 degrees of freedom
## (34 observations deleted due to missingness)
## Multiple R-squared: 0.2324, Adjusted R-squared: 0.2311
## F-statistic: 182.4 on 2 and 1205 DF, p-value: < 2.2e-16
Yes, p < .001
angermed.ii <- lm(anger ~ (pDem_Rep + pInd_Not), data = d)
summary(angermed.ii)
##
## Call:
## lm(formula = anger ~ (pDem_Rep + pInd_Not), data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.5582 -1.6649 -0.5582 1.4418 4.3351
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.11949 0.06528 47.785 < 2e-16 ***
## pDem_Rep 0.42962 0.12880 3.336 0.000877 ***
## pInd_Not 0.67846 0.16182 4.193 2.96e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.052 on 1212 degrees of freedom
## (27 observations deleted due to missingness)
## Multiple R-squared: 0.02234, Adjusted R-squared: 0.02073
## F-statistic: 13.85 on 2 and 1212 DF, p-value: 1.129e-06
Yes, p < .001
angermed.iii <- lm(voteLegit ~ (pDem_Rep + pInd_Not) + anger, data = d)
summary(angermed.iii)
##
## Call:
## lm(formula = voteLegit ~ (pDem_Rep + pInd_Not) + anger, data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.3962 -0.8446 0.1415 0.8189 2.4980
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.67997 0.06055 60.775 < 2e-16 ***
## pDem_Rep -1.22895 0.07049 -17.433 < 2e-16 ***
## pInd_Not 0.63440 0.08949 7.089 2.30e-12 ***
## anger -0.10756 0.01565 -6.874 9.99e-12 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.116 on 1204 degrees of freedom
## (34 observations deleted due to missingness)
## Multiple R-squared: 0.2613, Adjusted R-squared: 0.2595
## F-statistic: 142 on 3 and 1204 DF, p-value: < 2.2e-16
No different – b = -1.28 in the Y ~ X model, b = -1.23 in the model including the mediator
d$anger <- d$emotion_1
angermed <- mediate(y = "voteLegit", x = c("pDem_Rep","pInd_Not"), m = "anger", data = d, n.obs = 1242, n.iter = 100)
summary(angermed)
## Call: mediate(y = "voteLegit", x = c("pDem_Rep", "pInd_Not"), m = "anger",
## data = d, n.obs = 1242, n.iter = 100)
##
## Direct effect estimates (traditional regression) (c')
## voteLegit se t df Prob
## Intercept 3.68 0.06 61.71 1238 0.00e+00
## pDem_Rep -1.23 0.07 -17.71 1238 1.01e-62
## pInd_Not 0.62 0.09 7.10 1238 2.11e-12
## anger -0.11 0.02 -6.94 1238 6.24e-12
##
## R = 0.51 R2 = 0.26 F = 146.09 on 3 and 1238 DF p-value: 4.81e-81
##
## Total effect estimates (c)
## voteLegit se t df Prob
## Intercept 3.35 0.04 93.63 1239 0.00e+00
## pDem_Rep -1.28 0.07 -18.11 1239 3.04e-65
## pInd_Not 0.55 0.09 6.20 1239 7.75e-10
##
## 'a' effect estimates
## anger se t df Prob
## Intercept 3.12 0.06 48.42 1239 5.54e-288
## pDem_Rep 0.43 0.13 3.38 1239 7.47e-04
## pInd_Not 0.68 0.16 4.24 1239 2.45e-05
##
## 'b' effect estimates
## voteLegit se t df Prob
## anger -0.11 0.02 -6.94 1239 6.12e-12
##
## 'ab' effect estimates (through mediators)
## voteLegit boot sd lower upper
## pDem_Rep -0.05 -0.05 0.00 -0.05 -0.05
## pInd_Not -0.07 -0.06 0.01 -0.07 -0.04