[R-sig-ME] Nlme prediction intervals confidence intervals multiple comparison query

Philip Harrison pharriso at uwaterloo.ca
Wed Nov 9 00:51:39 CET 2011


Hi,

I am using nlme to fit LMM to a fish acoustic telemetry dataset and it  
is working very well, however I am using the following very useful  
code (which I got from http://glmm.wikidot.com/faq)

library(nlme)
fm1 <- lme(distance ~ age*Sex, random = ~ 1 + age | Subject, data = Orthodont)

plot(Orthodont)
newdat <- expand.grid(age=c(8,10,12,14), Sex=c("Male","Female"))
newdat$pred <- predict(fm1, newdat, level = 0)

Designmat <- model.matrix(eval(eval(fm1$call$fixed)[-2]), newdat[-3])
predvar <- diag(Designmat %*% fm1$varFix %*% t(Designmat))
newdat$SE <- sqrt(predvar)
newdat$SE2 <- sqrt(predvar+fm1$sigma^2)
newdat$upperCI<-newdat$predict+(2*newdat$SE2)
newdat$lowerCI<-newdat$predict-(2*newdat$SE2)

to obtain confidence intervals from predictions from an lme model.  
Which works well....however I would like to know;

a) what method of confidence interval prediction has been used here?-  
I dont fully understand how this code (especially the designmat)  
works- does this code correct for multiple comparisons- and if so  
which method is used, how does it extract degrees of freedom from the  
model?

b) if the method used is a conservative bonferroni type correction can  
anyone point me in the right direction to change this code to a less  
conservative method e.g FDR or something similar?

Thanks in advance for any help

Philip Harrison MSc
PhD student (Fisheries Ecology)
Department of Biology
University of Waterloo
200 University Avenue West
Waterloo, Ontario, Canada
N2L 3G1
Cell:226-808-2309
Email:pharriso at uwaterloo.ca




More information about the R-sig-mixed-models mailing list