[R-lang] questions re: generalized linear mixed-effects modelling

Roger Levy rlevy at ucsd.edu
Mon Jul 30 17:51:42 PDT 2007


Rachel Smith wrote:
> Dear All,
> 
> I am an unsophisticated R user just beginning to use generalized linear
> mixed-effects modelling.
> I wonder if anyone can help me with a couple of questions:
> 
> 1) I'm using the following code:
>> early.glmm = lmer(bup ~ train + fam + allo + sengrp + subgrp + train:fam +
> (1|sub) + (1|sen), data=dat.early, family="binomial")
>> print(early.glmm, corr=FALSE)
> 
> This gives me estimates, z-scores and p values for the fixed effects, e.g.:
> #Fixed effects:
> #             Estimate Std. Error z value Pr(>|z|)
> #(Intercept)  -1.55152    0.60721  -2.555  0.01061
> #train0       -0.94079    0.29593  -3.179  0.00148
> #train6       -0.21783    0.27753  -0.785  0.43252
> #train12      -0.67147    0.28260  -2.376  0.01750
> #famU         -1.47283    0.52289  -2.817  0.00485
> #alloMis       0.26959    0.13095   2.059  0.03952
> #sengrpd      -1.03809    0.65300  -1.590  0.11190
> #sengrps      -1.83014    0.69729  -2.625  0.00867
> #sengrpt       0.37461    0.63814   0.587  0.55718
> #subgrpb       0.79949    0.51828   1.543  0.12293
> #subgrpc      -0.59432    0.28730  -2.069  0.03858
> #subgrpd       0.76644    0.51872   1.478  0.13953
> #train0:famU   0.82564    0.38161   2.164  0.03050
> #train6:famU   0.24475    0.36384   0.673  0.50115
> #train12:famU  0.03477    0.38802   0.090  0.92860
> 
> What it doesn't provide is an overall chi-squared and p for main effects and
> the interaction. Is it possible to obtain these?

Dear Rachel,

Do you mean you're interested in doing model comparisons between models 
with/without (a) the train:fam interaction, and (b) the train and fam 
main effects?

If so, you want to train five models:

early.glmm0 = lmer(bup ~ train + fam + allo + sengrp + subgrp + 
train:fam + (1|sub) + (1|sen), data=dat.early, family="binomial")

early.glmm1 = lmer(bup ~ train + fam + allo + sengrp + subgrp + (1|sub) 
+ (1|sen), data=dat.early, family="binomial")

early.glmm2 = lmer(bup ~ train + allo + sengrp + subgrp + (1|sub) + 
(1|sen), data=dat.early, family="binomial")

early.glmm3 = lmer(bup ~ fam + allo + sengrp + subgrp + (1|sub) + 
(1|sen), data=dat.early, family="binomial")

early.glmm4 = lmer(bup ~ allo + sengrp + subgrp + (1|sub) + (1|sen), 
data=dat.early, family="binomial")

and do pairwise model comparisons between them.  The models are nested, 
so that

   0 > 1 > {2,3} > 4

These pairwise comparisons can be carried out using the anova() function 
(e.g., anova(early.glmm0, early.glmm1)).  I am not sure, however, 
whether the chi-squared statistic returned is completely reliable for 
mixed-effects logistic regression.  If someone else can say something 
more definitive on this front, please speak up!

> 
> 2) If I experiment with a more complex random effects structure than in the
> above (e.g. (1+fam|sub)), I get complaints about convergence. Likewise, if I
> try to include covariates as well as factors. Does anyone know why this
> might be?

Take a look at Florian's and my recent replies to Francisco Torreira's 
message:

https://ling.ucsd.edu/pipermail/r-lang/2007-July/000048.html
https://ling.ucsd.edu/pipermail/r-lang/2007-July/000049.html

You want to look closely at the estimated variances and covariances 
returned by lmer; also try forcing a decorrelation with

   (1|sub) + (0 + fam|sub)

Let us know how it comes out!

Best

Roger

-- 

Roger Levy                      Email: rlevy at ucsd.edu
Assistant Professor             Phone: 858-534-7219
Department of Linguistics       Fax:   858-534-4789
UC San Diego                    Web:   http://ling.ucsd.edu/~rlevy


More information about the R-lang mailing list