[R-sig-ME] extract level 2 residuals of merMod from lme() and test for spatial autocorrelation.

Dexter Locke dexter.locke at gmail.com
Thu May 5 20:20:10 CEST 2016

Apologies for cross-posting, another version of this was posted on
r-sig-geo at r-project.org

I want to extract the level 2 residuals from a merMod object created with
lme() and am struggling. How can I pull out a vector that is the residuals
at level 2? Everything I see on stack exchange and the mixed models list
serve points towards methods like VarCorr(). I'm not interested in a
summary of the L2 residuals so much as a vector of the same length as the
number of groups I have. Ultimately I want to test them for spatial
autocorrelation. Apologies if this is documented somewhere, but I have not
been able to find help online.

While I have found methods of incorporating spatial effects into a mixed
model using corStruct, I am interested in first evaluating if that is an
appropriate model for a given dataset by examining the level 2 residuals'
spatial patterning - or lack thereof.

Which slot contains the residuals for level 2 and how are they ordered?

Thanks again for a great package.


	[[alternative HTML version deleted]]

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