[R] package lme4

Douglas Bates bates at stat.wisc.edu
Tue Nov 3 20:00:06 CET 2009


On Tue, Nov 3, 2009 at 9:11 AM, wenjun zheng <wjzheng09 at gmail.com> wrote:
> May be I can calculate p value by t testing approximately:
>  1-qnorm(Variance/Std.Dev.)

That would be a z test, not a t test, wouldn't it?  And it would only
be meaningful if the distribution of the estimator is approximately
normal, which we know it definitely is not.  Estimates of variances
have distributions like a chi-square, not like a normal.  In
particular, the estimators are not symmetrically distributed about the
parameter value.

> But which function can help me to extract Variance and Std.Dev values from
> the results below:

The VarCorr extractor produces the estimates of the variance.  You
would have to write your own functions to determine an approximate
standard error of those estimates and I would not advise doing so.
Firstly, the code would be rather complicated and secondly the answer
would be of very limited usefulness, for the reasons discussed above.

>>print(fm2 <- lmer(Yield ~ 1 + (1|Stand) + (1|Variety) +
>> (1|Variety:Stand),Rice))
> Linear mixed model fit by REML
> Formula: Yield ~ 1 + (1 | Stand) + (1 | Variety) + (1 | Variety:Stand)
>    Data: Rice
>    AIC   BIC logLik deviance REMLdev
>  94.25 100.7 -42.12    85.33   84.25
> Random effects:
>  Groups        Name        Variance Std.Dev.
>  Variety:Stand (Intercept) 1.345679 1.16003
>  Variety       (Intercept) 0.024692 0.15714
>  Stand         (Intercept) 0.888888 0.94281
>  Residual                  0.666667 0.81650
> Number of obs: 27, groups: Variety:Stand, 9; Variety, 3; Stand, 3
> Fixed effects:
>             Estimate Std. Error t value
> (Intercept)   7.1852     0.6919   10.38
>
> 2009/11/2 Douglas Bates <bates at stat.wisc.edu>
>>
>> On Sun, Nov 1, 2009 at 9:01 AM, wenjun zheng <wjzheng09 at gmail.com> wrote:
>> > Hi R Users,
>> >     When I use package lme4 for mixed model analysis, I can't
>> > distinguish
>> > the significant and insignificant variables from all random independent
>> > variables.
>> >     Here is my data and result:
>> > Data:
>> >
>> >
>> >  Rice<-data.frame(Yield=c(8,7,4,9,7,6,9,8,8,8,7,5,9,9,5,7,7,8,8,8,4,8,6,4,8,8,9),
>> >                 Variety=rep(rep(c("A1","A2","A3"),each=3),3),
>> >                 Stand=rep(c("B1","B2","B3"),9),
>> >                 Block=rep(1:3,each=9))
>> >    Rice.lmer<-lmer(Yield ~ (1|Variety) + (1|Stand) + (1|Block) +
>> > (1|Variety:Stand), data = Rice)
>> >
>> > Result:
>> >
>> > Linear mixed model fit by REML
>> > Formula: Yield ~ (1 | Variety) + (1 | Stand) + (1 | Block) + (1 |
>> > Variety:Stand)
>> >   Data: Rice
>> >   AIC   BIC logLik deviance REMLdev
>> >  96.25 104.0 -42.12    85.33   84.25
>> > Random effects:
>> >  Groups        Name        Variance Std.Dev.
>> >  Variety:Stand (Intercept) 1.345679 1.16003
>> >  Block         (Intercept) 0.000000 0.00000
>> >  Stand         (Intercept) 0.888889 0.94281
>> >  Variety       (Intercept) 0.024691 0.15714
>> >  Residual                  0.666667 0.81650
>> > Number of obs: 27, groups: Variety:Stand, 9; Block, 3; Stand, 3;
>> > Variety, 3
>>
>> > Fixed effects:
>> >            Estimate Std. Error t value
>> > (Intercept)   7.1852     0.6919   10.38
>>
>> > Can you give me some advice for recognizing the significant variables
>> > among
>> > random effects above without other  calculating.
>>
>> Well, since the estimate of the variance due to Block is zero, that's
>> probably not one of the significant random effects.
>>
>> Why do you want to do this without other calculations?  In olden days
>> when each model fit involved substantial calculations by hand one did
>> try to avoid fitting multiple models but now that is not a problem.
>> You can get a hint of which random effects will be significant by
>> looking at their precision in a "caterpillar plot" and then fit the
>> reduced model and use anova to compare models.  See the enclosed
>>
>> >    Any suggestions will be appreciated.
>> > Wenjun
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help at r-project.org 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.
>> >
>
>




More information about the R-help mailing list