mean and variance of random effects in glmer
Don't assume that there is not quasi-separation, but rather check it to be sure that it is not there. I'm pretty sure that it is a case of complete separation. Deal with that first. ________________________________________ Van: Ken Kelley [kkelley at nd.edu] Verzonden: dinsdag 24 juli 2012 20:38 Aan: ONKELINX, Thierry CC: r-sig-mixed-models at r-project.org Onderwerp: Re: mean and variance of random effects in glmer Hi Thierry, Thanks for your thoughts on this. I hadn't considered quasi-separation, but I don't think that is it. Actually, the issue is that I slipped into thinking that the random effects were the conditional means (like in a linear mixed effects model). Rather, they are the conditional modes. Thus, the mean of the random effects need not be zero as I initially expected (and as would be the case in a linear mixed effects model). But, I still expected the variance of the random effects to match the output (it is 18.9 in the output yet 7.8 when I calculate it on the random effects directly). Best wishes, Ken
On Jul 24, 2012, at 5:23 AM, "ONKELINX, Thierry" <Thierry.ONKELINX at inbo.be> wrote:
Dear Ken, Very large variance for the random effect in a binomial glmer is an indication for (quasi-)complete separation. Here is some info on that issue: http://www.ats.ucla.edu/stat/mult_pkg/faq/general/complete_separation_logit_models.htm If the values of Problem and Across are constant within each level of PID, I would aggregate the data (sum per PID) and then use a simple glm() Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest, team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32 54 43 61 85 Thierry.Onkelinx at 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-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-bounces at r-project.org] Namens Ken Kelley Verzonden: dinsdag 24 juli 2012 8:29 Aan: r-sig-mixed-models at r-project.org Onderwerp: [R-sig-ME] mean and variance of random effects in glmer Hi everyone, I'm fitting a straightforward glmer model with the family=binomial. I expected the mean of the random effect for the intercept to be near zero, but that isn't the case, as the mean is .91:
(model.3 <- glmer(TA ~ 1 + Problem + Across + (1|PID), data=Data.Timed, family = binomial, nAGQ=100))
Generalized linear mixed model fit by the adaptive Gaussian Hermite approximation
Formula: TA ~ 1 + Problem + Across + (1 | PID)
Data: Data.Timed
AIC BIC logLik deviance
158.8 172.9 -75.38 150.8
Random effects:
Groups Name Variance Std.Dev.
PID (Intercept) 18.869 4.3439
Number of obs: 256, groups: PID, 64
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.1328 0.7304 -1.551 0.1209
Problem -0.5864 0.2449 -2.394 0.0167 *
Across -1.3768 0.4280 -3.217 0.0013 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) Problm
Problem -0.390
Across -0.208 -0.150
That is, I'm doing a mixed effects logistic regression. The PID is the participant ID; there are 4 Problems (essentially timepoints: 0, 1, 2, 3) and Across is a time-varying covariate (0, 1, 2, or 3).
The mean of the random effects is:
colMeans(ranef(model.3)$PID[])
(Intercept) 0.9137307 Additionally, the variance of the random effect is in the model output as 18.869, yet when I calculate the variance of the random effects directly, I get a much smaller value:
var(ranef(model.3)$PID[])
(Intercept)
(Intercept) 7.806402
Should I be surprised by either of the issues I note above? My concern is that I was planning on plotting the model implied curves using the fixed effects (so that the curves would represent an individual specific trajectory for a participant with a random effect of 0). Yet, there are no individuals with a random effect of zero and the mean is not zero. Thus, such a plot doesn't seem as useful as I initially thought it would.
Thanks for any thoughts on this,
Ken
[[alternative HTML version deleted]]
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
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.
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * * 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.