> %in% doesn't generally mean 'nested in' in R. It is a set membership test
In a formula (involving a tilde) given to lm() or glm() %in% generally does mean nesting. > attr(terms(y ~ (x1+x2) %in% (x3+x4+x5)), "term.labels") [1] "x1:x3:x4:x5" "x2:x3:x4:x5" but the "|" operator stops terms() from interpreting the usual formula operators in the usual way > attr(terms(y ~ 1 | (x1+x2) %in% (x3+x4+x5)), "term.labels") [1] "1 | (x1 + x2) %in% (x3 + x4 + x5)" Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of S Ellison > Sent: Monday, August 05, 2013 4:55 AM > To: cbarl3y; r-help@r-project.org > Subject: Re: [R] Creating a model with fixed and random variables > > > Code I have used thus far without being able to replicate the > > data includes: > > > > Fm<-lmer(Score~(1|Line%in%Set)+Set+(1|Block)) > > (I figured out how to get a p-value, but it didn't yield the > > same results as those obtained in SAS) > > %in% doesn't generally mean 'nested in' in R. It is a set membership test and > will return > TRUE for those labels in Line that are also in Set and FALSE otherwise. > > Did you mean Score~(1|Set/Line)...? > > If you did, bear in mind that , combined with the fixed Set term, > (1|Set/Line) implies a > random Set grouping effect as well as a fixed effect - not sure that makes > sense in your > circumstance unless Set is a continuous predictor. May be safer to define > SetLine<- > interaction(Set, Line) and do > Score~Set + (1|SetLine) + (1|Block) > > S Ellison > > ******************************************************************* > This email and any attachments are confidential. Any use...{{dropped:8}} > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.