[R-sig-ME] multiple random effects and correlation structure in nlme

Karl Jarvis karljarvis at gmail.com
Wed Nov 4 23:50:31 CET 2015


Hi all,
I am trying to build a model that includes two random effects while also using a correlation structure to account for spatial autocorrelation. It’s a full factorial study on simulations of wildlife where individuals are spread across landscapes, so one of the random effects (N) is crossed. 

If I use nlme I can do this by reusing creating a new group factor by pasting the three crossed factors together (would be land:barr:mort in lme4), which I call ‘lr'. The parameter estimates are similar, so it seems ok. (Link to the data frame: https://drive.google.com/open?id=0B096pYMrPnKAdC1FdWhCR3Z4bjg <https://drive.google.com/open?id=0B096pYMrPnKAdC1FdWhCR3Z4bjg> )
	ibr4 <- read.csv(“~/ibr4.csv”)
	m1 <- lme(A ~ barr + mort, random = list(~cost | land, ~N | lr), data=ibr4, method = “ML”)

Once I try to do that along with a correlation structure, it complains that there are incompatible formulas for ‘random’ and ‘correlation’. 
	m2 <- lme(A ~ barr + mort, random = list(~cost | land, ~N | lr), data=ibr4, method = “ML”,
	correlation = corExp(form = ~ x+y | lr))

I think it’s because it doesn’t know how to relate lr to land, because it complains the same way when the only random effect is '~cost | land’. However, when one random effect is in the model with a correlation structure nested as ~x+y | land/barr/mort, it does work. But it doesn’t seem to ever accept multiple random effects together with a correlation structure. I know Pinheiro and Bates say in their book (p.163) that you can build a crossed random-effects structure with pdBlocked and pdIdent, but (1) it’s not clear to me how to do this for a single random effect, and (2) it’s not clear to me that you could include multiple random effects in such a structure. Am I misunderstanding how correlation structures and/or random effects work? Let me know if you need more information about my data. 

Thanks,
Karl
	[[alternative HTML version deleted]]



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