Nested vs. Non-nested (crossed) Random Effects in R

[This article was first published on BioStatMatt » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The R script below illustrates the nested versus non-nested (crossed) random effects functionality in the R packates lme4 and nlme. Note that crossed random effects are difficult to specify in the nlme framework. Thus, I’ve included a back-of-the-envelope (literally a scanned image of my scribble) interpretation of the ‘trick’ to specifying crossed random effects for nlme functions (i.e., nlme and lme).

## This script illustrates the nested versus non-nested
## random effects functionality in the R packages lme4 (lmer)
## and nlme (lme).

library("lme4")
library("nlme")
data("Oxide")
Oxide 

The image below is my interpretation of the nlme (lme) trick for non-nested (crossed) random effects. The idea is to assign a random slope (no intercept) to each level of the grouping factors, which are each indexed by the levels of a dummy variable with that has exactly one level. The pdIdent function ensures that these random effects are uncorrelated and common variance. The pdBlocked function specifies that the random effects are also independent across the two grouping factors.

Doc - Jun 1, 2015, 1-13 PM

To leave a comment for the author, please follow the link and comment on their blog: BioStatMatt » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)