[R-sig-ME] [R] understanding I() in lmer formula
Ben Bolker
bbolker at gmail.com
Sat Jun 17 02:51:48 CEST 2017
On 17-06-14 11:41 AM, Dan Brooks wrote:
> Related to your second question about ||, I believe || is shorthand for
> uncorrelating the slope and intercept, e.g:
> fm3 <- lmer(Reaction~Days+(Days+0|Subject)+(1|Subject),data=sleepstudy)
> fm4 <- lmer(Reaction~Days+(1+Days||Subject),data=sleepstudy)
>
> As opposed to:
> fm2 <- lmer(Reaction~Days+(Days+1|Subject),data=sleepstudy)
> or simply:
> fm1 <- lmer(Reaction~Days+(Days|Subject),data=sleepstudy)
>
> Although happy to be corrected by Ben Bolker if there's more complex
> examples where this isn't quite right.
>
> Best-
> Dan
That's exactly right. Note that || does *not* work as expected/as one
might want it to when one or more of the terms to the left of the bars
is a factor.
cheers
Ben Bolker
>
> On Tue, Jun 13, 2017 at 4:42 PM, Andrew Robinson <mensurationist at gmail.com>
> wrote:
>
>> Don,
>>
>> can you provide a minimal executable example?
>>
>> Cheers,
>>
>> Andrew
>>
>> On 14 Jun 2017, 6:15 AM +1000, peter dalgaard <pdalgd at gmail.com>, wrote:
>>> Not that I really have a clue, but what is that "~" doing in the error
>> message??
>>>
>>> -pd
>>>
>>>> On 13 Jun 2017, at 21:20 , Don Cohen <don-r-help at isis.cs3-inc.com>
>> wrote:
>>>>
>>>> Bert Gunter suggested posting this here:
>>>>
>>>> Is there a difference between I(x*y) and I(y*x) ?
>>>> I have a call to lmer that results in this complaint:
>>>> Error in is.alpha2.subordinate * ~z.min.co.res :
>>>> non-numeric argument to binary operator
>>>> when I change this line:
>>>> I(is.alpha2.subordinate*z.min.co.res)+
>>>> to this:
>>>> I(z.min.co.res*is.alpha2.subordinate)+
>>>> the complaint goes away.
>>>> I'd like to understand why.
>>>>
>>>> _______________________________________________
>>>> R-sig-mixed-models at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>> --
>>> Peter Dalgaard, Professor,
>>> Center for Statistics, Copenhagen Business School
>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>> Phone: (+45)38153501
>>> Office: A 4.23
>>> Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
>>>
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
More information about the R-sig-mixed-models
mailing list