[R] problem with weights on lmer function

Ronaldo Reis Junior chrysopa at gmail.com
Fri Feb 23 20:18:56 CET 2007


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.

Thanks
Ronaldo

-- 
The right half of the brain controls the left half of the body.  This
means that only left handed people are in their right mind.
--
> Prof. Ronaldo Reis Júnior
|  .''`. UNIMONTES/Depto. Biologia Geral/Lab. Ecologia Evolutiva
| : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8190 | ronaldo.reis em unimontes.br | chrysopa em gmail.com
| ICQ#: 5692561 | LinuxUser#: 205366



More information about the R-help mailing list