]> code.communitydata.science - ml_measurement_error_public.git/blob - civil_comments/03_prob_not_pred.R
Merge branch 'master' of code:ml_measurement_error_public
[ml_measurement_error_public.git] / civil_comments / 03_prob_not_pred.R
1 source('load_perspective_data.R')
2 source("../simulations/RemembR/R/RemembeR.R")
3 library(xtable)
4 change.remember.file("prob_not_pred.RDS")
5 ### to respond to the reviewer show what happens if we don't recode the predictions.
6
7 non_recoded_dv <- lm(toxicity_prob ~ likes * race_disclosed, data=df)
8 remember(coef(non_recoded_dv), "coef_dv")
9 remember(diag(vcov(non_recoded_dv)), "se_dv")
10 remember(xtable(non_recoded_dv),'dv_xtable')
11
12 non_recoded_iv <- glm(race_disclosed ~ likes * toxicity_prob, data=df, family='binomial')
13 remember(coef(non_recoded_iv), "coef_iv")
14 remember(diag(vcov(non_recoded_iv)), "se_iv")
15 remember(xtable(non_recoded_iv),'iv_xtable')
16
17 remember(extract(non_recoded_iv,include.aic=F,include.bic=F,include.nobs=F,include.deviance=F,include.loglik=F),'non_recoded_iv')
18 remember(extract(non_recoded_dv,include.rsquared=F,include.adjrs=F,include.nobs=F),'non_recoded_dv')
19 tr <- texreg(list(r$non_recoded_iv, r$non_recoded_dv),custom.model.names=c("Example 1","Example 2"),custom.coef.map=list("(Intercept)"="Intercept","race_disclosedTRUE"="Identity Disclosure","toxicity_prob"="Toxicity Score","likes"="Likes","likes:race_disclosedTRUE"="Likes:Identity Disclosure","likes:toxicity_prob"="Likes:Toxicity Score"),single.row=T,dcolumn=T)
20 print(tr)
21 remember(tr, 'texregobj')

Community Data Science Collective || Want to submit a patch?