[R-sig-ME] Plotting residuals for GLMER model and zero counts

Francesco fbromano at sabanciuniv.edu
Tue Nov 5 16:56:08 CET 2013



Dear R-ers,

although a number of options exist out there to plot logit models, I
can't seem
to find one that works for glmer. What I would like to do is, in light of
having found no interaction between the two fixed effects (which answers my
research question), look at a plot to tell how well the model fits the data.

The package LMERconveniencefunctions ver 2.0
has a nice plot for lmer but this won't work on my model because R
automatically
asks me to use glmer. It has a factor DV (Correct), two fixed factor IVs
(Group and Syntax),
and two random effect (ID and item).

Here's the output of calling:

model<- glmer(Correct ~ Group * Syntax + (Syntax + 1 | ID) + (Group + 1
| item), data=...., family=binomial)

#Generalized linear mixed model fit by maximum likelihood ['glmerMod']
Family: binomial ( logit )
Formula: Correct ~ Group * Syntax + (Syntax + 1 | ID) + (Group + 1 | item)
Data: .....

AIC BIC logLik deviance
235.4060 276.5207 -107.7030 215.4060

Random effects:
Groups Name Variance Std.Dev. Corr
ID (Intercept) 44.919 6.702
Syntaxof 45.850 6.771 -0.99
item (Intercept) 6.282 2.506
Groupns 38.105 6.173 -0.63
Number of obs: 451, groups: ID, 38; item, 16

Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -9.236 2.192 -4.214 2.51e-05
Groupns -2.815 4.743 -0.594 0.5528
Syntax of 5.546 2.458 2.256 0.0241
Groupns:Syntax of -1.457 6.405 -0.228 0.8200

(Intercept) ***
Groupns
Syntaxof *
Groupns:Syntaxof
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
(Intr) Gropns Syntxf
Groupns -0.499
Syntaxof -0.892 0.445
Grpns:Syntx 0.370 -0.741 -0.443

I have tried messing around with Mosaic but here I keep running into the
error
>Error: length(dim(observed)) == 2 is not TRUE

which I suspect is due to one cell in the 2x2x2 crosstab of results below being
lower than 2 (please correct me here if I'm mistaken):


Group Syntax Cor InC
nns	's 118 14
nns	of 128 19
ns	's 62 6
ns	of 53 1

I've tried using xtabs and formulae as the x argument for the mosaic function but neither seems to work.

On a side note, how do I cope with cases where participants produced 0 counts to a cell?
I understand Chi-square does not cope well with these. Should I leave them as is, or turn these
into NAs, or eliminate as outliers?

Thank you in advance for reading.

Francesco



More information about the R-sig-mixed-models mailing list