Displaying 2 results from an estimated 2 matches for "epil3".
Did you mean:
epil2
2006 Aug 17
1
Simulate p-value in lme4
...is problem. The model and data in
the example are from section 10.4 of MASS.
Thanks!
Manuel
# Load req. package (see functions to generate data at end of script)
library(lme4)
library(MASS)
# Full and reduced models - pred is a factor with 3 levels
result.full <- lmer(y~pred+(1|subject), data=epil3, family="poisson")
result.base <- lmer(y~1+(1|subject), data=epil3, family="poisson")
# Naive P-value from LR for significance of "pred" factor
anova(result.base,result.full)$"Pr(>Chisq)"[[2]] # P-value
(test.stat <- anova(result.base,result.full)$C...
2006 Oct 08
1
Simulate p-value in lme4
...== 1, ]
epil2["period"] <- rep(0, 59); epil2["y"] <- epil2["base"]
epil["time"] <- 1; epil2["time"] <- 4
epil2 <- rbind(epil, epil2)
epil2$pred <- unclass(epil2$trt) * (epil2$period > 0)
epil2$subject <- factor(epil2$subject)
epil3 <- aggregate(epil2, list(epil2$subject, epil2$period > 0),
function(x) if(is.numeric(x)) sum(x) else x[1])
************simulation (SG)************
o <- with(epil3, order(subject, y))
epil3. <- epil3[o,]
norep <- with(epil3., subject[-1]!=subject[-dim(epil3)[1]])
subj1 <- which(...