[R] problem with weights on lmer function

Douglas Bates bates at stat.wisc.edu
Sat Feb 24 14:46:09 CET 2007


On 2/23/07, Ronaldo Reis Junior <chrysopa at gmail.com> wrote:
> Em Quinta 22 Fevereiro 2007 20:36, Andrew Robinson escreveu:
> > Hi Ronaldo,
> >
> > I suggest that you send us a small, well-documented, code example that
> > we can reproduce.  It certainly looks as though there is a problem,
> > but given this information it's hard to know what it is!
> >
> > Cheers
> >
> > Andrew
>
> Andrew and all R users.
>
> Look this example:
>
> test<-structure(list(subject = structure(c(1, 1, 1, 1, 1, 1, 1, 1,
> 2, 2, 2, 2, 2, 2, 2, 2), .Label = c("S1", "S2"), class = "factor"),
>     time = c(0, 7, 15, 22, 32, 39, 46, 53, 0, 7, 14, 24, 28,
>     34, 41, 48), noccup = c(0, 1, 2, 1, 6, 4, 3, 3, 0, 18,
>     21, 14, 7, 14, 12, 8), ntotal = c(100, 100, 100, 100, 100,
>     100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100)), .Names =
> c("subject",
> "time", "noccup", "ntotal"), class = "data.frame", row.names = c("1",
> "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
> "14", "15", "16"))
>
> I have 2 subject over 8 times. Each subject is compound by 100 pieces. I
> measure the number of piece occuped in any time.
>
> I try this:
>
> m1<-lmer(noccup/ntotal~time+(time|subject),family=binomial,weights=ntotal)
> Error in lmer(noccup/ntotal ~ time + (time | subject), family = binomial,  :
>         object `weights' of incorrect type
>
> I dont understand why this error.
>
> m1<-lmer(noccup/ntotal~1+(time|subject),family=binomial,weights=ntotal)
> Error in lmer(noccup/ntotal ~ time + (time | subject), family = binomial,  :
>         object `weights' of incorrect type
>
> Why weights is of incorrect type? In glm this is correct type.

I don't get such an error using lme4 0.9975-10 under R-2.4.1 on
i386-apple-darwin8.8.1

Of course the model fit is singular because you are attempting to
estimate 3 variance-covariance components from 2 groups.



More information about the R-help mailing list