[R] lmer random effect model matrix question

Douglas Bates dmbates at gmail.com
Thu Sep 29 21:37:35 CEST 2005


I would create two 0/1 variables for sor level 1 and sor level 2 and
use those as in

> mark$sor1 <- ifelse(mark$sor == 1, 1, 0)
> mark$sor2 <- ifelse(mark$sor == 2, 1, 0)
> (fm1 <- lmer(y ~ sor + (0+sor1|lot) + (0+sor2|lot) + (1|wafer:lot), mark))
Linear mixed-effects model fit by REML
Formula: y ~ sor + (0 + sor1 | lot) + (0 + sor2 | lot) + (1 | wafer:lot)
   Data: mark
      AIC      BIC    logLik MLdeviance REMLdeviance
 455.7631 469.4231 -221.8816   453.5174     443.7631
Random effects:
 Groups    Name        Variance Std.Dev.
 wafer:lot (Intercept)  35.866   5.9888
 lot       sor2        222.709  14.9234
 lot       sor1         17.076   4.1323
 Residual               12.569   3.5453
# of obs: 72, groups: wafer:lot, 24; lot, 8; lot, 8

Fixed effects:
             Estimate Std. Error DF  t value Pr(>|t|)
(Intercept) 1995.1111     2.7581 70 723.3703   <2e-16 ***
sor2          10.0833     8.1622 70   1.2354   0.2208
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


On 9/29/05, Mark Lyman <mlyman at byu.edu> wrote:
> I have one fixed effect, sor, with two levels. I have eight lots and
> three wafers from each lot. I have included the data below.
>
> I would like to fit a mixed model that estimates a covariance parameter
> for wafer, which is nested in lot, and two covariance parameters for
> lot, one for each level of sor. The following command fits the model
> that I want, except for it estimates the correlation between the two
> covariance parameters for lot. Is there anyway to make R not estimate
> this correlation? Thank you.
>
> lmer(y~sor+(sor-1|lot)+(1|wafer:lot),wafer)
>
> For those familiar with proc mixed the following SAS code fits the model
> that I want:
>
> proc mixed scoring=4;
>    class sor lot wafer site;
>    model y= sor/ddfm=satterth;
>    random lot(sor)/group=sor;
>    random wafer(lot);
> run;
>
>    sor lot wafer site    y
> 1    1   1     1    1 2006
> 2    1   1     1    2 1999
> 3    1   1     1    3 2007
> 4    1   1     2    1 1980
> 5    1   1     2    2 1988
> 6    1   1     2    3 1982
> 7    1   1     3    1 2000
> 8    1   1     3    2 1998
> 9    1   1     3    3 2007
> 10   1   2     1    1 1991
> 11   1   2     1    2 1990
> 12   1   2     1    3 1988
> 13   1   2     2    1 1987
> 14   1   2     2    2 1989
> 15   1   2     2    3 1988
> 16   1   2     3    1 1985
> 17   1   2     3    2 1983
> 18   1   2     3    3 1989
> 19   1   3     1    1 2000
> 20   1   3     1    2 2004
> 21   1   3     1    3 2004
> 22   1   3     2    1 2001
> 23   1   3     2    2 1996
> 24   1   3     2    3 2004
> 25   1   3     3    1 1999
> 26   1   3     3    2 2000
> 27   1   3     3    3 2002
> 28   1   4     1    1 1997
> 29   1   4     1    2 1994
> 30   1   4     1    3 1996
> 31   1   4     2    1 1996
> 32   1   4     2    2 2000
> 33   1   4     2    3 2002
> 34   1   4     3    1 1987
> 35   1   4     3    2 1990
> 36   1   4     3    3 1995
> 37   2   5     1    1 2013
> 38   2   5     1    2 2004
> 39   2   5     1    3 2009
> 40   2   5     2    1 2023
> 41   2   5     2    2 2018
> 42   2   5     2    3 2010
> 43   2   5     3    1 2020
> 44   2   5     3    2 2023
> 45   2   5     3    3 2015
> 46   2   6     1    1 2032
> 47   2   6     1    2 2036
> 48   2   6     1    3 2030
> 49   2   6     2    1 2018
> 50   2   6     2    2 2022
> 51   2   6     2    3 2026
> 52   2   6     3    1 2009
> 53   2   6     3    2 2010
> 54   2   6     3    3 2011
> 55   2   7     1    1 1984
> 56   2   7     1    2 1993
> 57   2   7     1    3 1993
> 58   2   7     2    1 1992
> 59   2   7     2    2 1992
> 60   2   7     2    3 1990
> 61   2   7     3    1 1996
> 62   2   7     3    2 1993
> 63   2   7     3    3 1987
> 64   2   8     1    1 1996
> 65   2   8     1    2 1989
> 66   2   8     1    3 1996
> 67   2   8     2    1 1997
> 68   2   8     2    2 1993
> 69   2   8     2    3 1996
> 70   2   8     3    1 1990
> 71   2   8     3    2 1989
> 72   2   8     3    3 1992
>
> ______________________________________________
> 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