]> code.communitydata.science - ml_measurement_error_public.git/commitdiff
real-data example on raw perspective scores
authorNathan TeBlunthuis <nathante@uw.edu>
Sat, 12 Aug 2023 20:09:31 +0000 (13:09 -0700)
committerNathan TeBlunthuis <nathante@uw.edu>
Sat, 12 Aug 2023 20:09:31 +0000 (13:09 -0700)
civil_comments/03_prob_not_pred.R [new file with mode: 0644]

diff --git a/civil_comments/03_prob_not_pred.R b/civil_comments/03_prob_not_pred.R
new file mode 100644 (file)
index 0000000..8f4a9ab
--- /dev/null
@@ -0,0 +1,21 @@
+source('load_perspective_data.R')
+source("../simulations/RemembR/R/RemembeR.R")
+library(xtable)
+change.remember.file("prob_not_pred.RDS")
+### to respond to the reviewer show what happens if we don't recode the predictions.
+
+non_recoded_dv <- lm(toxicity_prob ~ likes * race_disclosed, data=df)
+remember(coef(non_recoded_dv), "coef_dv")
+remember(diag(vcov(non_recoded_dv)), "se_dv")
+remember(xtable(non_recoded_dv),'dv_xtable')
+
+non_recoded_iv <- glm(race_disclosed ~ likes * toxicity_prob, data=df, family='binomial')
+remember(coef(non_recoded_iv), "coef_iv")
+remember(diag(vcov(non_recoded_iv)), "se_iv")
+remember(xtable(non_recoded_iv),'iv_xtable')
+
+remember(extract(non_recoded_iv,include.aic=F,include.bic=F,include.nobs=F,include.deviance=F,include.loglik=F),'non_recoded_iv')
+remember(extract(non_recoded_dv,include.rsquared=F,include.adjrs=F,include.nobs=F),'non_recoded_dv')
+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)
+print(tr)
+remember(tr, 'texregobj')

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