You should post this on the r-sig-mixed-models list. You are more likely to get a helpful response there.
Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Feb 20, 2018 at 8:06 PM, suraj keshri <surajkes...@gmail.com> wrote: > I want to fit a random effects model with two separate nested random > effects. I can easily do this using the `lmer` package in R. Here's how: > > model<-lmer(y ~ 1 + x + (1 | oid/gid) + (1 | did/gid), data=data) > > Here, I'm fitting a random intercept for `oid` nested within `gid` and > `did` nested within `gid`. This works well. However, I want to fit a model > where the variance of the intercept changes with the `gid` for both the > random effects. `nlme` package is capable of doing that. However, it's not > clear how. The best I could do is like so: > > model <- lme(y ~ 1 + x, random=list(gid=~1, oid=~1, did=~1), > weights=varIdent(form=~1|gid), data = data) > > but this nests the `did` within `oid` and `gid` nested together. I tried to > use the idea from a similar [question][1], which seems like a close problem > but the answer has not been explained well in that question. I hope someone > can figure this out. > > > [1]: > https://stats.stackexchange.com/questions/58669/ > specifying-multiple-separate-random-effects-in-lme > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.