[R-sig-ME] How to estimate the standard error of every single random intercept in a mixed linear model?
Phillip Alday
Phillip.Alday at unisa.edu.au
Fri Nov 11 00:48:49 CET 2016
(Try to keep the list in CC.)
See ?lme4::ranef
And take a look at the lme4 source code for ranef() and condVar(), as
well as the papers / manuscripts included with the lme4 package:
vignette("lmer",package="lme4")
vignette("Theory",package="lme4")
Maybe one of the lme4 developers could contribute an answer faster than
I can go through the math / source again?
Best,
Phillip
On Mon, 2016-11-07 at 20:58 +0000, Chen Chun wrote:
> Dear Phillip,
>
> Thanks for the reply. yes, se,ranef directly calculates the square
> root of the posterior variance.
>
>
> attr(ranef(fit, condVar = TRUE)[[1]], "postVar")
>
> Do you know how the posterior variance for each level of the random
> factor is computed?
>
> Thanks
>
> Regards,
> Chen
>
> 发件人: Phillip Alday <Phillip.Alday at unisa.edu.au>
> 发送时间: 2016年11月4日 5:29
> 收件人: Chen Chun
> 抄送: r-sig-mixed-models at r-project.org
> 主题: Re: [R-sig-ME] How to estimate the standard error of every single
> random intercept in a mixed linear model?
>
> Dear Chen,
>
> have you tried entering the following in the R command line?
>
> > library(arm)
> > se.ranef
>
> That will output the source code for arm::se.ranef. It's surprisingly
> simple and is basically the square root of the diagonal of variance-
> covariance RE matrix.
>
> Best,
> Phillip
>
>
> > On 24 Oct 2016, at 20:38, Chen Chun <talischen at hotmail.com> wrote:
> >
> > Dear all,
> >
> >
> > I am running a mixed linear model with group (a_i) as random
> intercept:
> >
> >
> > y_ij=mu + a_i + e_ij
> >
> >
> > By using lmer() function, the model outputs an estimated variance
> of a_i (i.e. var_hat(a)), and it is the sum of (1) the variance of
> the estimated group mean (i.e. between group variance) and (2) the
> sum of variance for each estimated group mean a_i_hat, (i.e. sum of
> within group variance).
> >
> >
> > for (1) I can compute it as var(ranef(model)$group). However, I
> dont know how to compute (2), which is the SE of the estimated random
> intercept for each group. I know that using se.ranef() function in
> arm package can help me to extract such variance. But I would like to
> know how these variance are computed? it's relations to residuals and
> number of observations per group?
> >
> >
> > Thanks
> >
> >
> > Chen
> >
> >
> > [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-mixed-models at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
> R-sig-mixed-models Info Page - ETH Zurich stat.ethz.ch
> R-sig-mixed-models -- R special interest group on Mixed Effect
> Models, notably lmer() related About R-sig-mixed-models
>
>
>
More information about the R-sig-mixed-models
mailing list