[R] lmer multilevel
Spencer Graves
spencer.graves at pdf.com
Fri Mar 31 19:01:30 CEST 2006
Hi, Doug:
I just confirmed a discrepancy (reported by Paul Cossens) between the
output of lme and lmer using the Oxide example in Pinheiro and Bates,
pp. 167-170. It appears that coef(lmer(...)) adds only the ranef for
Wafer and omits the one for Lot.
Consider the following:
library(nlme)
Oxide <- Oxide
#data(Oxide,package="nlme")
fit.lme <- lme(Thickness~1,Oxide)
coef.lme <- coef(fit.lme)
<exit R, restart>
library(lme4)
fm3Oxide<-lmer(Thickness~ (1|Lot)+(1|Lot:Wafer),data=Oxide)
coef.lme4 <- coef(fm3Oxide)
The following matches the first 3 numbers in coef.lme but not in
coef.lme4:
fixef(fm3Oxide)+ranef(fm3Oxide)[[2]][1]+ranef(fm3Oxide)[[1]][1:3]
Best Wishes,
spencer graves
Paul Cossens wrote:
> My question relates to problems that I'm having matching lme and lmer
> examples in P&B.
> using Matix 0.995
>
> In the Oxide example in p167-170 I can't get the level 2 coefficient
> estimates to match
> the fm1Oxide model in lme is
>
> data(Oxide,package="nlme")
> lme(Thickness~1,Oxide)
>
> which I translate in Lmer syntax to
>
> fm3Oxide<-lmer(Thickness~ (1|Lot)+(1|Lot:Wafer),data=Oxide)
> #or alternatively which gives the same result
> Oxide$LW<-with(Oxide,Lot:Wafer)[drop=TRUE]
> fm4Oxide<-lmer(Thickness~ (1|Lot)+(1|LW),data=Oxide)
>
> however if you look at say Lot 8, lme gives
>
> 8 1993.767
>
> 8/1 1993.677
> 8/2 1995.170
> 8/3 1990.693
>
>
> while lmer gives
> coef(fm3Oxide)
> ....
> 8 1993.767
> 8:1 2000.062
>
> 8:2 2001.555
>
> 8:3 1997.078
>
> To me this looks like lmer in not including the lot random effect (8=
> -6.385129, Intercept 2000.153 ). Is this because I'm not specifying the
> model correctly?
>
> Thanks Paul
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list