-
Notifications
You must be signed in to change notification settings - Fork 1
/
experiment_report_07.15.2016.R
383 lines (316 loc) · 24.4 KB
/
experiment_report_07.15.2016.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
library(ggplot2)
library(knitr)
library(lubridate)
library(pscl)
library(texreg)
library(lme4)
library(lmerTest)
library(stargazer)
opts_chunk$set(fig.path = 'figures/')
###################################
### HIGH LEVEL QUESTIONS I NEED TO ANSWER
# 1. What should the intervention be?
# 1a. How many people receive the treatment?
# 1b. How does randomization work?
# 2. What covariates should be used for regression adjustment
## 2a. Post level newcomer removed analysis
## 2b. Post level newcomer comment analysis
## 2c. Comment level newcomer analysis
## 2d. Comment level newcomer analysis
## HIGH LEVEL QUESTIONS FOR LATER:
# #1. How long should the experiment period be?
###################################
#### LOAD POSTS
full.posts <- read.csv("outputs/r_science_posts_2016.04.04_22.09.42-2016.06.30_23.59.34.csv")
full.posts$post.ama <- full.posts$post.ama=="True"
full.posts$datetime <- as.POSIXct(full.posts$created)
full.posts$post.hour <- hour(full.posts$datetime)
short.posts <- read.csv("outputs/r_science_posts_2016.07.04_04.46.26-2016.07.14_21.36.36.csv")
short.posts$post.ama <- short.posts$post.ama=="True"
short.posts$datetime <- as.POSIXct(short.posts$created_utc, origin="1970-01-01")
short.posts$post.hour <- hour(short.posts$datetime)
full.posts$newcomer.comments.experiment.day.pct <- (full.posts$newcomer.comments.experiment.day + 1) / (full.posts$newcomer.comments + 1)
full.posts$newcomer.comments.removed.experiment.day.pct <- (full.posts$newcomer.comments.removed.experiment.day + 1) / (full.posts$newcomer.comments.removed + 1)
full.posts$newcomer.comments.removed.experiment.day.zero <- full.posts$newcomer.comments.removed.experiment.day == 0
full.posts$newcomer.comments.experiment.day.zero <- full.posts$newcomer.comments.experiment.day == 0
full.posts$newcomer.comments.zero <- full.posts$newcomer.comments == 0
full.posts$newcomer.comments.removed.zero <- full.posts$newcomer.comments == 0
short.posts$newcomer.comments.removed.experiment.day.zero <- short.posts$newcomer.comments.removed.experiment.day == 0
short.posts$newcomer.comments.experiment.day.zero <- short.posts$newcomer.comments.experiment.day == 0
short.posts$newcomer.comments.zero <- short.posts$newcomer.comments == 0
short.posts$newcomer.comments.removed.zero <- short.posts$newcomer.comments == 0
short.posts$post.sub.top.minutes.ln <- log1p(short.posts$post.sub.top.minutes)
###################################
#### LOAD COMMENTS
full.comments <- read.csv("outputs/r_science_comments_2016.04.04_22.09.42-2016.06.30_23.59.34.csv")
full.comments$datetime <- as.POSIXct(full.comments$created)
full.comments$hour <- hour(full.comments$datetime)
full.comments$post.ama <- full.comments$post.ama=="True"
full.comments$post.datetime <- as.POSIXct(full.comments$post.created)
full.comments$post.hour <- hour(full.comments$post.datetime)
short.comments <- read.csv("outputs/r_science_comments_2016.07.04_04.46.26-2016.07.14_21.36.36.csv")
short.comments$datetime <- as.POSIXct(short.comments$created_utc, origin="1970-01-01")
short.comments$hour <- hour(short.comments$datetime)
short.comments$post.ama <- short.comments$post.ama=="True"
short.comments$post.datetime <- as.POSIXct(short.comments$post.created)
short.comments$post.hour <- hour(short.comments$post.datetime)
short.comments$post.sub.top.minutes.ln <- log1p(short.comments$post.sub.top.minutes)
hist(subset(short.posts, post.sub.top.minutes >0)$post.sub.top.minutes, breaks=100)
###################################
### BEGIN REPORT
# 1. How many newcomers are there
# 2. How many newcomers don't delete their accounts later?
#library(editR)
#editR("/Users/nathan/Documents/github/CivilServant-Analysis/reports/experiment.planning.07.16.2016.Rmd")
min(full.comments$datetime)
max(full.comments$datetime)
### PLOT COMMENTS PER HOUR
ggplot(full.comments, aes(hour)) +
ggtitle("Comments Per Hour, April 4 2016 - May 30 2016") +
geom_histogram(bins=24)
### SUMMARIZE HOW MANY NEWCOMER COMMENTS and REMOVED COMMENTS FALL WITHIN THE EXPERIMENT DAY
ggplot(subset(full.posts, newcomer.comments > 0), aes(newcomer.comments.experiment.day.pct)) +
ggtitle(expression(atop("Percent Comments Within Day-Randomized Experiment Period April 4 2016 - May 30 2016", atop(italic("Within the subset of posts with at least 1 newcomer comment"))))) +
theme(axis.text.x = element_text(angle=-45, hjust=0, vjust=1),
#plot.margin = unit(c(1.5, 1, 1, 1), "cm"),
plot.title = element_text(size = 25, face = "bold", colour = "black", vjust = -1)) +
geom_histogram(bins=100)
ggplot(subset(full.posts, newcomer.comments > 0), aes(newcomer.comments.removed.experiment.day.pct)) +
ggtitle(expression(atop("Percent Removed Comments Within Day-Randomized Experiment Period April 4 2016 - May 30 2016", atop(italic("Within the subset of posts with at least 1 newcomer comment"))))) +
theme(axis.text.x = element_text(angle=-45, hjust=0, vjust=1),
#plot.margin = unit(c(1.5, 1, 1, 1), "cm"),
plot.title = element_text(size = 15, face = "bold", colour = "black", vjust = -1)) +
geom_histogram(bins=100)
##################################################
### HOW SHOULD THE DEPENDENT VARIABLES BE MODELED? (COMMENT BOX RULES EXPERIMENT)
################################
##### Newcomer Comments Removed
ggplot(short.posts, aes(newcomer.comments.removed.experiment.day)) +
ggtitle("Experiment Priod Newcomer Comments Removed Per Post, July 4 - 14 2016") +
geom_histogram(bins=100)
ggplot(subset(short.posts, visible=="True"), aes(newcomer.comments.removed.experiment.day)) +
ggtitle("Experiment Priod Newcomer Comments Removed Per Visible Post, July 4 - 14 2016") +
geom_histogram(bins=100)
summary(short.posts$newcomer.comments.removed.experiment.day.zero)
summary(subset(short.posts, visible=="True")$newcomer.comments.removed.experiment.day.zero)
summary(ncrmexz1 <- glm(newcomer.comments.removed.experiment.day.zero ~ 1, data=short.posts, family=binomial))
summary(ncrmexz2 <- glm(newcomer.comments.removed.experiment.day.zero ~ visible, data=short.posts, family=binomial))
summary(ncrmexz3 <- glm(newcomer.comments.removed.experiment.day.zero ~ visible + post.sub.top.minutes, data=short.posts, family=binomial))
summary(ncrmexz4 <- glm(newcomer.comments.removed.experiment.day.zero ~ visible + post.sub.top.minutes + post.ama, data=short.posts, family=binomial))
summary(ncrmexz5 <- glm(newcomer.comments.removed.experiment.day.zero ~ visible + post.sub.top.minutes + experiment.day.minutes, data=short.posts, family=binomial))
summary(ncrmexz6 <- glm(newcomer.comments.removed.experiment.day.zero ~ visible + post.sub.top.minutes + post.hour + I(post.hour^2), data=short.posts, family=binomial))
summary(ncrmexz7 <- glm(newcomer.comments.removed.experiment.day.zero ~ visible + post.sub.top.minutes + weekend, data=short.posts, family=binomial))
summary(ncrmexz8 <- glm(newcomer.comments.removed.experiment.day.zero ~ visible + post.sub.top.minutes + post.flair, data=short.posts, family=binomial))
stargazer(ncrmexz1, ncrmexz2, ncrmexz3, ncrmexz4, ncrmexz5, ncrmexz6, ncrmexz7, ncrmexz8, type="text")
#htmlreg(list(ncrmexz1, ncrmexz2, ncrmexz3, ncrmexz4, ncrmexz5, ncrmexz6, ncrmexz7, ncrmexz8))
summary(model.newcomer.comments.rm.exp.zi.1 <- zeroinfl(newcomer.comments.removed.experiment.day ~ 1 |
visible + post.sub.top.minutes,
data=short.posts))
summary(model.newcomer.comments.rm.exp.zi.2 <- zeroinfl(newcomer.comments.removed.experiment.day ~ visible |
visible + post.sub.top.minutes,
data=short.posts))
summary(model.newcomer.comments.rm.exp.zi.3 <- zeroinfl(newcomer.comments.removed.experiment.day ~ visible + post.ama |
visible + post.sub.top.minutes,
data=short.posts))
summary(model.newcomer.comments.rm.exp.zi.4 <- zeroinfl(newcomer.comments.removed.experiment.day ~ visible + post.ama + post.sub.top.minutes |
visible + post.sub.top.minutes,
data=short.posts))
summary(model.newcomer.comments.rm.exp.zi.5 <- zeroinfl(newcomer.comments.removed.experiment.day ~ visible + post.ama + post.sub.top.minutes + experiment.day.minutes |
visible + post.sub.top.minutes,
data=short.posts))
summary(model.newcomer.comments.rm.exp.zi.6 <- zeroinfl(newcomer.comments.removed.experiment.day ~ visible + post.ama + post.sub.top.minutes + experiment.day.minutes + weekend |
visible + post.sub.top.minutes,
data=short.posts))
summary(model.newcomer.comments.rm.exp.zi.7 <- zeroinfl(newcomer.comments.removed.experiment.day ~ visible + post.ama + post.sub.top.minutes + experiment.day.minutes + weekend + post.flair |
visible + post.sub.top.minutes,
data=short.posts))
summary(model.newcomer.comments.rm.exp.zi.8 <- zeroinfl(newcomer.comments.removed.experiment.day ~ visible + post.ama + post.sub.top.minutes + experiment.day.minutes + weekend + post.flair + post.hour + I(post.hour^2) |
visible + post.sub.top.minutes,
data=short.posts))
stargazer(model.newcomer.comments.rm.exp.zi.1,
model.newcomer.comments.rm.exp.zi.2,
model.newcomer.comments.rm.exp.zi.3,
model.newcomer.comments.rm.exp.zi.4,
model.newcomer.comments.rm.exp.zi.5,
model.newcomer.comments.rm.exp.zi.6,
model.newcomer.comments.rm.exp.zi.7,
model.newcomer.comments.rm.exp.zi.8, type="text")
htmlreg(list(model.newcomer.comments.rm.exp.zi.1,
model.newcomer.comments.rm.exp.zi.2,
model.newcomer.comments.rm.exp.zi.3,
model.newcomer.comments.rm.exp.zi.4,
model.newcomer.comments.rm.exp.zi.5,
model.newcomer.comments.rm.exp.zi.6,
model.newcomer.comments.rm.exp.zi.7), type="html")
################################
##### Newcomer Comments
ggplot(short.posts, aes(newcomer.comments.removed.experiment.day)) +
ggtitle("Experiment Priod Newcomer Comments Removed Per Post, July 4 - 14 2016") +
geom_histogram(bins=100)
ggplot(subset(short.posts, visible=="True"), aes(newcomer.comments.removed.experiment.day)) +
ggtitle("Experiment Priod Newcomer Comments Removed Per Visible Post, July 4 - 14 2016") +
geom_histogram(bins=100)
summary(short.posts$newcomer.comments.experiment.day.zero)
summary(subset(short.posts, visible=="True")$newcomer.comments.experiment.day.zero)
## Fit the logistic regression
ncexz1 <- glm(newcomer.comments.experiment.day.zero ~ 1, data=short.posts, family=binomial)
ncexz2 <- glm(newcomer.comments.experiment.day.zero ~ visible, data=short.posts, family=binomial)
ncexz3 <- glm(newcomer.comments.experiment.day.zero ~ visible + post.sub.top.minutes.ln, data=short.posts, family=binomial)
ncexz4 <- glm(newcomer.comments.experiment.day.zero ~ visible + post.sub.top.minutes.ln + post.ama, data=short.posts, family=binomial)
ncexz5 <- glm(newcomer.comments.experiment.day.zero ~ visible + post.sub.top.minutes.ln + experiment.day.minutes, data=short.posts, family=binomial)
ncexz6 <- glm(newcomer.comments.experiment.day.zero ~ visible + post.sub.top.minutes.ln + post.hour + I(post.hour^2), data=short.posts, family=binomial)
ncexz7 <- glm(newcomer.comments.experiment.day.zero ~ visible + post.sub.top.minutes.ln + weekend, data=short.posts, family=binomial)
ncexz8 <- glm(newcomer.comments.experiment.day.zero ~ visible + post.sub.top.minutes.ln + post.flair, data=short.posts, family=binomial)
#htmlreg(list(ncexz1, ncexz2, ncexz3, ncexz4, ncexz5, ncexz6, ncexz7, ncexz8))
stargazer(ncexz1, ncexz2, ncexz3, ncexz4, ncexz5, ncexz6, ncexz7, ncexz8, type="text")
### Now fit the zero inflated model
model.newcomer.comments.exp.zi.1 <- zeroinfl(newcomer.comments.experiment.day ~ 1 |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.exp.zi.2 <- zeroinfl(newcomer.comments.experiment.day ~ visible |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.exp.zi.3 <- zeroinfl(newcomer.comments.experiment.day ~ visible + post.ama|
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.exp.zi.4 <- zeroinfl(newcomer.comments.experiment.day ~ visible + post.ama + post.sub.top.minutes |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.exp.zi.5 <- zeroinfl(newcomer.comments.experiment.day ~ visible + post.ama + post.sub.top.minutes + experiment.day.minutes |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.exp.zi.6 <- zeroinfl(newcomer.comments.experiment.day ~ visible + post.ama + post.sub.top.minutes + experiment.day.minutes + post.hour + I(post.hour^2) |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.exp.zi.7 <- zeroinfl(newcomer.comments.experiment.day ~ visible + post.ama + post.sub.top.minutes + experiment.day.minutes + post.hour + I(post.hour^2) + weekend |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.exp.zi.8 <- zeroinfl(newcomer.comments.experiment.day ~ visible + post.ama + post.sub.top.minutes + experiment.day.minutes + post.hour + I(post.hour^2) + weekend + post.flair|
visible + post.sub.top.minutes.ln, data=short.posts)
stargazer(model.newcomer.comments.exp.zi.1,
model.newcomer.comments.exp.zi.2,
model.newcomer.comments.exp.zi.3,
model.newcomer.comments.exp.zi.4,
model.newcomer.comments.exp.zi.5,
model.newcomer.comments.exp.zi.6,
model.newcomer.comments.exp.zi.7,
model.newcomer.comments.exp.zi.8, type="text")
# htmlreg(list(model.newcomer.comments.exp.zi.1,
# model.newcomer.comments.exp.zi.2,
# model.newcomer.comments.exp.zi.3,
# model.newcomer.comments.exp.zi.4,
# model.newcomer.comments.exp.zi.5,
# model.newcomer.comments.exp.zi.6,
# model.newcomer.comments.exp.zi.7,
# model.newcomer.comments.exp.zi.8))
##################################################
### HOW SHOULD THE DEPENDENT VARIABLES BE MODELED? (STICKY COMMENT EXPERIMENT)
###########################
######## Newcomer Comments Removed
# predict zeroes
ncrmz1 <- glm(newcomer.comments.removed.zero ~ 1, data=short.posts, family=binomial)
ncrmz2 <- glm(newcomer.comments.removed.zero ~ visible, data=short.posts, family=binomial)
ncrmz3 <- glm(newcomer.comments.removed.zero ~ visible + post.sub.top.minutes.ln, data=short.posts, family=binomial)
ncrmz4 <- glm(newcomer.comments.removed.zero ~ visible + post.sub.top.minutes.ln + post.ama, data=short.posts, family=binomial)
ncrmz5 <- glm(newcomer.comments.removed.zero ~ visible + post.sub.top.minutes.ln + post.hour + I(post.hour^2), data=short.posts, family=binomial)
ncrmz6 <- glm(newcomer.comments.removed.zero ~ visible + post.sub.top.minutes.ln + weekend, data=short.posts, family=binomial)
ncrmz7 <- glm(newcomer.comments.removed.zero ~ visible + post.sub.top.minutes.ln + post.flair, data=short.posts, family=binomial)
htmlreg(list(ncrmexz1, ncrmexz2, ncrmexz3, ncrmexz4, ncrmexz5, ncrmexz6, ncrmexz7))
stargazer(ncrmz1, ncrmz2, ncrmz3, ncrmz4, ncrmz5, ncrmz6, ncrmz7, type="text")
# full models
model.newcomer.comments.rm.zi.1 <- zeroinfl(newcomer.comments.removed ~ 1 |
visible + post.sub.top.minutes.ln,
data=short.posts)
model.newcomer.comments.rm.zi.2 <- zeroinfl(newcomer.comments.removed ~ visible |
visible + post.sub.top.minutes,
data=short.posts)
model.newcomer.comments.rm.zi.3 <- zeroinfl(newcomer.comments.removed ~ visible + post.ama |
visible + post.sub.top.minutes.ln,
data=short.posts)
model.newcomer.comments.rm.zi.4 <- zeroinfl(newcomer.comments.removed ~ visible + post.ama + post.sub.top.minutes |
visible + post.sub.top.minutes.ln,
data=short.posts)
model.newcomer.comments.rm.zi.5 <- zeroinfl(newcomer.comments.removed ~ visible + post.ama + post.sub.top.minutes + weekend |
visible + post.sub.top.minutes.ln,
data=short.posts)
model.newcomer.comments.rm.zi.6 <- zeroinfl(newcomer.comments.removed ~ visible + post.ama + post.sub.top.minutes + weekend + post.flair |
visible + post.sub.top.minutes.ln,
data=short.posts)
model.newcomer.comments.rm.zi.7 <- zeroinfl(newcomer.comments.removed ~ visible + post.ama + post.sub.top.minutes + weekend + post.flair + post.hour + I(post.hour^2) |
visible + post.sub.top.minutes.ln,
data=short.posts)
# htmlreg(list(model.newcomer.comments.rm.zi.1,
# model.newcomer.comments.rm.zi.2,
# model.newcomer.comments.rm.zi.3,
# model.newcomer.comments.rm.zi.4,
# model.newcomer.comments.rm.zi.5,
# model.newcomer.comments.rm.zi.6,
# model.newcomer.comments.rm.zi.7), type="html")
stargazer(model.newcomer.comments.rm.zi.1,
model.newcomer.comments.rm.zi.2,
model.newcomer.comments.rm.zi.3,
model.newcomer.comments.rm.zi.4,
model.newcomer.comments.rm.zi.5,
model.newcomer.comments.rm.zi.6,
model.newcomer.comments.rm.zi.7, type="text")
###########################
######## Newcomer Comments
ncz1 <- glm(newcomer.comments.zero ~ 1, data=short.posts, family=binomial)
ncz2 <- glm(newcomer.comments.zero ~ visible, data=short.posts, family=binomial)
ncz3 <- glm(newcomer.comments.zero ~ visible + post.sub.top.minutes.ln, data=short.posts, family=binomial)
ncz4 <- glm(newcomer.comments.zero ~ visible + post.sub.top.minutes.ln + post.ama, data=short.posts, family=binomial)
ncz5 <- glm(newcomer.comments.zero ~ visible + post.sub.top.minutes.ln + post.hour + I(post.hour^2), data=short.posts, family=binomial)
ncz6 <- glm(newcomer.comments.zero ~ visible + post.sub.top.minutes.ln + weekend, data=short.posts, family=binomial)
ncz7 <- glm(newcomer.comments.zero ~ visible + post.sub.top.minutes.ln + post.flair, data=short.posts, family=binomial)
#htmlreg(list(ncz1, ncz2, ncz3, ncz4, ncz5, ncz6, ncz7))
stargazer(ncz1, ncz2, ncz3, ncz4, ncz5, ncz6, ncz7, type="text")
### Now fit the zero inflated model
model.newcomer.comments.zi.1 <- zeroinfl(newcomer.comments ~ 1 |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.zi.2 <- zeroinfl(newcomer.comments ~ visible |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.zi.3 <- zeroinfl(newcomer.comments ~ visible + post.ama|
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.zi.4 <- zeroinfl(newcomer.comments ~ visible + post.ama + post.sub.top.minutes |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.zi.5 <- zeroinfl(newcomer.comments ~ visible + post.ama + post.sub.top.minutes + post.hour + I(post.hour^2) |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.zi.6 <- zeroinfl(newcomer.comments ~ visible + post.ama + post.sub.top.minutes + post.hour + I(post.hour^2) + weekend |
visible + post.sub.top.minutes.ln, data=short.posts)
model.newcomer.comments.zi.7 <- zeroinfl(newcomer.comments ~ visible + post.ama + post.sub.top.minutes + post.hour + I(post.hour^2) + weekend + post.flair|
visible + post.sub.top.minutes.ln, data=short.posts)
htmlreg(list(model.newcomer.comments.zi.1,
model.newcomer.comments.zi.2,
model.newcomer.comments.zi.3,
model.newcomer.comments.zi.4,
model.newcomer.comments.zi.5,
model.newcomer.comments.zi.6,
model.newcomer.comments.zi.7), type="text")
stargazer(model.newcomer.comments.zi.1,
model.newcomer.comments.zi.2,
model.newcomer.comments.zi.3,
model.newcomer.comments.zi.4,
model.newcomer.comments.zi.5,
model.newcomer.comments.zi.6,
model.newcomer.comments.zi.7, type="text")
##################################################
### HOW SHOULD THE DEPENDENT VARIABLES BE MODELED?
### (COMMENT LEVEL ANALYSIS OF STICKY COMMENT EXPERIMENT)
summary(short.comments$visible)
newcomer.comments <- subset(short.comments, author.prev.comments ==0)
nrow(newcomer.comments)
ccv1 <- glmer(visible ~ 1 + (1 | link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccv2 <- glmer(visible ~ post.visible + (1 | link_id), data = newcomer.comments, family = binomial, nAGQ=0)
ccv3 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + (1 | link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccv4 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + post.ama + (1 | link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccv5 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + post.ama + post.flair + (1 | link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccv6 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + post.ama + post.flair + toplevel + (1 | link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccv7 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + post.ama + post.flair + toplevel + weekend + (1 | link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccv8 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + post.ama + post.flair + toplevel + post.hour + I(post.hour^2) + (1 | link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
htmlreg(list(ccv1,ccv2,ccv3,ccv4,ccv5,ccv6,ccv7, ccv8))
stargazer(ccv1,ccv2,ccv3,ccv4,ccv5,ccv6,ccv7, ccv8, type="text")
##### NOW TRY IT WITH a 3-level model
ccvri1 <- glmer(visible ~ 1 + (1 | post.flair/link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccvri2 <- glmer(visible ~ post.visible + (1 | post.flair/link_id), data = newcomer.comments, family = binomial)
ccvri3 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + (1 | post.flair/link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccvri4 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + post.ama + (1 | post.flair/link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccvri5 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + post.ama + toplevel + (1 | post.flair/link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccvri6 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + post.ama + toplevel + weekend + (1 | post.flair/link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
ccvri7 <- glmer(visible ~ post.visible + post.sub.top.minutes.ln + post.ama + toplevel + post.hour + I(post.hour^2) + (1 | post.flair/link_id), data = newcomer.comments, family = binomial, nAGQ = 0)
htmlreg(list(ccvri1,ccvri2,ccvri3,ccvri4,ccvri5,ccvri6,ccvri7))
stargazer(ccvri1,ccvri2,ccvri3,ccvri4,ccvri5,ccvri6,ccvri7, type="text")
library(gmodels)
CrossTable(newcomer.comments$toplevel, newcomer.comments$visible)