Re: [R] Mixed effects model with binomial errors - problem
anyone? RFTW wrote: ok... the model now runs properly (say, without errors). Now about the result. These are the averages per treatments tapply(VecesArbolCo.VecesCo.C1,T2,mean) a b c d 0.49 0.56 0.45 0.58 I run this very simple model summary(model1-lmer(cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~ treatment +(1|Individual), family=binomial, data=r)) Generalized linear mixed model fit by the Laplace approximation Formula: cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~ treatment +(1|Individual) Data: r AIC BIC logLik deviance 242.3 255.9 -116.2232.3 Random effects: GroupsNameVariance Std.Dev. Individuo (Intercept) 0.14075 0.37517 Number of obs: 112, groups: Individuo, 37 Fixed effects: Estimate Std. Error z value Pr(|z|) (Intercept) 0.372280.19031 1.9562 0.05044 . treatmentb 0.033670.24520 0.1373 0.89079 treatmentc -0.606060.23330 -2.5978 0.00938 ** treatmentd -0.255040.22790 -1.1191 0.26311 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Correlation of Fixed Effects: (Intr) T2bT2c T2b -0.675 T2c -0.697 0.543 T2d -0.720 0.544 0.581 wouldnt we expect the intercept to be roughtly the mean of treatment a? and thus the estimate of treatmentb to be +0.07, c: -0.04 and d: +0.09 roughly? Is this model just completely not estimating well, or are the estimates not the 'real values'. I tried to get teh predict function to give me the 4 predicted values based on the model, but i havent succeeded in doing so. maybe someone can help me on that one too (predict(model1,type=response) doesnt work) thnx -- View this message in context: http://www.nabble.com/Mixed-effects-model-with-binomial-errorsproblem-tp19413327p19566778.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Mixed effects model with binomial errors - problem
ok... the model now runs properly (say, without errors). Now about the result. These are the averages per treatments tapply(VecesArbolCo.VecesCo.C1,T2,mean) a b c d 0.49 0.56 0.45 0.58 I run this very simple model summary(model1-lmer(cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~ treatment +(1|Individual), family=binomial, data=r)) Generalized linear mixed model fit by the Laplace approximation Formula: cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~ treatment +(1|Individual) Data: r AIC BIC logLik deviance 242.3 255.9 -116.2232.3 Random effects: GroupsNameVariance Std.Dev. Individuo (Intercept) 0.14075 0.37517 Number of obs: 112, groups: Individuo, 37 Fixed effects: Estimate Std. Error z value Pr(|z|) (Intercept) 0.372280.19031 1.9562 0.05044 . treatmentb 0.033670.24520 0.1373 0.89079 treatmentc -0.606060.23330 -2.5978 0.00938 ** treatmentd -0.255040.22790 -1.1191 0.26311 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Correlation of Fixed Effects: (Intr) T2bT2c T2b -0.675 T2c -0.697 0.543 T2d -0.720 0.544 0.581 wouldnt we expect the intercept to be roughtly the mean of treatment a? and thus the estimate of treatmentb to be +0.07, c: -0.04 and d: +0.09 roughly? Is this model just completely not estimating well, or are the estimates not the 'real values'. I tried to get teh predict function to give me the 4 predicted values based on the model, but i havent succeeded in doing so. maybe someone can help me on that one too (predict(model1,type=response) doesnt work) thnx -- View this message in context: http://www.nabble.com/Mixed-effects-model-with-binomial-errorsproblem-tp19413327p19436083.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Mixed effects model with binomial errors - problem
Hi, We released individual birds into a room with 2 trees. We counted the number of visits to each of the 2 tree. One of the trees is always a control tree and the other tree is either treatment 1, treatment 2 or treatment3 or treatment 4. Ind Treat ContrTree ExpTree Total visits 1 1 11 16 27 1 2 6 9 15 1 3 5 13 18 1 4 11 25 36 2 1 2 3 5 4 1 6 7 13 4 3 4 4 8 4 4 2 5 7 6 1 1 1 2 6 4 5 16 21 etc etc (as you see, not all treatments are included for all individuals) Our question is if the proportion of visits to the experimental tree, in relation to the total number of visits to both trees differs between treatments. We have made treatment and individual into a factor All individuals were subjected to a maximum of 4 treatments, so 'individual' is a random factor We came up with this model: model1-lmer(cbind(ExpTree,Total visits-ExpTree)~ Treat +(1|Ind),method=ML , family=binomial, data=r)) However, the error we get is this: Error in match.arg(method, c(Laplace, AGQ)) : 'arg' should be one of “Laplace”, “AGQ” HELP! -- View this message in context: http://www.nabble.com/Mixed-effects-model-with-binomial-errorsproblem-tp19413327p19413327.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Mixed effects model with binomial errors - problem
ok, the model does run now! but, dont i need the method=ML when i want to compare this model with a reduced model using anova(model1, model2)? The R-Book tells me that REML is not good for that (p.635) So, besides that... how do i now do a sort of posthoc test to see 1) estimates of all treatments and 2) which treatments are different from which. Luc. PS. the names are not the original names in the file Ben Bolker wrote: RFTW l.temarvelde at nioo.knaw.nl writes: Our question is if the proportion of visits to the experimental tree, in relation to the total number of visits to both trees differs between treatments. We have made treatment and individual into a factor All individuals were subjected to a maximum of 4 treatments, so 'individual' is a random factor We came up with this model: model1-lmer(cbind(ExpTree,Total visits-ExpTree)~ Treat +(1|Ind),method=ML , family=binomial, data=r)) why not leave out method=ML and see what happens? for the current iteration of lmer, REML is not a possibility in any case. The default Laplace method should work OK. I'd be slightly worried about your variable name with a space in it (`Total visits`) -- are you sure that is working as expected? For further questions along these lines I would suggest e-mailing [EMAIL PROTECTED] instead ... Ben Bolker __ R-help@r-project.org 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. -- View this message in context: http://www.nabble.com/Mixed-effects-model-with-binomial-errorsproblem-tp19413327p19414516.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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.