[R-sig-ME] Fwd: glmer won't allow quasi- distribution mixed models
Luke Duncan
luke@m@ng@li@o@dunc@n @ending from gm@il@com
Mon Jul 9 17:13:27 CEST 2018
Dear R folk
I am trying to run a series of models on distance data for three different
species of animals. My data are not zero-inflated (distances were recorded
for locomotion only and so if the animal didn't move, it wasn't recorded)
and are Poisson distributed. However, all of the models that I run are
horrifically over-dispersed and based on what I read online I thought that
maybe I should consider using a quasi-Poisson distribution to attempt to
account for the over-dispersion. All the online posts of others show that
they do so successfully but for some reason, my lme4 package cannot use
quasi-distributions. I have uninstalled and reinstalled R and the packages
and I still get the same problem.
I am
a) at a loss as to how to deal with the over-dispersion I have and
b) baffled by the fact that lme4 everywhere else can cope with
quasi-distributions but mine can't.
Any help would be appreciated!
My code:
library(lme4)
woodlicedata<-read.csv("Woodlice.csv",header=T)
attach(woodlicedata)
names(woodlicedata)
> ### This set of models examine whether there are differences in distances
travelled.
>
distmodel<-glmer(Distance~Treatment*Sex+(1|ID)+(1|Path.set/ID),family=poisson(link='log'))
> summary(distmodel) ### AIC= 42972.6
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [
glmerMod]
Family: poisson ( log )
Formula: Distance ~ Treatment * Sex + (1 | ID) + (1 | Path.set/ID)
AIC BIC logLik deviance df.resid
42972.6 43007.3 -21479.3 42958.6 1038
Scaled residuals:
Min 1Q Median 3Q Max
-11.853 -4.074 -1.656 2.146 38.035
Random effects:
Groups Name Variance Std.Dev.
ID:Path.set (Intercept) 6.485e-02 0.2546560
ID (Intercept) 6.906e-02 0.2627973
Path.set (Intercept) 1.368e-10 0.0000117
Number of obs: 1045, groups: ID:Path.set, 104; ID, 52; Path.set, 2
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 4.20814 0.07757 54.248 < 2e-16 ***
TreatmentRestricted 0.10843 0.14359 0.755 0.45015
SexMale -0.08408 0.11545 -0.728 0.46644
TreatmentRestricted:SexMale -0.49300 0.18781 -2.625 0.00866 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) TrtmnR SexMal
TrtmntRstrc -0.540
SexMale -0.672 0.363
TrtmntRs:SM 0.413 -0.765 -0.615
>
distmodel2<-glmer(Distance~Treatment*Sex+(1|ID)+(1|Path.set/ID),family=quasipoisson(link='log'))
Error in lme4::glFormula(formula = Distance ~ Treatment * Sex + (1 | ID) +
:
"quasi" families cannot be used in glmer
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list