Re: [R] problem with weights on lmer function
On 2/23/07, Ronaldo Reis Junior [EMAIL PROTECTED] 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@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.
Re: [R] problem with weights on lmer function
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 [EMAIL PROTECTED] 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@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 StatisticsTel: +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/ __ R-help@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.
Re: [R] problem with weights on lmer function
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 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@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.
[R] problem with weights on lmer function
Hi, I try to make a model using lmer, but the weigths is not accept. m1-lmer(ocup/total~tempo+(tempo|estacao),family=binomial,weights=total) Erro em lmer(ocup/total ~ tempo + (tempo | estacao), family = binomial, : object `weights' of incorrect type I dont understand why this error, with glm this work. the total object is a vector. Any idea? Thanks Ronaldo -- God is subtle, but he is not malicious. -- Albert Einstein -- 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 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@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.
Re: [R] problem with weights on lmer function
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 On Thu, Feb 22, 2007 at 06:22:03PM -0200, Ronaldo Reis Junior wrote: Hi, I try to make a model using lmer, but the weigths is not accept. m1-lmer(ocup/total~tempo+(tempo|estacao),family=binomial,weights=total) Erro em lmer(ocup/total ~ tempo + (tempo | estacao), family = binomial, : object `weights' of incorrect type I dont understand why this error, with glm this work. the total object is a vector. Any idea? Thanks Ronaldo -- God is subtle, but he is not malicious. -- Albert Einstein -- 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 | [EMAIL PROTECTED] | [EMAIL PROTECTED] | ICQ#: 5692561 | LinuxUser#: 205366 __ R-help@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 StatisticsTel: +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/ __ R-help@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.