-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPSMatch.R
14 lines (14 loc) · 1.79 KB
/
PSMatch.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
library("MatchIt")
library(readr)
psmatch_all <- read_csv("./data/psmatch_final_updated_everything_liwc.csv")
View(psmatch_all)
m.out0 <- matchit(treated ~ is_mod + pre_avg_sent_anger_hist + pre_avg_sent_i_hist + pre_avg_sent_negate_hist + pre_avg_sent_negemo_hist + pre_avg_sent_posemo_hist + pre_avg_sent_sad_hist + pre_avg_sent_social_hist + pre_avg_sent_swear_hist + pre_avg_sent_we_hist + pre_avg_sent_you_hist + pre_avg_sent_score_hist + pre_avg_sent_incivility_hist + pre_avg_sent_stereotype_hist + pre_avg_sent_personal_attacks_hist + pre_avg_sent_third_party_attacks_hist + pre_avg_sent_vulgarity_hist + pre_avg_sent_aspersion_hist + pre_avg_sent_comment_len_hist + pre_avg_sent_is_left_hist + pre_avg_sent_is_right_hist , data = psmatch_all, method = NULL, distance = "glm")
summary(m.out0)
m.out1 <- matchit(treated ~ is_mod + pre_avg_sent_anger_hist + pre_avg_sent_i_hist + pre_avg_sent_negate_hist + pre_avg_sent_negemo_hist + pre_avg_sent_posemo_hist + pre_avg_sent_sad_hist + pre_avg_sent_social_hist + pre_avg_sent_swear_hist + pre_avg_sent_we_hist + pre_avg_sent_you_hist + pre_avg_sent_score_hist + pre_avg_sent_incivility_hist + pre_avg_sent_stereotype_hist + pre_avg_sent_personal_attacks_hist + pre_avg_sent_third_party_attacks_hist + pre_avg_sent_vulgarity_hist + pre_avg_sent_aspersion_hist + pre_avg_sent_comment_len_hist + pre_avg_sent_is_left_hist + pre_avg_sent_is_right_hist , data = psmatch_all, method = "nearest", ratio=2, distance = "glm")
summary(m.out1, un = FALSE)
dta_m <- match.data(m.out1)
with(dta_m, t.test(post_avg_comment_week_hist ~ treated))
with(dta_m, t.test(post_avg_post_week_hist ~ treated))
with(dta_m, t.test(post_avg_comment_stereotype_hist ~ treated))
with(dta_m, t.test(post_avg_sent_civility_hist_aggregate ~ treated))
with(dta_m, t.test(post_avg_sent_you_hist ~ treated))