Exercise
- Above we estimated the effects of
d_treatment_source
on the outcomes y_share_report_email_num
and y_share_report_fb_num
. Do the same for the outcomes y_share_report_twitter_num
and y_share_report_whatsapp_num
.
- Start by conducting two t-test for both outcomes. What do they indicate for sharing on Twitter and Whatsapp?
- Use the code below and adapt it (step by step) to directly produce a table that includes the t-test results for the two outcomes.
ttest_results <-
data %>%
dplyr::select(d_treatment_source,
y_belief_report_num,
y_share_report_email_num,
y_share_report_fb_num) %>%
gather(variable,
value,
y_belief_report_num:y_share_report_fb_num) %>%
group_by(variable) %>% # group by outcome
do(broom::tidy(t.test(value ~ d_treatment_source,
data = .,
na.action = "na.omit",
var.equal = TRUE))) %>%
ungroup() %>% # ungroup data
mutate(estimate = estimate2 - estimate1) %>%
mutate(estimate = round(estimate, 2)) %>%
mutate(p.value = format(round(p.value, 2), nsmall = 2)) %>%
mutate(variable = case_when(variable == "y_belief_report_num" ~ "Belief",
variable == "y_share_report_email_num" ~ "Email",
variable == "y_share_report_fb_num" ~ "Facebook")) %>%
mutate(N = parameter + 2) %>%
mutate_if(is.numeric, ~round(., 2))
# Rmarkdown output
kable(ttest_results,
caption = "Results for t-tests") %>%
kable_styling(font_size = 12)
- Also estimate the treatment effects using a linear model and again produce a table with the output (below some code). We’ll need
lm()
to estimate the models and stargazer()
to produce a nice tables (see example above).
- Above we provided balance statistics for two covariates. There are two more covariates
x_income_*
and x_education_*
. How would you proceed if you want to explore and show that treatment and control groups are balanced on them as well? (Tip: table()
)
- What is your conclusion? Is there also a source effect for sharing per Twitter and Whatsapp analogue to sharing on Facebook (cf. Table 5.4)?