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')
