[R] lmer for 3-way random anova

Douglas Bates dmbates at gmail.com
Sat Dec 10 15:41:42 CET 2005


If you are running on a Linux system you can try an experimental
version of the Matrix package that is available from the SVN archive. 
The URL is

https://svn.r-project.org/R-packages/branches/Matrix-mer2

The code in that branch uses what is called a supernodal sparse
Cholesky factorization which works very well for these types of
models.  Once I get the Laplace and AGQ methods for generalized linear
mixed models working in this formulation I will merge the branch back
in to the trunk and release a version of the Matrix package using
this.

I haven't created a Windows binary for this experimental branch
because I still can't get the compilation system to work on my Windows
computer.  If someone wants to try compiling on Windows from the SVN
sources I would appreciate it.

On 12/9/05, Dick Beyer <dbeyer at u.washington.edu> wrote:
> I have been using lme from nlme to do a 3-way anova with all the effects treated as random.  I was wondering if someone could direct me to an example of how to do this using lmer from lme4.
>
> I have 3 main effects, tim, trt, ctr,  and all the interaction effects tim*trt*ctr. The response variable is ge.
>
> Here is my lme code:
>
>
>    dat <- data.frame(ge=ge,trt=factor(trt),tim=factor(tim),ctr=factor(ctr))
>    dat$grp = as.factor(rep(1, nrow(dat)))
>
> # dim(dat) = 216x5
>
>    w <- lme(ge ~ 1,data=dat,
>    random = list(
>    grp = pdBlocked(list(  pdIdent(~ trt - 1)
>                          ,pdIdent(~ tim - 1)
>                          ,pdIdent(~ ctr - 1)
>                          ,pdIdent(~ trt:tim - 1)
>                          ,pdIdent(~ trt:ctr - 1)
>                          ,pdIdent(~ tim:ctr - 1)
>                          ,pdIdent(~ trt:tim:ctr - 1)
>                         )
>                   )
>                 )
>               )
>
> I was trying the following as a starting place:
>
>    lmer(ge~1+(1|tim)+(1|trt)+(1|ctr), data=dat)
>
> but this causes my R session to terminate.
>
> > sessionInfo()
> R version 2.2.0, 2005-11-15, i386-pc-mingw32
>
> attached base packages:
> [1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"  "base"
>
> other attached packages:
>       lme4   lattice    Matrix
>   "0.98-1" "0.12-11"  "0.99-2"
>
> Thanks very much for any help or pointers,
> Dick
> *******************************************************************************
> Richard P. Beyer, Ph.D. University of Washington
> Tel.:(206) 616 7378     Env. & Occ. Health Sci. , Box 354695
> Fax: (206) 685 4696     4225 Roosevelt Way NE, # 100
>                         Seattle, WA 98105-6099
> http://depts.washington.edu/ceeh/ServiceCores/FC5/FC5.html
> http://staff.washington.edu/~dbeyer
>
> ______________________________________________
> 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