]> code.communitydata.science - ml_measurement_error_public.git/blob - presentations/ica_hackathon_2022/.Rhistory
add mle methods from carroll
[ml_measurement_error_public.git] / presentations / ica_hackathon_2022 / .Rhistory
1 ls()
2 weight
3 weight
4 lablr
5 labelr
6 nrow(labelr)
7 names(labelr)
8 names(labelr$data)
9 labelr$data
10 labelr
11 names(labelr)
12 labelr$labelr
13 labelr$toxic
14 setwd("..")
15 q()
16 n
17 summary(toxicity_calibrated)
18 qplot(labelr$toxic,type='hist')
19 names(labelr)
20 labelr$n
21 labelr
22 names(labelr)
23 fbyg
24 gghist(fbyg$weight)
25 hist(fbyg$weight)
26 hist(log(fbyg$weight))
27 fbyg$weight==1
28 all(fbyg$weight==1)
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,]
34 names(labelr)
35 summary(toxicity_calibrated)
36 toxicity_calibrated
37 val.data
38 names(labelr)
39 labelr$data
40 labelr
41 labelr[data]
42 labelr[data=='yg']
43 labelr[,data=='yg']
44 labelr[data=='yg',]
45 labelr[labelr$data=='yg']
46 labelr[,labelr$data=='yg']
47 labelr[labelr$data=='yg',]
48 toxicity_calibrated
49 summary(toxicity_calibrated)
50 yg3
51 yg3[,['toxic','toxic_pred']]
52 yg3 %>% select('toxic','toxic_pred')
53 yg3 |> select('toxic','toxic_pred')
54 names(yg3)
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=
61 ?cor
62 cor(yg3[,c('toxic_pred','toxic')],use='all.obs')
63 ?cor
64 cor(yg3[,c('toxic_pred','toxic')],use='complete.obs')
65 cor(yg3[,c('toxic_pred','toxic')],use='complete.obs',method='spearman')
66 ?predict
67 yg3$toxic_pred
68 names(preds)
69 preds
70 preds
71 preds$error
72 preds
73 preds
74 summary(errormod)
75 summary(errormod)
76 summary(preds)
77 names(preds)
78 preds
79 resids
80 qplot(resids)
81 resids
82 ?predict.lm
83 dnorm(1)
84 dnorm(2)
85 dnorm(1)
86 pnorm(1)
87 preds
88 p1 + p2
89 p1 + p2
90 p1
91 p2
92 preds
93 preds1 <- preds
94 preds1$diff - preds$diff
95 preds1$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
101 preds1
102 preds
103 dnorm(-1)
104 dnorm(1)
105 pnorm(1)
106 pnorm(-1)
107 pnorm(2)
108 pnorm(9)
109 pnorm(6)
110 pnorm(2)
111 dnorm(0.95)
112 qnorm(0.95)
113 qnorm(0.841)
114 fulldata_preds
115 names(yg3)
116 yg3$toxic_feature_1
117 yg3$toxic_feature_2
118 yg3
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))]
122 cov(1,2)
123 cov(c(1),c(3))
124 cov(c(1),c(3,2))
125 cov(c(1,1),c(3,2))
126 cov(c(1,2),c(3,2))
127 covterm
128 covterm
129 ?cov
130 covterm
131 yg3
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)]
135 yg3
136 names(yg3)
137 print(sg)
138 print(sg)
139 1+1
140 library(stargazer)
141
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"),
145           model.numbers = F,
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",
150                                "Constant"),
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)"),
155           style = "apsr")
156
157 q()
158 n
159 yglabels
160 labelr
161 names(labelr)
162 fb
163 names(fb
164 )
165 fb.comment_id
166 fb['comment_id']
167 fb[,'comment_id']
168 labelr[,'comment_id']
169 names(fb)
170 fb.labeled
171 names(fb.labeled)
172 names(yg)
173 ?amelia
174 yg
175 names(yg)
176 names(yg3)
177 ?rbind
178 nrow(yg3)
179 nrow(yg)
180 yg3[,.(.N),by=.(toxic,fb)]
181 yg3.toimpute
182 names(yg3.toimpute)
183 yg3.toimpute
184 names(yg3.toimpute)
185 names(labelr)
186 nrow(yg3)
187 nrow(labelr)
188 ?merge.data.table
189 labelr
190 is.data.table(labelr)
191 yg3.toimpute
192 overimp.grid
193 overimp.grid
194 ?amelia
195 q()
196 n
197 setwd("presentations/ica_hackathon_2022/")
198 ls()
199 attach(r)
200 example_2_B.plot.df
201 library(ggplot2)
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)]
209 as.factor
210 update.packages()
211 update.packages()
212 update.packages()
213 cancel
214 plot.df
215 example_2_B.plot.df
216 plot.df
217 example_2_B.plot.df
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
227 q()
228 n
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
233 q()
234 n
235 example_2_B.plot.df$method
236 example_2_B.plot.df$method
237 q()
238 n
239 example_2_B.plot.df$method
240 example_2_B.plot.df$method
241 q()
242 n
243 q()
244 n
245 plot.df
246 plot.df
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)]
250 plot.df
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))]
253 plot.df
254 ?label_wrap_gen
255 install.packages("ggplot2")
256 devtools::install_github("tidyverse/ggplot2")
257 2
258 library(ggplot2)
259 ggplot2::version
260 sessioninfo()
261 sessionInfo()
262 q()
263 n
264 sessionInfo()
265 ?scale_x_discrete
266 ?facet_grid
267 plot.df
268 plot.df
269 plot.df[method="2SLS+gmm"]
270 plot.df[method=="2SLS+gmm"]
271 df <- example_2_B.plot.df
272 df
273 q()
274 n
275 plot.df
276 plot.df[m=50]
277 plot.df[m==50]
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")]
282 plot.df[m==50]
283 plot.df.example.3
284 plot.df.example.3
285 plot.df.example.3[N=25000]
286 plot.df.example.3[N==25000]
287 plot.df
288 plot.df
289 plot.df
290 q()
291 n

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