-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcount_data.R
60 lines (48 loc) · 1.96 KB
/
count_data.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
library("lme4")
dat <- readRDS("urefs.rds")
aggregate(WC ~ Novelty + Addressee + Feedback,
dat, mean)
aggregate(WC ~ Novelty + Addressee, dat, mean)
hist(dat$WC)
hist(log(dat$WC))
dat2 <- transform(dat, N = ifelse(Novelty == "New", 1, 0),
A = ifelse(Addressee == "New", 1, 0),
F = ifelse(Feedback == "Yes", 1, 0))
dat2c <- transform(dat2,
Nc = N - mean(N),
Ac = A - mean(A),
Fc = F - mean(F))
mod <- glmer(WC ~ Ac * Nc * Fc +
(1 + Nc * Fc | SessionID) +
(1 + Ac * Nc | ItemID),
dat2c, poisson,
control = glmerControl(optimizer = "bobyqa"))
mod3 <- glmer(WC ~ Ac * Nc * Fc +
(1 + Nc * Fc | SessionID) +
(1 + Ac * Nc | ItemID),
dat2c, poisson,
control = glmerControl(optimizer = "bobyqa",
optCtrl = list(maxfun = 20000)))
mod2 <- glmer(WC ~ Ac * Nc * Fc +
(1 + Nc * Fc | SessionID) +
(1 + Ac + Ac:Nc | ItemID),
dat2c, poisson,
control = glmerControl(optimizer = "bobyqa"))
mod_diag <- glmer(WC ~ Ac * Nc * Fc +
(1 + Nc * Fc || SessionID) +
(1 + Ac * Nc || ItemID),
dat2c, poisson)
mod_diag_noA <- update(mod_diag, . ~ . -Ac)
mod_diag_noN <- update(mod_diag, . ~ . -Nc)
mod_diag_noF <- update(mod_diag, . ~ . -Fc)
mod_diag_noAN <- update(mod_diag, . ~ . -Ac:Nc)
mod_diag_noAF <- update(mod_diag, . ~ . -Ac:Fc)
mod_diag_noNF <- update(mod_diag, . ~ . -Nc:Fc)
mod_diag_noANF <- update(mod_diag, . ~ . -Ac:Nc:Fc)
anova(mod_diag, mod_diag_noA)
anova(mod_diag, mod_diag_noN)
anova(mod_diag, mod_diag_noF)
anova(mod_diag, mod_diag_noAN)
anova(mod_diag, mod_diag_noAF)
anova(mod_diag, mod_diag_noNF)
anova(mod_diag, mod_diag_noANF)