[R] Mixed effects model with binomial errors - problem

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Fri Sep 19 10:15:45 CEST 2008


First of all I'm forwarding this mail to the R-SIG-mixed-models, which
is more appropriate to your question.

Remember that family = bionomial uses by default the logit link. Hence
all parameters will be on the logit scale. So you will need to
backtransform them for comparison. Then you'll see that the parameters
are much closer to the averages. They still differ, but that is due to
the difference in model. Your averages are essentially something like
summary(model1<-glm(cbind(VisitsExpTree,TotalVisits-VisitsExpTree)~
treatment +(1|Individual), family=binomial, data=r))

> library(boot)
> intercept <- 0.37228
> treatmentb <- 0.03367
> treatmentc <- -0.60606
> treatmentd <- -0.25504
> inv.logit(intercept)
[1] 0.5920098
> inv.logit(intercept + treatmentb)
[1] 0.6001164
> inv.logit(intercept + treatmentc)
[1] 0.4418197
> inv.logit(intercept + treatmentd)
[1] 0.5292765

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens RFTW
Verzonden: vrijdag 19 september 2008 8:16
Aan: r-help op r-project.org
Onderwerp: 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.2    232.3
> Random effects:
>  Groups    Name        Variance 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.37228    0.19031  1.9562  0.05044 . 
> treatmentb          0.03367    0.24520  0.1373  0.89079   
> treatmentc         -0.60606    0.23330 -2.5978  0.00938 **
> treatmentd         -0.25504    0.22790 -1.1191  0.26311   
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
> 
> Correlation of Fixed Effects:
>     (Intr) T2b    T2c   
> 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-errors----proble
m-tp19413327p19566778.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help op 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.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in  this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.



More information about the R-help mailing list