[R-sig-ME] getting between groups variance when using (1|x:y)in the formula

Ben Bolker bbolker at gmail.com
Fri Jun 1 13:53:41 CEST 2012


Hans Ekbrand <hans at ...> writes:

> 
> On 2012-05-31 17:35, Hans Ekbrand wrote:
> > Let's say I have a formula like this
> >
> > my.fit <- glmer(w ~ 1 + y + (1|x) + (1|x:y) + z)
> >
> > Then the summary() output gives information about variance and std.dev 
> > for the random term x:y
> >
> > and ranef(my.fit, postVar = TRUE) gives estimates and standard 
> > deviations for x and each value of x:y.
> >
> > Is there a way to get a single measure of the variance of y within x?
> 
> I meant to say "a singe measure of the variance of y within x, for each 
> level of y".
> 
   I don't think that's something that glmer() estimates -- it
assumes that the variance is equal for every y-within-x combination.
I suppose you could just compute the variance of each group of
conditional modes, i.e. if xyests are your x:y conditional modes
and xests are your x conditional modes then you could
tapply(xyests,list(xests),var) ...  someone may suggest something
better ...



More information about the R-sig-mixed-models mailing list