[R] glht (multcomp): NA's for confidence intervals using univariate_calpha
Ulrich Halekoh
Ulrich.Halekoh at agrsci.dk
Sat Sep 3 23:56:35 CEST 2011
Hej,
Calculation of confidence intervals for means
based on a model fitted with lmer
using the package multcomp
- yields results for calpha=adjusted_calpha
- NA's for calpha=univariate_calpha
Example:
library(lme4)
library(multcomp)
### Generate data
set.seed(8)
d<-expand.grid(treat=1:2,block=1:3)
e<-rnorm(3)
names(e)<-1:3
d$y<-rnorm(nrow(d)) + e[d$block]
d<-transform(d,treat=factor(treat),block=factor(block))
##### lmer fit
Mod<-lmer(y~treat+ (1|block), data=d)
### estimate treatment means
L<-cbind(c(1,0),c(0,1))
s<-glht(Mod,linfct=L)
## confidence intervals
confint(s,calpha=adjusted_calpha())
#produces NA's for the confidence limits
confint(s,calpha=univariate_calpha())
#for models fitted with lm the problem does not occur
G<-lm(y~treat+ block, data=d)
L<-matrix( c(1,0,1/3,1/3,1,1,1/3,1/3),2,4,byrow=TRUE)
s<-glht(G,linfct=L)
confint(s,calpha=adjusted_calpha())
confint(s,calpha=univariate_calpha())
multcomp version 1.2-7
R:platform i386-pc-mingw32
version.string R version 2.13.1 Patched (2011-08-19 r56767)
Regards
Ulrich Halekoh
Department of Molecular Biology and Genetics,
Aarhus University, Denmark
Ulrich.Halekoh at agrsci.dk
More information about the R-help
mailing list