# Re: [R] random effects with lmer() and lme(), three random factors

From: Xianqun (Wilson) Wang <xwang_at_aviaradx.com>
Date: Tue 01 Aug 2006 - 05:27:39 EST

Dr. Bates,

Thanks for the notes! It helps. So now I see consistent resluts from both lme and lmer. Since I have several response variables to look at, I will reduce the model separately.

Speaking of the model reduction, it is clear in this example that the trivial variance of Operator:Run could be ignored. For a non-trivial-variance multivariate model, I wonder if there is any function (like step function for lm and glm) would work with lme or lmer and allow me to do the AIC-based model selection.

Wilson

-----Original Message-----
From: dmbates@gmail.com [mailto:dmbates@gmail.com] On Behalf Of Douglas Bates
Sent: Saturday, July 29, 2006 7:51 AM
To: Xianqun (Wilson) Wang
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] random effects with lmer() and lme(), three random factors

On 7/28/06, Xianqun (Wilson) Wang <xwang@aviaradx.com> wrote:
> Hi, all,

> I have a question about random effects model. I am dealing with a
> three-factor experiment dataset. The response variable y is modeled
> against three factors: Samples, Operators, and Runs. The experimental
> design is as follow:

> group of operators. Each operator independently analyzed same samples
> over 5 runs (runs nested in operator). I would like to know the
> following things:

> then I run the lme

> fm<- lme(y ~ 1, data=gx,
> random=list(dummy=pdBlocked(list(pdIdent(~Sample-1),
> pdIdent(~Operator-1),
> pdIdent(~Operator:Run-1)))))

> vc <- VarCorr(fm)
> Variance StdDev
> Operator:Run 1.595713e-10:20 1.263215e-05:20
> Sample 5.035235e+00: 4 2.243933e+00: 4
> Operator 5.483145e-04: 4 2.341612e-02: 4
> Residuals 8.543601e-02: 1 2.922944e-01: 1

> fm <- lmer(y ~ (1 | Sample) + (1 | Operator) +
> (1|Operator:Run), data=x)

That model specification can now be written as

fm <- lmer(y ~ (1|Sample) + (1|Operator/Run), x)

> summary(fm)

> Linear mixed-effects model fit by REML
> Formula: H.I.Index ~ (1 | Sample.Name) + (1 | Operator) + (1 |
> Operator:Run)
> Data: x
> AIC BIC logLik MLdeviance REMLdeviance
> 96.73522 109.0108 -44.36761 90.80064 88.73522
> Random effects:
> Groups Name Variance Std.Dev.
> Operator:Run (Intercept) 4.2718e-11 6.5359e-06
> Operator (Intercept) 5.4821e-04 2.3414e-02
> Sample (Intercept) 5.0352e+00 2.2439e+00
> Residual 8.5436e-02 2.9229e-01
> number of obs: 159, groups: Operator:Run, 20; Operator, 4;
> Sample.Name,
> 4

> Fixed effects:
> Estimate Std. Error t value
> (Intercept) 0.0020818 1.1222683 0.001855

It's just a matter of round-off. It is possible for the ML or REML estimates of a variance component to be zero, as is the case here, but the current computational methods do not allow the value zero because this will cause some of the matrix decompositions to fail. In lmer we use a constrained optimization with the relative variance (variance of a random effect divided by the residual variance) constrained to be greater than or equal to 5e-10, which is exactly the value you have here.

I'll add code to the model fitting routine to warn the user when convergence to the boundary value occurs. I haven't done that in the past because it is not always easy to explain what is occurring. For a model with variance components only, like yours, convergence on the boundary means that an estimated variance component is zero. In the case of bivariate or multivariate random effects the variance-covariance matrix can be singular without either of the variances being zero.

The bottom line for you is that the estimated variance for Operator:Run is zero and you should reduce the model to y ~ (1|Sample) + (1|Operator)

I cannot find where the problem is. Could anyone point me
> out if my model specification is correct for the problem I am dealing
> with. I am pretty new user to lme and lmer. Thanks for your help!

```>
>
>
>
>
```

> Wilson Wang
```>
>
>
>
>
>

>         [[alternative HTML version deleted]]

>

> ______________________________________________

```
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.
>

R-help@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 and provide commented, minimal, self-contained, reproducible code. Received on Tue Aug 01 08:43:54 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 01 Aug 2006 - 10:18:25 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.