Replication project based on paper, Eady, G., Paskhalis, T., Zilinsky, J., Bonneau, R., Nagler, J., & Tucker, J. A. (2023). Exposure to the Russian Internet Research Agency foreign influence campaign on Twitter in the 2016 US election and its relationship to attitudes and voting behavior. Nature Communications, 14(1), 62. Avaiable at: https://doi.org/10.1038/s41467-022-35576-9
Replication method:
output: html_document: code_download: true toc: true toc_depth: 2 toc_float: collapsed: false smooth_scroll: true
# Global options
opts_chunk$set(echo=TRUE,
cache=TRUE,
comment=NA,
message=FALSE,
warning=FALSE)
# All used libraries
library(rmarkdown)
library(knitr)
library(dplyr)
library(estimatr)
library(lfe)
library(lmtest)
library(MASS)
library(mvtnorm)
library(nnet)
library(sandwich)
library(tidyr)
library(cowplot)
library(lubridate)
library(openxlsx)
library(ggplot2)
library(sjPlot)
library(reshape2)
$rmarkdown
[1] '2.23'
$knitr
[1] '1.43'
$dplyr
[1] '1.1.2'
$estimatr
[1] '1.0.2'
$lfe
[1] '3.0.0'
$lmtest
[1] '0.9.40'
$MASS
[1] '7.3.60'
$mvtnorm
[1] '1.2.3'
$nnet
[1] '7.3.19'
$sandwich
[1] '3.1.0'
$tidyr
[1] '1.3.0'
$cowplot
[1] '1.1.3'
$lubridate
[1] '1.9.2'
$openxlsx
[1] '4.2.5.2'
$ggplot2
[1] '3.4.4'
$sjPlot
[1] '2.8.15'
$reshape2
[1] '1.4.4'
[1] "R version 4.3.2 (2023-10-31)"
The paper examines whether exposure to Russian foreign influence Twitter posts affects the voting choice of voters in the 2016 US election, and specifically whether they are more likely to switch towards Donald Trump. The authors find that there is no significant relationship between exposure to Russian posts and changes in voting behaviour. Their analysis assumes a linear relationship, meaning that the effect does not depend upon the characteristics of the individuals exposed to the posts. It is plausible, however, that effects are heterogeneous. While there is no significant relationship between exposure and voting choices for the full sample, there may be some demographic groups for which the posts do have an influence. Various demographic characteristics may be relevant when considering heterogeneity, including age, education levels, ethnicity, and gender (e.g. Pew Research Center, 2023). This study focuses explicitly on the strength of an individual’s political views and whether this affects the relationship between exposure to Russian tweets and voting patterns.
The Pew Research Center study (2020) shows that voters rarely switch parties, an outcome consistent with the data used in Eady et al. (2023). They do find, however, that switching is more likely among less politically engaged voters. Such outcomes further suggest that foreign influence campaigns are unlikely to influence the voting choices of more politically engaged voters but have a better chance of influencing those less politically engaged (Fujiwara et al, 2023). This is in part due to politically engaged voters often seeking out information online which align with their current beliefs (Weeks et al, 2017). Given that these voters tend to view posts that reinforce their beliefs, there is often a lesser likelihood of viewing posts that provide alternate viewpoints (Garcia, 2023).
In order to undertake this extension, the same data as in the original study will be used. The methodology used, however, will be different, with the approach allowing for non-linear effects. Using information in the dataset of Eady et al. (2023) on the strength of a voter’s affiliation to a particular party, the study tests the hypothesis that foreign influence campaigns are more likely to change the voting behaviour of those with moderate political views. The study uses an indicator of where voters rank themselves on a scale (0 being strong Democrat and 1 strong Republican) to address this hypothesis. To test for this heterogeneity or non-linearity, a linear regression model with interaction terms is employed. Specifically, the approach includes an interaction term between the strength of political views and the exposure to foreign influence campaigns. The expectation is that the interaction term will be significant, such that individuals with weaker political views will show a greater likelihood of changing their voting behaviour in response to Russian tweets.
Given the above information I am testing the hypothesis that voters with more politically moderate views are more likely to be influenced by foreign influence campaigns to change their vote preferences.
#load in the data
us2016_twitter <- readRDS("Survey_Data.rds")
The data combines a YouGov survey and Twitter 27 election integrity data. The data comprises 3,500 observations on 190 variables, though the authors exclude individuals without a Twitter account. There are three dependent variables; ‘change_rank_trump_over_clinton_w1w3’; ‘voted_trump_versus_clinton’: and ‘voted_trump_versus_clinton_benefit’. All three take on three possible values: +1 indicating a shift towards Trump, -1 a shift away from Trump, and 0 indicating no change. The first variable captures changes in the ranking of Trump versus Clinton between the 1st and 2nd survey waves; the second shifts towards (or away) Trump, a no vote, or a 3rd candidate (+1); and the third changes in voting preferences between the 1st survey and the actual vote.
The main independent variable captures the number of Russian tweets an individual is exposed to. Given the interest in the strength of political views and not whether they are strongly Democrat or Republican, the variable on political persuasion (pid7) is recoded so that ‘Strong Democrat’ and ‘Strong Republican’ are classified as ‘Strong’, ‘Lean Democrat’ and ‘Lean Republican’ are ‘Lean’, ‘Not very strong Democrat’ and ‘Not very strong Republican’ are ‘Not Strong’, and ‘Independent’ remains ‘Independent’. A numerical variable is also created, with 0 being ‘Strong’, 0.25 being ‘Lean’, 0.5 being ‘Not Strong’, and 0.75 being ‘Independent’.
#re-code the data so that education is now split between 'High school or below' and 'College', the race variable is now 'White' or 'Non-White', regions are also divided into 'South', 'Northeast', 'Midwest' and 'West'
us2016_recoded <- us2016_twitter %>%
filter(have_twitter_data == 1) %>%
mutate(
income = as.numeric(income),
education = factor(case_when(
education == "High school or below" ~ "High school or below",
education %in% c("College degree", "Post-graduate degree") ~ "College+"
), levels = c("High school or below", "College+")),
race = factor(case_when(
race == "White" ~ "White",
race %in% c("Black", "Hispanic", "Other") ~ "Non-White"
), levels = c("White", "Non-White")),
region = factor(region, levels = c("South", "Northeast", "Midwest", "West"))
)
#Recode variables into 4 categories "Strong", "Lean", "Not Strong" and "Independent"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Strong Democrat"] <- "Strong"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Strong Republican"] <- "Strong"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Lean Democrat"] <- "Lean"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Lean Republican"] <- "Lean"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Not very strong Democrat"] <- "Not Strong"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Not very strong Republican"] <- "Not Strong"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Independent"] <- "Independent"
#Recode variables
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Strong Democrat"] <- 0
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Strong Republican"] <- 0
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Lean Democrat"] <- .25
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Lean Republican"] <- .25
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Not very strong Democrat"] <- .5
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Not very strong Republican"] <- .5
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Independent"] <- 0.75
# Average value of the newly created political strength variable
mean(us2016_recoded$pol_strength_num, na.rm = TRUE)
[1] 0.2672999
# Plot of distribution of newly created political strength variable
desc_plot <- ggplot((data = us2016_recoded), aes(x = pol_strength, na.rm = TRUE)) + labs(x = "Political Strength", y = "Count", title = "Figure 1: Distribution of Political Views") +
geom_bar()
desc_plot
The mean of the political strength variable is 0.27, with Figure 1
indicating the majority of respondents classified themselves as either
“Strong Democrat” or “Strong Republican”.
# Descriptive two-way tables on numbers switching vote by political leaning
desc_table_1 <- table(us2016_recoded$pol_strength_num, us2016_recoded$change_rank_trump_over_clinton_w1w3)
colnames(desc_table_1) = c("Away from Trump", "No Change", "Towards Trump")
rownames(desc_table_1) = c("Strong", "Not Strong", "Lean", "Independent")
desc_table_1
Away from Trump No Change Towards Trump
Strong 7 381 12
Not Strong 6 187 10
Lean 9 203 13
Independent 6 115 11
desc_table_2 <- table(us2016_recoded$pol_strength_num, us2016_recoded$voted_trump_versus_clinton)
colnames(desc_table_2) = c("Away from Trump", "No Change", "Towards Trump")
rownames(desc_table_2) = c("Strong", "Not Strong", "Lean", "Independent")
desc_table_2
Away from Trump No Change Towards Trump
Strong 7 440 12
Not Strong 5 174 1
Lean 7 231 12
Independent 2 70 5
desc_table_3 <- table(us2016_recoded$pol_strength_num, us2016_recoded$voted_trump_versus_clinton_benefit)
colnames(desc_table_3) = c("Away from Trump", "No Change", "Towards Trump")
rownames(desc_table_3) = c("Strong", "Not Strong", "Lean", "Independent")
desc_table_3
Away from Trump No Change Towards Trump
Strong 19 440 51
Not Strong 23 174 40
Lean 34 231 38
Independent 38 70 48
The tables shows the distribution of the dependent variables by strength of political views. “No change” has the highest percentages, indicating that few voters tend to change voting intentions. Those that do change are generally favourable for Trump, with independents more likely to switch political views.
The original paper uses Ordinary Least Squares (OLS) regression, estimating a linear relationship between exposure to Russian tweets and changes in voter preferences. The original study also included a range of control variables in the regression. This study also uses OLS regression, but includes an interaction between the exposure variable and an indicator of the strength of political views. This is done in two ways.
Firstly, an interaction between the exposure variable and the numerical variable capturing the strength of political views is included. These two variables are also included individually. The numerical variable takes on values of 0, 0.25, 0.5, or 0.75, with higher values indicating less strong political views. A positive coefficient on the interaction would indicate that people with less strong political views are more likely to switch their vote choice for a given level of exposure to Russian tweets.
A shortcoming of the interaction term described above is that it assumes that the difference in likelihood of switching vote is the same for strong vs lean as it is for not strong vs independent. A second approach relaxes this assumption. In this case, the exposure variable is interacted with a categorical variable. This results in the estimation of a coefficient on the exposure variable and coefficients on three interactions of the exposure variable with dummy variables for lean, not strong, and independent. In this case, the coefficient on the non-interacted exposure variable captures the effect of exposure on vote choice for the excluded category (i.e., strong political views), while the coefficients on the three interactions capture the effects of exposure on vote choice for the three other categories. By estimating separate coefficients for each category, this approach doesn’t restrict the difference in coefficients to be the same between consecutive categories.
To examine whether the influence of exposure to Russian tweets depends on how strong an individual’s political views are, an interaction between the exposure variable and political strength variable is included in the model. Given that higher numbers of the political strength variable imply a more independent (less politically strong) view, then a positive (and significant) coefficient on the interaction term would mean that more politically independent voters are more likely to switch their vote (towards Trump) in response to exposure to Russian tweets.
#===============================================================================
# Introduce the Interactions between Exposure and Strength of Political Views
#Create a new Table E6 with Interaction term
vote_rank_total_russia_count_lm_controls <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls)
confint(vote_rank_total_russia_count_lm_controls)
vote_rank_total_russia_count_lm_controls_black <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black)
confint(vote_rank_total_russia_count_lm_controls_black)
vote_rank_total_russia_count_lm_controls_total_tweets <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log + pol_strength_num, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets)
confint(vote_rank_total_russia_count_lm_controls_total_tweets)
#Create a tab model combining the above regressions
tab_model (vote_rank_total_russia_count_lm_controls, vote_rank_total_russia_count_lm_controls_black, vote_rank_total_russia_count_lm_controls_total_tweets, pred.labels = c ("Constant", "Exposure", "Political Views", "Age", " Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure * Political Views", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 1: Non-linear effects of exposure to Russian tweets on the likelihood of shifting voter preference between survey waves", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 3, 13, 4, 5, 6, 7, 14, 15, 8, 9, 10, 11, 16, 12, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
| (1) | (2) | (3) | ||||
|---|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | Estimates | std. Error | Estimates | std. Error |
| Exposure | 0.010 | 0.005 | 0.010 | 0.005 | 0.009 | 0.006 |
| Political Views | 0.102 * | 0.048 | 0.106 * | 0.048 | 0.106 * | 0.049 |
| Exposure * Political Views | -0.048 ** | 0.015 | -0.048 ** | 0.015 | -0.048 ** | 0.015 |
| Age | 0.000 | 0.001 | 0.000 | 0.001 | 0.000 | 0.001 |
| Woman | 0.031 | 0.018 | 0.031 | 0.018 | 0.031 | 0.018 |
| College-educated | 0.007 | 0.019 | 0.008 | 0.018 | 0.008 | 0.018 |
| Income | -0.011 | 0.010 | -0.011 | 0.010 | -0.011 | 0.010 |
| Other/Hispanic | -0.041 | 0.026 | -0.041 | 0.026 | ||
| Black | 0.026 | 0.029 | 0.026 | 0.029 | ||
| Person of Color | -0.010 | 0.020 | ||||
| Region: Northeast | 0.001 | 0.028 | 0.003 | 0.028 | 0.003 | 0.028 |
| Region: Midwest | -0.019 | 0.020 | -0.018 | 0.020 | -0.018 | 0.021 |
| Region: West | -0.014 | 0.025 | -0.009 | 0.025 | -0.009 | 0.025 |
| log(Total Tweets) | 0.001 | 0.005 | ||||
| Freq. of social media use | -0.004 | 0.007 | -0.004 | 0.007 | -0.004 | 0.007 |
| Constant | 0.016 | 0.068 | 0.017 | 0.068 | 0.012 | 0.081 |
| Observations | 917 | 917 | 917 | |||
| R2 / R2 adjusted | 0.020 / 0.007 | 0.023 / 0.009 | 0.023 / 0.008 | |||
|
||||||
Beginning with Table 1, which reports the results when using the first dependent variable, the coefficient on the level of exposure is positive, which indicates a positive association between exposure to Russian tweets and the probability of switching towards Trump for those with strong political views (a political strength value of zero).
plot_model(vote_rank_total_russia_count_lm_controls, type = "pred", terms = c("total_exposure_russia_log", "pol_strength_num")) + labs(title = "Figure 2: Nonlinear effect of exposure to Russian tweets on change
in voting preferences towards Trump between survey
Wave 1 and 2", x = " Total Exposure (log +1)", y = "Change in voting preference
towards Trump between Wave 1 and Wave 2", color = "Strength of Political Views")
The interaction term (exposure * political strength) is found to be negative and significant indicating that the probability of shifting towards Trump is smaller for those that have less strong political views. This can be seen in Figure 2. The figure also reports the confidence intervals and effects are generally not significant at the 5% level. This indicates that the impact is found to be positive for strong political views and negative for the other three. The effects are generally not significant at the 95% level. There are exceptions, however, with high levels of exposure significantly reducing the probability of changing for more independent voters. At the 90% level, effects are significant, including the positive effect of exposure on the probability of shifting for those with stronger views.
# New Table E7 with Interaction
vote_rank_total_russia_count_lm_controls <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls)
confint(vote_rank_total_russia_count_lm_controls)
vote_rank_total_russia_count_lm_controls_black <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black)
confint(vote_rank_total_russia_count_lm_controls_black)
vote_rank_total_russia_count_lm_controls_total_tweets <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log + pol_strength_num, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets)
confint(vote_rank_total_russia_count_lm_controls_total_tweets)
#Create a tab model combining the above regressions
tab_model (vote_rank_total_russia_count_lm_controls, vote_rank_total_russia_count_lm_controls_black, vote_rank_total_russia_count_lm_controls_total_tweets, pred.labels = c ("Constant", "Exposure", "Political Views", "Age", " Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure * Political Views", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 2: Non-linear effects of exposure to Russian tweets on the likelihood of shifting voter preference towards Trump, a no vote, or a 3rd candidate", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 3, 13, 4, 5, 6, 7, 14, 15, 8, 9, 10, 11, 16, 12, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
| (1) | (2) | (3) | ||||
|---|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | Estimates | std. Error | Estimates | std. Error |
| Exposure | 0.004 | 0.004 | 0.004 | 0.004 | 0.005 | 0.005 |
| Political Views | 0.069 | 0.038 | 0.068 | 0.038 | 0.067 | 0.038 |
| Exposure * Political Views | -0.022 | 0.014 | -0.022 | 0.014 | -0.022 | 0.014 |
| Age | -0.000 | 0.000 | -0.000 | 0.000 | -0.000 | 0.000 |
| Woman | 0.033 * | 0.015 | 0.033 * | 0.015 | 0.033 * | 0.015 |
| College-educated | 0.010 | 0.015 | 0.010 | 0.015 | 0.010 | 0.015 |
| Income | -0.003 | 0.008 | -0.003 | 0.008 | -0.003 | 0.008 |
| Other/Hispanic | 0.036 | 0.030 | 0.037 | 0.030 | ||
| Black | 0.007 | 0.024 | 0.007 | 0.024 | ||
| Person of Color | 0.022 | 0.020 | ||||
| Region: Northeast | -0.007 | 0.022 | -0.008 | 0.022 | -0.008 | 0.022 |
| Region: Midwest | -0.006 | 0.018 | -0.006 | 0.018 | -0.005 | 0.018 |
| Region: West | 0.005 | 0.024 | 0.004 | 0.024 | 0.004 | 0.024 |
| log(Total Tweets) | -0.002 | 0.006 | ||||
| Freq. of social media use | 0.004 | 0.006 | 0.004 | 0.006 | 0.005 | 0.006 |
| Constant | -0.046 | 0.056 | -0.046 | 0.056 | -0.030 | 0.070 |
| Observations | 923 | 923 | 923 | |||
| R2 / R2 adjusted | 0.012 / -0.001 | 0.013 / -0.001 | 0.013 / -0.002 | |||
|
||||||
plot_model(vote_rank_total_russia_count_lm_controls, type = "pred", terms = c("total_exposure_russia_log", "pol_strength_num")) + labs(title = "Figure 3: Nonlinear effect of exposure to Russian tweets
on changes in voter preference towards Trump, third party
candidates or no vote", x = " Total Exposure (log +1)",
y = "Change in voting preference towards Trump,
third party candidates and no vote" , color = "Strength of Political Views")
In terms of the signs of the effects, Table 2, which reports results from the second dependent variable, is consistent with those in 1, but none of the coefficients are significant. This implies that exposure has no impact on the probability of changing voting intentions and that there are no significant differences between groups when considering a dependent variable that also allows for changes towards third candidates or choosing not to vote.
The results in Table 3 below, which reports results when using the third dependent variable, also show the same signs on the main coefficients as in the other two tables. Here the final specification provides the strongest evidence of a positive effect of exposure on changing the voting intentions of those with strong political views, with the coefficient on the exposure variable being positive and significant. While the coefficient on the interaction term is negative, consistent with previous results, it is not significant.
# New Table E8 with Interaction
vote_rank_total_russia_count_lm_controls <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls)
confint(vote_rank_total_russia_count_lm_controls)
vote_rank_total_russia_count_lm_controls_black <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black)
confint(vote_rank_total_russia_count_lm_controls_black )
vote_rank_total_russia_count_lm_controls_total_tweets <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log + pol_strength_num, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets)
confint(vote_rank_total_russia_count_lm_controls_total_tweets)
#Create a tab model combining the above regressions
tab_model(vote_rank_total_russia_count_lm_controls, vote_rank_total_russia_count_lm_controls_black, vote_rank_total_russia_count_lm_controls_total_tweets, pred.labels = c ("Constant", "Exposure", "Political Views", "Age", " Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure * Political Views", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 3: Non-linear effects of exposure to Russian tweets on changes in voting preferences between the 1st wave of the YouGov survey and the actual vote", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 3, 13, 4, 5, 6, 7, 14, 15, 8, 9, 10, 11, 16, 12, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
| (1) | (2) | (3) | ||||
|---|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | Estimates | std. Error | Estimates | std. Error |
| Exposure | 0.011 | 0.007 | 0.011 | 0.007 | 0.022 * | 0.009 |
| Political Views | 0.069 | 0.077 | 0.071 | 0.077 | 0.063 | 0.077 |
| Exposure * Political Views | -0.054 * | 0.026 | -0.055 * | 0.026 | -0.051 | 0.026 |
| Age | -0.001 | 0.001 | -0.001 | 0.001 | -0.001 | 0.001 |
| Woman | 0.090 ** | 0.028 | 0.089 ** | 0.028 | 0.092 ** | 0.028 |
| College-educated | 0.046 | 0.029 | 0.046 | 0.029 | 0.045 | 0.029 |
| Income | -0.036 * | 0.015 | -0.036 * | 0.015 | -0.036 * | 0.015 |
| Other/Hispanic | 0.053 | 0.052 | 0.053 | 0.052 | ||
| Black | 0.094 * | 0.041 | 0.092 * | 0.040 | ||
| Person of Color | 0.072 * | 0.036 | ||||
| Region: Northeast | -0.018 | 0.041 | -0.017 | 0.041 | -0.016 | 0.041 |
| Region: Midwest | 0.021 | 0.036 | 0.021 | 0.036 | 0.025 | 0.036 |
| Region: West | -0.005 | 0.040 | -0.003 | 0.040 | -0.000 | 0.040 |
| log(Total Tweets) | -0.020 * | 0.010 | ||||
| Freq. of social media use | 0.008 | 0.014 | 0.007 | 0.014 | 0.009 | 0.014 |
| Constant | 0.023 | 0.117 | 0.024 | 0.117 | 0.198 | 0.138 |
| Observations | 1146 | 1146 | 1146 | |||
| R2 / R2 adjusted | 0.027 / 0.017 | 0.028 / 0.017 | 0.031 / 0.019 | |||
|
||||||
plot_model(vote_rank_total_russia_count_lm_controls, type = "pred", terms = c("total_exposure_russia_log", "pol_strength_num")) +
labs(title = "Figure 4: Nonlinear effect of exposure to Russian tweets on
changes in voting preferences between the 1st wave of the
YouGov survey and the actual vote. ", x = "Total Exposure (log +1)",
y = "Change in voting preference between the 1st
wave of the survey and the actual vote", color = "Strength of Political Views")
This following results interact the exposure variable with the categorical political strength variable. In this case the linear exposure variable will refer to the coefficient on exposure for the omitted group (independent voters) while the coefficients on the three different interactions refer to the coefficients on the exposure variable for the other three political strength groups.
# Introduce the Interactions between Exposure and Strength of Political Views
# New Table E6 with Interaction (This is an alternative where we estimate a separate coefficient on exposure for each type of political strength)
vote_rank_total_russia_count_lm_controls_new1 <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_new1)
confint(vote_rank_total_russia_count_lm_controls_new1)
vote_rank_total_russia_count_lm_controls_black_new1 <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black_new1)
confint(vote_rank_total_russia_count_lm_controls_black_new1)
vote_rank_total_russia_count_lm_controls_total_tweets_new1 <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets_new1)
confint(vote_rank_total_russia_count_lm_controls_total_tweets_new1)
tab_model (vote_rank_total_russia_count_lm_controls_new1, vote_rank_total_russia_count_lm_controls_black_new1, vote_rank_total_russia_count_lm_controls_total_tweets_new1, pred.labels = c ("Constant", "Exposure - Independent", "Political Views - Lean", "Political Views - Not Strong", "Political Views - Strong", "Age", "Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure - Lean", "Exposure - Not Strong", "Exposure - Strong", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 4: Non-linear effects of exposure to Russian tweets on the likelihood of shifting voter preference between waves of the survey ", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 15, 16, 17, 3, 4, 5, 6, 7, 8, 9, 10, 18, 19, 11, 12, 13, 20, 14, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
| (1) | (2) | (3) | ||||
|---|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | Estimates | std. Error | Estimates | std. Error |
| Exposure - Independent | -0.021 | 0.013 | -0.020 | 0.013 | -0.021 | 0.014 |
| Exposure - Lean | 0.023 | 0.017 | 0.023 | 0.017 | 0.023 | 0.017 |
| Exposure - Not Strong | -0.000 | 0.015 | -0.002 | 0.015 | -0.002 | 0.015 |
| Exposure - Strong | 0.030 * | 0.014 | 0.030 * | 0.014 | 0.030 * | 0.014 |
| Political Views - Lean | -0.041 | 0.051 | -0.043 | 0.051 | -0.042 | 0.051 |
| Political Views - Not Strong | -0.002 | 0.053 | -0.004 | 0.053 | -0.003 | 0.052 |
| Political Views - Strong | -0.063 | 0.047 | -0.067 | 0.047 | -0.067 | 0.047 |
| Age | 0.000 | 0.001 | 0.000 | 0.001 | 0.000 | 0.001 |
| Woman | 0.032 | 0.018 | 0.032 | 0.018 | 0.032 | 0.018 |
| College-educated | 0.006 | 0.018 | 0.007 | 0.018 | 0.007 | 0.018 |
| Income | -0.011 | 0.010 | -0.011 | 0.010 | -0.011 | 0.010 |
| Person of Color | -0.011 | 0.020 | ||||
| Other/Hispanic | -0.044 | 0.026 | -0.044 | 0.026 | ||
| Black | 0.027 | 0.028 | 0.027 | 0.028 | ||
| Region: Northeast | -0.000 | 0.028 | 0.002 | 0.028 | 0.001 | 0.028 |
| Region: Midwest | -0.020 | 0.020 | -0.019 | 0.020 | -0.019 | 0.021 |
| Region: West | -0.013 | 0.025 | -0.008 | 0.025 | -0.008 | 0.025 |
| log(Total Tweets) | 0.001 | 0.005 | ||||
| Freq. of social media use | -0.004 | 0.007 | -0.004 | 0.007 | -0.005 | 0.008 |
| Constant | 0.084 | 0.069 | 0.089 | 0.070 | 0.079 | 0.077 |
| Observations | 917 | 917 | 917 | |||
| R2 / R2 adjusted | 0.021 / 0.004 | 0.025 / 0.006 | 0.025 / 0.005 | |||
|
||||||
In table 4 we find a negative effect on the exposure variable for independent voters, implying that greater exposure is associated with a lower probability of changing vote for independents. Conversely the coefficient for strong political views is positive and significant, so higher exposure increases the probability of voters switching preferences. As such, the results are consistent with those above, with independent voters showing a lower likelihood of switching voting preferences and those with strong political views showing a higher likelihood of switching.
# New Table E7 with Interaction (This is an alternative where we estimate a separate coefficient on exposure for each type of political strength)
vote_rank_total_russia_count_lm_controls_new <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_new)
confint(vote_rank_total_russia_count_lm_controls_new)
vote_rank_total_russia_count_lm_controls_black_new <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black_new)
confint(vote_rank_total_russia_count_lm_controls_black_new)
vote_rank_total_russia_count_lm_controls_total_tweets_new <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets_new)
confint(vote_rank_total_russia_count_lm_controls_total_tweets_new)
tab_model (vote_rank_total_russia_count_lm_controls_new, vote_rank_total_russia_count_lm_controls_black_new, vote_rank_total_russia_count_lm_controls_total_tweets_new, pred.labels = c ("Constant", "Exposure - Independent", "Political Views - Lean", "Political Views - Not Strong", "Political Views - Strong", "Age", "Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure - Lean", "Exposure - Not Strong", "Exposure - Strong", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 5: Non-linear effects of exposure to Russian tweets on the likelihood of shifting voter preference towards Trump, a no vote, or a 3rd candidate", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 15, 16, 17, 3, 4, 5, 6, 7, 8, 9, 10, 18, 19, 11, 12, 13, 20, 14, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
| (1) | (2) | (3) | ||||
|---|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | Estimates | std. Error | Estimates | std. Error |
| Exposure - Independent | 0.006 | 0.014 | 0.006 | 0.014 | 0.007 | 0.014 |
| Exposure - Lean | -0.008 | 0.014 | -0.008 | 0.014 | -0.008 | 0.014 |
| Exposure - Not Strong | -0.019 | 0.015 | -0.019 | 0.015 | -0.019 | 0.015 |
| Exposure - Strong | -0.000 | 0.014 | 0.000 | 0.014 | -0.000 | 0.014 |
| Political Views - Lean | -0.043 | 0.036 | -0.042 | 0.036 | -0.042 | 0.036 |
| Political Views - Not Strong | 0.015 | 0.040 | 0.016 | 0.040 | 0.016 | 0.040 |
| Political Views - Strong | -0.029 | 0.035 | -0.027 | 0.035 | -0.027 | 0.035 |
| Age | -0.000 | 0.000 | -0.000 | 0.000 | -0.000 | 0.000 |
| Woman | 0.033 * | 0.016 | 0.033 * | 0.016 | 0.033 * | 0.015 |
| College-educated | 0.011 | 0.015 | 0.012 | 0.015 | 0.012 | 0.015 |
| Income | -0.004 | 0.008 | -0.004 | 0.008 | -0.004 | 0.008 |
| Person of Color | 0.019 | 0.020 | ||||
| Other/Hispanic | 0.034 | 0.030 | 0.034 | 0.030 | ||
| Black | 0.006 | 0.025 | 0.006 | 0.025 | ||
| Region: Northeast | -0.010 | 0.022 | -0.010 | 0.022 | -0.010 | 0.022 |
| Region: Midwest | -0.007 | 0.018 | -0.007 | 0.018 | -0.007 | 0.018 |
| Region: West | 0.004 | 0.024 | 0.002 | 0.024 | 0.002 | 0.024 |
| log(Total Tweets) | -0.002 | 0.006 | ||||
| Freq. of social media use | 0.003 | 0.006 | 0.003 | 0.006 | 0.003 | 0.007 |
| Constant | -0.003 | 0.067 | -0.004 | 0.066 | 0.009 | 0.075 |
| Observations | 923 | 923 | 923 | |||
| R2 / R2 adjusted | 0.020 / 0.002 | 0.020 / 0.002 | 0.020 / 0.001 | |||
|
||||||
In table 5, none of the coefficients on our variables of interest are significant. Interestingly, however, the pattern of coefficients is different to the results above, with positive coefficients for independents and negative for strong voters. Similar to the results from using the alternative interaction term, therefore, the results suggest that when accounting for the possibility of switching to third candidates or not voting results are generally insignificant, and in this case showing opposite signs to when using the alternative dependent variables.
# New Table E8 with Interaction (This is an alternative where we estimate a separate coefficient on exposure for each type of political strength)
vote_rank_total_russia_count_lm_controls_new3 <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_new3)
confint(vote_rank_total_russia_count_lm_controls_new3)
vote_rank_total_russia_count_lm_controls_black_new3 <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black_new3)
confint(vote_rank_total_russia_count_lm_controls_black_new3)
vote_rank_total_russia_count_lm_controls_total_tweets_new3 <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets_new3)
confint(vote_rank_total_russia_count_lm_controls_total_tweets_new3)
tab_model (vote_rank_total_russia_count_lm_controls_new3, vote_rank_total_russia_count_lm_controls_black_new3, vote_rank_total_russia_count_lm_controls_total_tweets_new3, pred.labels = c ("Constant", "Exposure - Independent", "Political Views - Lean", "Political Views - Not Strong", "Political Views - Strong", "Age", "Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure - Lean", "Exposure - Not Strong", "Exposure - Strong", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 6: Nonlinear effect of exposure to Russian tweets on
changes in voting preferences between the 1st wave of the
YouGov survey and the actual vote", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 15, 16, 17, 3, 4, 5, 6, 7, 8, 9, 10, 18, 19, 11, 12, 13, 20, 14, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
| (1) | (2) | (3) | ||||
|---|---|---|---|---|---|---|
| Predictors | Estimates | std. Error | Estimates | std. Error | Estimates | std. Error |
| Exposure - Independent | -0.057 * | 0.027 | -0.057 * | 0.027 | -0.044 | 0.028 |
| Exposure - Lean | 0.050 | 0.030 | 0.049 | 0.030 | 0.048 | 0.030 |
| Exposure - Not Strong | 0.058 * | 0.030 | 0.057 | 0.030 | 0.060 * | 0.029 |
| Exposure - Strong | 0.065 * | 0.028 | 0.065 * | 0.028 | 0.064 * | 0.028 |
| Political Views - Lean | -0.086 | 0.093 | -0.086 | 0.093 | -0.084 | 0.093 |
| Political Views - Not Strong | -0.157 | 0.088 | -0.157 | 0.088 | -0.163 | 0.088 |
| Political Views - Strong | -0.130 | 0.083 | -0.132 | 0.083 | -0.130 | 0.083 |
| Age | -0.001 | 0.001 | -0.001 | 0.001 | -0.001 | 0.001 |
| Woman | 0.089 ** | 0.029 | 0.088 ** | 0.029 | 0.092 ** | 0.029 |
| College-educated | 0.046 | 0.029 | 0.046 | 0.029 | 0.044 | 0.028 |
| Income | -0.034 * | 0.015 | -0.034 * | 0.015 | -0.034 * | 0.015 |
| Person of Color | 0.076 * | 0.035 | ||||
| Other/Hispanic | 0.057 | 0.052 | 0.058 | 0.052 | ||
| Black | 0.096 * | 0.041 | 0.093 * | 0.040 | ||
| Region: Northeast | -0.013 | 0.041 | -0.013 | 0.041 | -0.011 | 0.041 |
| Region: Midwest | 0.026 | 0.036 | 0.026 | 0.036 | 0.030 | 0.036 |
| Region: West | -0.004 | 0.040 | -0.001 | 0.040 | 0.001 | 0.040 |
| log(Total Tweets) | -0.021 * | 0.010 | ||||
| Freq. of social media use | 0.009 | 0.014 | 0.009 | 0.014 | 0.011 | 0.014 |
| Constant | 0.132 | 0.144 | 0.135 | 0.144 | 0.321 * | 0.159 |
| Observations | 1146 | 1146 | 1146 | |||
| R2 / R2 adjusted | 0.032 / 0.019 | 0.033 / 0.018 | 0.037 / 0.022 | |||
|
||||||
In table 6 we find the strongest results. Higher exposure reduces the likelihood of changing voting preferences for independents, while it increases the probability for all other groups, with the effects being somewhat larger for strong groups. That this case represents actual voting patterns, it provides the strongest evidence that some groups are significantly affected by exposure to Russian tweets.
The results provide some partial support for the view that exposure to Russian tweets does have non-linear effects. The evidence suggests that higher exposure to Russian tweets is more likely to encourage voters with strong political preferences to switch their voting intentions towards Trump, but to lower the probability of voters with more independent political views to switch towards Trump. This is the opposite of the hypothesis tested, which was that more independent voters would be more likely to be influenced by exposure to Russian tweets (Fujiwara et al, 2023). These results are found to be robust to two alternative approaches to accounting for non-linearities, as well as to alternative definitions of the dependent variable and to the inclusion of different explanatory variables.
The explanation for such results is not so clear but may partly reflect that independents are less likely to be swayed by outside noise in their vote choice, potentially because they access a wide range of knowledge in reaching their voting choice. Conversely, those with stronger political views are perhaps less likely to receive signals contrary to their political opinions, such that when they do it has a greater impact on their voting patterns. If such results are found to hold in other studies, they suggest that those wanting to influence outcomes of elections are likely to be more effective if they focus on changing the opinions of those with stronger views.
Eady, G., Paskhalis, T., Zilinsky, J., Bonneau, R., Nagler, J., & Tucker, J. A. (2023). Exposure to the Russian Internet Research Agency foreign influence campaign on Twitter in the 2016 US election and its relationship to attitudes and voting behavior. Nature Communications, 14(1), 62. doi: https://doi.org/10.1038/s41467-022-35576-9
Freese, J., & Peterson, D. (2017). Replication in social science. Annual Review of Sociology, 43, 147-165, doi: 10.1146.
Fujiwara, T., Müller, K. and Schwarz, C. (2022). The Effect of Social Media on Elections: Evidence from the United States. SSRN Electronic Journal. [online] doi:https://doi.org/10.2139/ssrn.3719998.
Garcia, D. (2023). Influence of Facebook algorithms on political polarization tested. Nature. [online] doi:https://doi.org/10.1038/d41586-023-02325-x.
Nadeem, R. (2023). Voting patterns in the 2022 elections. [online] Pew Research Center - U.S. Politics & Policy. Available at: https://www.pewresearch.org/politics/2023/07/12/voting-patterns-in-the-2022-elections/ [Accessed 14 May 2024].
Pew Research Center (2020). Voters Rarely Switch Parties, but Recent Shifts Further Educational, Racial Divergence. [online]
Pew Research Center (2023). U.S. Politics & Policy. Available at: https://www.pewresearch.org/politics/2020/08/04/voters-rarely-switch-parties-but-recent-shifts-further-educational-racial-divergence/ [Accessed 14 May 2024].
Tpaskhalis (2023) Tpaskhalis/NCOMMS_RUSSIA_US_2016: Replication materials for ‘exposure to the Russian Internet Research Agency Foreign Influence Campaign on Twitter in the 2016 US election and its relationship to attitudes and voting behavior’, GitHub. Available at: https://github.com/tpaskhalis/ncomms_russia_us_2016 (Accessed: 8 May 2024).
Weeks, B.E., Lane, D.S., Kim, D.H., Lee, S.S. and Kwak, N. (2017). Incidental Exposure, Selective Exposure, and Political Information Sharing: Integrating Online Exposure Patterns and Expression on Social Media. Journal of Computer-Mediated Communication, 22(6), pp.363–379. doi:https://doi.org/10.1111/jcc4.12199.
# Detailed information about my environment
sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.3.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: Europe/Amsterdam
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] reshape2_1.4.4 sjPlot_2.8.15 ggplot2_3.4.4 openxlsx_4.2.5.2
[5] lubridate_1.9.2 cowplot_1.1.3 tidyr_1.3.0 sandwich_3.1-0
[9] nnet_7.3-19 mvtnorm_1.2-3 MASS_7.3-60 lmtest_0.9-40
[13] zoo_1.8-12 lfe_3.0-0 Matrix_1.6-5 estimatr_1.0.2
[17] dplyr_1.1.2 knitr_1.43 rmarkdown_2.23
loaded via a namespace (and not attached):
[1] sjlabelled_1.2.0 tidyselect_1.2.0 farver_2.1.1 fastmap_1.1.1
[5] bayestestR_0.13.2 sjstats_0.18.2 digest_0.6.33 timechange_0.2.0
[9] estimability_1.4.1 lifecycle_1.0.3 magrittr_2.0.3 compiler_4.3.2
[13] rlang_1.1.1 sass_0.4.7 tools_4.3.2 utf8_1.2.3
[17] yaml_2.3.7 labeling_0.4.2 RColorBrewer_1.1-3 plyr_1.8.9
[21] withr_2.5.0 purrr_1.0.2 grid_4.3.2 datawizard_0.9.1
[25] fansi_1.0.4 xtable_1.8-4 colorspace_2.1-0 emmeans_1.8.8
[29] scales_1.2.1 insight_0.19.10 cli_3.6.1 generics_0.1.3
[33] rstudioapi_0.15.0 performance_0.10.9 modelr_0.1.11 parameters_0.21.2
[37] minqa_1.2.6 cachem_1.0.8 stringr_1.5.0 splines_4.3.2
[41] parallel_4.3.2 effectsize_0.8.6 vctrs_0.6.3 boot_1.3-28.1
[45] jsonlite_1.8.7 hms_1.1.3 Formula_1.2-5 jquerylib_0.1.4
[49] glue_1.6.2 nloptr_2.0.3 codetools_0.2-19 stringi_1.7.12
[53] gtable_0.3.3 ggeffects_1.3.1 lme4_1.1-35.1 munsell_0.5.0
[57] tibble_3.2.1 pillar_1.9.0 htmltools_0.5.5 R6_2.5.1
[61] evaluate_0.21 lattice_0.21-9 haven_2.5.3 highr_0.10
[65] backports_1.4.1 snakecase_0.11.1 broom_1.0.5 bslib_0.5.0
[69] Rcpp_1.0.11 zip_2.3.1 coda_0.19-4 nlme_3.1-163
[73] xfun_0.40 forcats_1.0.0 sjmisc_2.8.9 pkgconfig_2.0.3
# Opening key libraries first
library(rmarkdown)
library(knitr)
# Global options
opts_chunk$set(echo=TRUE,
cache=TRUE,
comment=NA,
message=FALSE,
warning=FALSE)
# All used libraries
library(rmarkdown)
library(knitr)
library(dplyr)
library(estimatr)
library(lfe)
library(lmtest)
library(MASS)
library(mvtnorm)
library(nnet)
library(sandwich)
library(tidyr)
library(cowplot)
library(lubridate)
library(openxlsx)
library(ggplot2)
library(sjPlot)
library(reshape2)
# Versions of used packages
packages <- c("rmarkdown", "knitr", "dplyr", "estimatr", "lfe", "lmtest", "MASS", "mvtnorm", "nnet", "sandwich", "tidyr", "cowplot", "lubridate", "openxlsx", "ggplot2", "sjPlot", "reshape2")
names(packages) <- packages
lapply(packages, packageVersion)
# What is my R version?
version[['version.string']]
#load in the data
us2016_twitter <- readRDS("Survey_Data.rds")
#re-code the data so that education is now split between 'High school or below' and 'College', the race variable is now 'White' or 'Non-White', regions are also divided into 'South', 'Northeast', 'Midwest' and 'West'
us2016_recoded <- us2016_twitter %>%
filter(have_twitter_data == 1) %>%
mutate(
income = as.numeric(income),
education = factor(case_when(
education == "High school or below" ~ "High school or below",
education %in% c("College degree", "Post-graduate degree") ~ "College+"
), levels = c("High school or below", "College+")),
race = factor(case_when(
race == "White" ~ "White",
race %in% c("Black", "Hispanic", "Other") ~ "Non-White"
), levels = c("White", "Non-White")),
region = factor(region, levels = c("South", "Northeast", "Midwest", "West"))
)
#Recode variables into 4 categories "Strong", "Lean", "Not Strong" and "Independent"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Strong Democrat"] <- "Strong"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Strong Republican"] <- "Strong"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Lean Democrat"] <- "Lean"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Lean Republican"] <- "Lean"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Not very strong Democrat"] <- "Not Strong"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Not very strong Republican"] <- "Not Strong"
us2016_recoded$pol_strength[us2016_recoded$pid7_factor == "Independent"] <- "Independent"
#Recode variables
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Strong Democrat"] <- 0
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Strong Republican"] <- 0
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Lean Democrat"] <- .25
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Lean Republican"] <- .25
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Not very strong Democrat"] <- .5
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Not very strong Republican"] <- .5
us2016_recoded$pol_strength_num[us2016_recoded$pid7_factor == "Independent"] <- 0.75
# Average value of the newly created political strength variable
mean(us2016_recoded$pol_strength_num, na.rm = TRUE)
# Plot of distribution of newly created political strength variable
desc_plot <- ggplot((data = us2016_recoded), aes(x = pol_strength, na.rm = TRUE)) + labs(x = "Political Strength", y = "Count", title = "Figure 1: Distribution of Political Views") +
geom_bar()
desc_plot
# Descriptive two-way tables on numbers switching vote by political leaning
desc_table_1 <- table(us2016_recoded$pol_strength_num, us2016_recoded$change_rank_trump_over_clinton_w1w3)
colnames(desc_table_1) = c("Away from Trump", "No Change", "Towards Trump")
rownames(desc_table_1) = c("Strong", "Not Strong", "Lean", "Independent")
desc_table_1
desc_table_2 <- table(us2016_recoded$pol_strength_num, us2016_recoded$voted_trump_versus_clinton)
colnames(desc_table_2) = c("Away from Trump", "No Change", "Towards Trump")
rownames(desc_table_2) = c("Strong", "Not Strong", "Lean", "Independent")
desc_table_2
desc_table_3 <- table(us2016_recoded$pol_strength_num, us2016_recoded$voted_trump_versus_clinton_benefit)
colnames(desc_table_3) = c("Away from Trump", "No Change", "Towards Trump")
rownames(desc_table_3) = c("Strong", "Not Strong", "Lean", "Independent")
desc_table_3
#===============================================================================
# Introduce the Interactions between Exposure and Strength of Political Views
#Create a new Table E6 with Interaction term
vote_rank_total_russia_count_lm_controls <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls)
confint(vote_rank_total_russia_count_lm_controls)
vote_rank_total_russia_count_lm_controls_black <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black)
confint(vote_rank_total_russia_count_lm_controls_black)
vote_rank_total_russia_count_lm_controls_total_tweets <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log + pol_strength_num, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets)
confint(vote_rank_total_russia_count_lm_controls_total_tweets)
#Create a tab model combining the above regressions
tab_model (vote_rank_total_russia_count_lm_controls, vote_rank_total_russia_count_lm_controls_black, vote_rank_total_russia_count_lm_controls_total_tweets, pred.labels = c ("Constant", "Exposure", "Political Views", "Age", " Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure * Political Views", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 1: Non-linear effects of exposure to Russian tweets on the likelihood of shifting voter preference between survey waves", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 3, 13, 4, 5, 6, 7, 14, 15, 8, 9, 10, 11, 16, 12, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
plot_model(vote_rank_total_russia_count_lm_controls, type = "pred", terms = c("total_exposure_russia_log", "pol_strength_num")) + labs(title = "Figure 2: Nonlinear effect of exposure to Russian tweets on change
in voting preferences towards Trump between survey
Wave 1 and 2", x = " Total Exposure (log +1)", y = "Change in voting preference
towards Trump between Wave 1 and Wave 2", color = "Strength of Political Views")
# New Table E7 with Interaction
vote_rank_total_russia_count_lm_controls <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls)
confint(vote_rank_total_russia_count_lm_controls)
vote_rank_total_russia_count_lm_controls_black <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black)
confint(vote_rank_total_russia_count_lm_controls_black)
vote_rank_total_russia_count_lm_controls_total_tweets <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log + pol_strength_num, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets)
confint(vote_rank_total_russia_count_lm_controls_total_tweets)
#Create a tab model combining the above regressions
tab_model (vote_rank_total_russia_count_lm_controls, vote_rank_total_russia_count_lm_controls_black, vote_rank_total_russia_count_lm_controls_total_tweets, pred.labels = c ("Constant", "Exposure", "Political Views", "Age", " Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure * Political Views", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 2: Non-linear effects of exposure to Russian tweets on the likelihood of shifting voter preference towards Trump, a no vote, or a 3rd candidate", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 3, 13, 4, 5, 6, 7, 14, 15, 8, 9, 10, 11, 16, 12, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
plot_model(vote_rank_total_russia_count_lm_controls, type = "pred", terms = c("total_exposure_russia_log", "pol_strength_num")) + labs(title = "Figure 3: Nonlinear effect of exposure to Russian tweets
on changes in voter preference towards Trump, third party
candidates or no vote", x = " Total Exposure (log +1)",
y = "Change in voting preference towards Trump,
third party candidates and no vote" , color = "Strength of Political Views")
# New Table E8 with Interaction
vote_rank_total_russia_count_lm_controls <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls)
confint(vote_rank_total_russia_count_lm_controls)
vote_rank_total_russia_count_lm_controls_black <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black)
confint(vote_rank_total_russia_count_lm_controls_black )
vote_rank_total_russia_count_lm_controls_total_tweets <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength_num + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log + pol_strength_num, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets)
confint(vote_rank_total_russia_count_lm_controls_total_tweets)
#Create a tab model combining the above regressions
tab_model(vote_rank_total_russia_count_lm_controls, vote_rank_total_russia_count_lm_controls_black, vote_rank_total_russia_count_lm_controls_total_tweets, pred.labels = c ("Constant", "Exposure", "Political Views", "Age", " Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure * Political Views", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 3: Non-linear effects of exposure to Russian tweets on changes in voting preferences between the 1st wave of the YouGov survey and the actual vote", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 3, 13, 4, 5, 6, 7, 14, 15, 8, 9, 10, 11, 16, 12, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
plot_model(vote_rank_total_russia_count_lm_controls, type = "pred", terms = c("total_exposure_russia_log", "pol_strength_num")) +
labs(title = "Figure 4: Nonlinear effect of exposure to Russian tweets on
changes in voting preferences between the 1st wave of the
YouGov survey and the actual vote. ", x = "Total Exposure (log +1)",
y = "Change in voting preference between the 1st
wave of the survey and the actual vote", color = "Strength of Political Views")
# Introduce the Interactions between Exposure and Strength of Political Views
# New Table E6 with Interaction (This is an alternative where we estimate a separate coefficient on exposure for each type of political strength)
vote_rank_total_russia_count_lm_controls_new1 <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_new1)
confint(vote_rank_total_russia_count_lm_controls_new1)
vote_rank_total_russia_count_lm_controls_black_new1 <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black_new1)
confint(vote_rank_total_russia_count_lm_controls_black_new1)
vote_rank_total_russia_count_lm_controls_total_tweets_new1 <- lm(change_rank_trump_over_clinton_w1w3 ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets_new1)
confint(vote_rank_total_russia_count_lm_controls_total_tweets_new1)
tab_model (vote_rank_total_russia_count_lm_controls_new1, vote_rank_total_russia_count_lm_controls_black_new1, vote_rank_total_russia_count_lm_controls_total_tweets_new1, pred.labels = c ("Constant", "Exposure - Independent", "Political Views - Lean", "Political Views - Not Strong", "Political Views - Strong", "Age", "Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure - Lean", "Exposure - Not Strong", "Exposure - Strong", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 4: Non-linear effects of exposure to Russian tweets on the likelihood of shifting voter preference between waves of the survey ", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 15, 16, 17, 3, 4, 5, 6, 7, 8, 9, 10, 18, 19, 11, 12, 13, 20, 14, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
# New Table E7 with Interaction (This is an alternative where we estimate a separate coefficient on exposure for each type of political strength)
vote_rank_total_russia_count_lm_controls_new <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_new)
confint(vote_rank_total_russia_count_lm_controls_new)
vote_rank_total_russia_count_lm_controls_black_new <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black_new)
confint(vote_rank_total_russia_count_lm_controls_black_new)
vote_rank_total_russia_count_lm_controls_total_tweets_new <- lm(voted_trump_versus_clinton ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets_new)
confint(vote_rank_total_russia_count_lm_controls_total_tweets_new)
tab_model (vote_rank_total_russia_count_lm_controls_new, vote_rank_total_russia_count_lm_controls_black_new, vote_rank_total_russia_count_lm_controls_total_tweets_new, pred.labels = c ("Constant", "Exposure - Independent", "Political Views - Lean", "Political Views - Not Strong", "Political Views - Strong", "Age", "Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure - Lean", "Exposure - Not Strong", "Exposure - Strong", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 5: Non-linear effects of exposure to Russian tweets on the likelihood of shifting voter preference towards Trump, a no vote, or a 3rd candidate", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 15, 16, 17, 3, 4, 5, 6, 7, 8, 9, 10, 18, 19, 11, 12, 13, 20, 14, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
# New Table E8 with Interaction (This is an alternative where we estimate a separate coefficient on exposure for each type of political strength)
vote_rank_total_russia_count_lm_controls_new3 <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_new3)
confint(vote_rank_total_russia_count_lm_controls_new3)
vote_rank_total_russia_count_lm_controls_black_new3 <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_black_new3)
confint(vote_rank_total_russia_count_lm_controls_black_new3)
vote_rank_total_russia_count_lm_controls_total_tweets_new3 <- lm(voted_trump_versus_clinton_benefit ~ total_exposure_russia_log * pol_strength + age + gender + education + income + race_other_hispanic + race_black + region + internet_social_media_w1 + total_tweets_log, data = us2016_recoded)
summary(vote_rank_total_russia_count_lm_controls_total_tweets_new3)
confint(vote_rank_total_russia_count_lm_controls_total_tweets_new3)
tab_model (vote_rank_total_russia_count_lm_controls_new3, vote_rank_total_russia_count_lm_controls_black_new3, vote_rank_total_russia_count_lm_controls_total_tweets_new3, pred.labels = c ("Constant", "Exposure - Independent", "Political Views - Lean", "Political Views - Not Strong", "Political Views - Strong", "Age", "Woman", "College-educated", "Income", "Person of Color", "Region: Northeast", "Region: Midwest", "Region: West", "Freq. of social media use", "Exposure - Lean", "Exposure - Not Strong", "Exposure - Strong", "Other/Hispanic", "Black", "log(Total Tweets)"), title = "Table 6: Nonlinear effect of exposure to Russian tweets on
changes in voting preferences between the 1st wave of the
YouGov survey and the actual vote", digits = 3,
dv.labels = c("(1)", "(2)", "(3)"),
order.terms = c(2, 15, 16, 17, 3, 4, 5, 6, 7, 8, 9, 10, 18, 19, 11, 12, 13, 20, 14, 1),
p.style = "stars", show.ci = FALSE, vcov.fun = "HC0", show.se = TRUE)
# Detailed information about my environment
sessionInfo()