Saturday, October 27, 2007

Generalized Linear Mixed Models

### Linear Mixed Models
library(lme4)
ChickWeight <- data.frame(ChickWeight)
class(ChickWeight)

gsummary(ChickWeight, groups=ChickWeight$Chick)

list <- lmList(weight~Time |Chick, data=ChickWeight)
pooledSD(list) # exact pooled standard deviation

> lm1<-lmer(weight~Time+(Time|Chick), data=ChickWeight)
> lm2<-lmer(weight~Time+Diet+(Time|Chick), data=ChickWeight)
> anova(lm1,lm2)

### Generalized Linear Mixed Models
Laplace Method
PQL (penalized quasi-likelihood) - fastest but least accurate
AGQ (adaptive Gauss quadrature) - most accurate but slow

library(lme4)
lmer(method="PQL", "Laplace", "AGQ")

GLMMGibbs: Gibbs sampling

No comments: