[R-sig-ME] syntax for nested random factors in lme

Kathleen Côté kathleen.cote at gmail.com
Tue Feb 9 00:00:36 CET 2016


I've been taught that if I want to nest random factor A into B in an lme
model, the syntax is as follows: lme(y~x+B,random=~1|B/A). This seems to be
confirmed by the information contained in the Introduction to R manual
found here: https://cran.r-project.org/doc/manuals/R-intro.pdf.

In the case of my data, matters seem to be complicated by the fact that B
is a categorical variable with only 2 levels. When I run the lme with the
above syntax, I obtain an NaN p value for B as a fixed factor in the
model. When
I rewrite the random factor as random=~1|A/B, I obtain a p value.

Is the correct format for a nested random factor indeed B/A in this case
(i.e. nesting A into B)? Is it incorrect to write it as A/B?

Additionally, some sources of information I've come across suggest that
having B as a stand-alone fixed factor as well as part of a random factor
is nonsensical. Other people have suggested that it's acceptable as long as
that same factor is part of a nested random factor and not as a stand-alone
random factor, e.g. as I have it in my model, lme(y~x+B,random=~1|B/A). Are
you able to comment on this or confirm whether my model is acceptable?

Thank you,

	[[alternative HTML version deleted]]

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