[R] syntax for nested random factors in lme

Thierry Onkelinx thierry.onkelinx at inbo.be
Tue Feb 9 09:23:15 CET 2016


Dear Kathleen,

R sig mixed models is more suited for questions on mixed models.

It doesn't make sense to add the main effect of B to both the fixed and the
random. Use me(x~y+B,random=~1|B:A) instead. 1|B:A is the interaction
between B and A. Since B is in the fixed effects, it is equivalent to A
nested in B.

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2016-02-08 19:41 GMT+01:00 Kathleen Côté <kathleen.cote op gmail.com>:

> Hi,
>
> 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(x~y+B,random=~1|B/A).
>
> 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?
> Is it incorrect to write it as A/B?
>
> Please let me know if you would like additional information, such as
> observations and output.
>
> Kathleen
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help op r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list