syntax for nested random effects using gamm or lme in R
问题 I would like to fit three random effects to a gamm in R, including one that is nested in another. For independent random effects, the gamm function in the mgcv package allows specification of the random effects using the list syntax from lme , i.e: model<- gamm(y~s(x), random = list(ran1=~1,ran2=~1), data=data) This works fine. However, I would like to have 'ran2' nested inside a third variable, 'ran3'. I can't seem to find any examples, for either gamm or lme that show how to nest random