17 summary(toxicity_calibrated)
 
  18 qplot(labelr$toxic,type='hist')
 
  26 hist(log(fbyg$weight))
 
  29 fbyg$weight[fbyg$weight != 1]
 
  30 fbyg[fbyg$weight != 1]
 
  31 fbyg[,fbyg$weight != 1]
 
  32 fbyg[[fbyg$weight != 1]]
 
  33 fbyg[fbyg$weight != 1,]
 
  35 summary(toxicity_calibrated)
 
  45 labelr[labelr$data=='yg']
 
  46 labelr[,labelr$data=='yg']
 
  47 labelr[labelr$data=='yg',]
 
  49 summary(toxicity_calibrated)
 
  51 yg3[,['toxic','toxic_pred']]
 
  52 yg3 %>% select('toxic','toxic_pred')
 
  53 yg3 |> select('toxic','toxic_pred')
 
  55 yg3[,c('toxic_pred','toxic')]
 
  56 corr(yg3[,c('toxic_pred','toxic')])
 
  57 cor(yg3[,c('toxic_pred','toxic')])
 
  58 cor(yg3[,c('toxic_pred','toxic')],na.rm=T)
 
  59 cor(yg3[,c('toxic_pred','toxic')],rm.na=T)
 
  60 ?cor(yg3[,c('toxic_pred','toxic')],use=
 
  62 cor(yg3[,c('toxic_pred','toxic')],use='all.obs')
 
  64 cor(yg3[,c('toxic_pred','toxic')],use='complete.obs')
 
  65 cor(yg3[,c('toxic_pred','toxic')],use='complete.obs',method='spearman')
 
  94 preds1$diff - preds$diff
 
  96 preds1$diff - preds1$diff
 
  97 preds1$diff - preds$diff
 
  98 preds1$diff - preds$diff
 
  99 preds1$diff - preds$diff
 
 100 preds1$diff - preds$diff
 
 119 yg3[,.(toxic_pred,toxic_var)]
 
 120 yg3[,.(toxic_pred,toxicity_2_pred_sigma,toxicity_1_pred_sigma)]
 
 121 yg3[,.(toxic_pred,toxicity_2_pred_sigma,toxicity_1_pred_sigma,cov(toxicity_2_pred,toxicity_1_pred))]
 
 132 yg3[,.(toxic_pred,toxicity_2_pred_sigma,toxicity_1_pred_sigma,cov(toxicity_2_pred,toxicity_1_pred))]
 
 133 yg3[,.(toxic_pred,toxicity_2_pred_sigma,toxicity_1_pred_sigma,toxic_var)]
 
 134 yg3[,.(toxic_pred,toxicity_2_pred_sigma,toxicity_1_pred_sigma,toxic_var,toxic_sd)]
 
 142 stargazer(w1,w2,w3,w4,w5,t1,t2,t3,t4,t5, type="text",
 
 143           keep = c("cond1","meantox","cond1:meantox","Constant"),
 
 144           keep.stat=c("n","adj.rsq"),
 
 146           dep.var.labels = c("DV = Willingness to comment","DV = Toxicity of YG respondent comments"),
 
 147           covariate.labels = c("Treatment (top comments shown)",
 
 148                                "Average toxicity of top comments",
 
 149                                "Treatment $\times$ top comments toxicity",
 
 151           add.lines = list(c("Article fixed effects","No","No","No","Yes","Yes","No","No","No","Yes","Yes")),
 
 152           star.cutoffs = c(0.05,0.01,0.005),
 
 153           notes = "Standard errors are clustered at the respondent level.",
 
 154           column.labels = c("(1)","(2)","(3)","(4)","(5)","(6)","(7)","(8)","(9)","(10)"),
 
 168 labelr[,'comment_id']
 
 180 yg3[,.(.N),by=.(toxic,fb)]
 
 190 is.data.table(labelr)
 
 197 setwd("presentations/ica_hackathon_2022/")
 
 202 example_2_B.plot.df[(variable=='x') && (m < 1000)]
 
 203 example_2_B.plot.df[(variable=='x') && (m < 1000)]
 
 204 theme_set(theme_default())
 
 205 theme_set(theme_minimal())
 
 206 theme_set(theme_classic())
 
 207 example_2_B.plot.df[(variable=='x') && (m < 1000)]
 
 208 example_2_B.plot.df[(variable=='x') && (m < 1000),unique(method)]
 
 218 example_2_B.plot.df$method %>% unique
 
 219 example_2_B.plot.df$method |> unique
 
 220 example_2_B.plot.df$method  |> uniq
 
 221 unique(example_2_B.plot.df$method)
 
 222 example_2_B.plot.df$method
 
 223 example_2_B.plot.df$method
 
 224 example_2_B.plot.df$method
 
 225 example_2_B.plot.df$method
 
 226 example_2_B.plot.df <- r$example_2_B.plot.df
 
 229 setwd("presentations/ica_hackathon_2022/')
 
 230 setwd("presentations/ica_hackathon_2022/")
 
 231 example_2_B.plot.df$method
 
 232 example_2_B.plot.df$method
 
 235 example_2_B.plot.df$method
 
 236 example_2_B.plot.df$method
 
 239 example_2_B.plot.df$method
 
 240 example_2_B.plot.df$method
 
 247 plot.df[,.N,by=.(N,m)]
 
 248 plot.df[,.N,by=.(N,m,method)]
 
 249 plot.df[variable=='x',.N,by=.(N,m,method)]
 
 251 plot.df[(variable=='x') & (m < 1000) & (!is.na(p.true.in.ci))]
 
 252 plot.df[(variable=='x') & (m != 1000) & (!is.na(p.true.in.ci))]
 
 255 install.packages("ggplot2")
 
 256 devtools::install_github("tidyverse/ggplot2")
 
 269 plot.df[method="2SLS+gmm"]
 
 270 plot.df[method=="2SLS+gmm"]
 
 271 df <- example_2_B.plot.df
 
 278 plot.df.example.2[m==50][method=2SLS+gmm]
 
 279 plot.df.example.2[m==50][method==2SLS+gmm]
 
 280 plot.df.example.2[(m==50) & (method==2SLS+gmm)]
 
 281 plot.df.example.2[(m==50) & (method=="2SLS+gmm")]
 
 285 plot.df.example.3[N=25000]
 
 286 plot.df.example.3[N==25000]