Hej,
 
The lmer2-version (not the lmer)  calculates wrong fixed effect
estimates if
a model is fitted  with a factor-effects in the mean-value
parameterization:
 
 
Example
library(lme4)
 
set.seed(98)
 
### data set generation of a hiearchial model with 
#  one random components sub 
####
#  y_ijk= a_i + delta_j(i) +   e_ijk
 

n.treat<-2
n.sub<-3
n.rep<-4
 
d<-expand.grid(rep=1:n.rep,sub=1:n.sub,treat=1:n.treat)
 
treat<-d$treat
d$treat<-factor(d$treat)
d$treat<-relevel(d$treat,1)
d$sub<-factor(d$sub)
d$sub<-relevel(d$sub,1)
d$rep<-factor(d$rep)
d$rep<-relevel(d$rep,1) 
 

e.sub<-rnorm(n.treat*n.sub,sd=3)[d$treat:d$sub]
e.rep<-rnorm(n.treat*n.sub*n.rep)
 

d$y<- treat + e.sub + e.rep
 
#parameterization with intecept
g.withIntercept<-  lmer(y~treat+(1|treat:sub),data=d,method='REML')
g2.withIntercept<-lmer2(y~treat+(1|treat:sub),data=d,method='REML')
 
#parameterization without intecept
g.withOutIntercept<-  lmer(y~0+treat+(1|treat:sub),data=d,method='REML')
g2.withOutIntercept<-lmer2(y~0+treat+(1|treat:sub),data=d,method='REML')
 

print('with intecept -all OK')
print(g.withIntercept)
print(g2.withIntercept)
 
 
 
print('without intecept- in the lmer2 fit wrong estiimate for treat1
(and STDERR)')
print(g.withOutIntercept)
print(g2.withOutIntercept)
 
 
Ulrich
 
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          4.1                         
year           2006                        
month          12                          
day            18                          
svn rev        40228                       
language       R                           
version.string R version 2.4.1 (2006-12-18)

 
lme4: [Package lme4 version 0.9975-11 
 
 
 
 
Ulrich Halekoh, Ph.D
UNIVERSITY OF AARHUS 
Faculty of Agricultural Sciences 
Dept. of Genetics and Biotechnology 
E-mail: Ulrich.Halekoh@agrsci.dk <mailto:Ulrich.Halekoh@agrsci.dk>  


	[[alternative HTML version deleted]]


