[R-sig-ME] [R] understanding I() in lmer formula
Don Cohen
don-r-help at isis.cs3-inc.com
Wed Jun 14 06:13:58 CEST 2017
> 1. Strip down the formula so that only the term that causes the
> error is present.
It's not clear what you mean by the term that causes the error.
Here's a different sort of minimal example:
full=lmer(log.corti~z.xtime+(1 +is.alpha2.subordinate+z.infanticide.susceptibility+z.min.co.res
+z.age.at.sample+sin.season+cos.season+ I(z.n.fert.females*z.n.males)||monkeyid),
data=fe.re.xx$data, REML=F, control=contr)
+ + Error in z.n.fert.females * ~z.n.males :
non-numeric argument to binary operator
It's minimal in that leaving out any one of the other terms in the || other
than the I term does not give an error, e.g.,
leave out is.alpha2.subordinate:
full=lmer(log.corti~z.xtime+(1 +z.infanticide.susceptibility+z.min.co.res
+z.age.at.sample+sin.season+cos.season+ I(z.n.fert.females*z.n.males)||monkeyid),
data=fe.re.xx$data, REML=F, control=contr)
+ + >
leave out z.infanticide.susceptibility
full=lmer(log.corti~z.xtime+(1 +is.alpha2.subordinate+z.min.co.res
+z.age.at.sample+sin.season+cos.season+ I(z.n.fert.females*z.n.males)||monkeyid),
data=fe.re.xx$data, REML=F, control=contr)
+ + >
etc.
> str(fe.re.xx$data)
yes, loads of stuff, but z.n.fert.females and z.n.males are both
numeric, as are is.alpha2.subordinate and z.min.co.res in the
previous examples. If this were the problem it wouldn't work when
I remove those other terms.
> 3. use ls() ...
none of the terms in the formula appear there
Again, it seems if this were the problem it wouldn't be solved by
removing other terms.
> 4. Start a new, **clean** R session
I did that, even started on a different machine, did a load to get
the data and library(lme4)
At this point I'd like to know how to interpret the error message:
Error in z.n.fert.females * ~z.n.males
non-numeric argument to binary operator
and what's that ~ all about?
More information about the R-sig-mixed-models
mailing list