[R] problem with weights on lmer function

Andrew Robinson A.Robinson at ms.unimelb.edu.au
Sat Feb 24 21:30:36 CET 2007


Hi Ronaldo,

Thanks, that's helpful!  I also don't get an error.  Mind you, I added

data=test

to the model call.  This is my system:

> sessionInfo()
R version 2.4.1 Patched (2006-12-30 r40330) 
i386-unknown-freebsd6.1 

locale:
C

attached base packages:
[1] "stats"     "graphics"  "grDevices" "utils"     "datasets"
"methods"  
[7] "base"     

other attached packages:
       lme4      Matrix     lattice 
"0.9975-13" "0.9975-11"   "0.14-16" 


Cheers,

Andrew

On Sat, Feb 24, 2007 at 07:46:09AM -0600, Douglas Bates wrote:
> 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.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.

-- 
Andrew Robinson  
Department of Mathematics and Statistics            Tel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia         Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/



More information about the R-help mailing list