Re: [R] Meaning of /, :, and %in% in lmer

From: Douglas Bates <bates_at_stat.wisc.edu>
Date: Fri, 18 Apr 2008 07:11:57 -0500

On 4/16/08, Claus Wilke <cwilke_at_mail.utexas.edu> wrote:
> Hello,

> I asked this question a little while ago (
> https://stat.ethz.ch/pipermail/r-help/2008-April/158761.html ) but got no
> response. Can anybody explain to me the difference between /, :, and %in% in
> the definition of random effects in lmer, such as:
> (1|A/B), (1|A:B), (1|B %in% A)?

The first two, (1|A/B) and (1|A:B), are forms that lmer recognizes. I'm not sure what the effect of the third form, (1|B %in% A), would be and would not advise using it.

Most uses of the %in% operator in R at present are as a logical operator.

> My understanding is that (1|A/B) is the same as (1|A) + (1|A:B), but I have
> not seen this stated explicitly anywhere. And I don't understand why (1|A/B)
> seems to be different from (1|A) + (1|B %in% A), isn't that what %in% means?

The short answer is that (1|A/B) is expanded to (1|A) + (1|A:B) so you can choose whatever form makes sense to you.

There are different circumstances where a notation like (1|A/B) would be used. Some are reasonable choices and some are artifacts of artificial ways of assigning labels to factor levels. Rather than my trying to guess what kind of application you have in mind, could you describe a situation where you would want to fit an lmer model with terms like that?

I am cc:ing the R-SIG-Mixed-Models list on this reply and I suggest we move the discussion to that list.



R-help_at_r-project.org mailing list
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. Received on Fri 18 Apr 2008 - 13:07:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Apr 2008 - 13:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive