Skip to content
Prev 15087 / 20628 Next

GLMM for underdispersed count data: Conway-Maxwell-Poisson and Ordinal

Hi,

Thank you all very much your hints. They have been really really helpful 
for me. Below you may find a reproducible code to see how three 
approaches fit a simulated data set (clmm::ordinal, glmmTMB::glmmTMB, 
fitme:spaMM). Results seem to me qualitatively similar but with 
clmm:ordinal I cannot use the three crossed random effects because I get 
an error like this:

Error: no. random effects (=135) >= no. observations (=100)


set.seed(1234)
library(ordinal)
library(glmmTMB)
library(spaMM)
dati<- data.frame(fledges= rpois(100,10), habitatF= 
as.factor(rbinom(100,1,0.5)), areaPatchFath= rnorm(100), poligF01= 
as.factor(rbinom(100,1,0.5)),StdLayingDate= rnorm(100), ageFath1= 
rpois(100,3), ageMoth1= rpois(100,3), year= as.factor(rpois(100,200)), 
ringMoth= as.factor(rpois(100,200)), ringFath= as.factor(rpois(100,200)))
str(dati)

system.time(Fitclm<- clmm(as.factor(fledges) ~ 
habitatF*(areaPatchFath+poligF01+StdLayingDate+ageFath1+ageMoth1)+(1|year)+(1|ringMoth)+(1|ringFath),data=dati,Hess=T))
# this way it works...
system.time(Fitclm1<- clmm(as.factor(fledges) ~ 
habitatF*(areaPatchFath+poligF01+StdLayingDate+ageFath1+ageMoth1)+(1|year)+(1|ringFath),data=dati,Hess=T))
summary(Fitclm1)

system.time(FitglmmTMB<- glmmTMB(as.factor(fledges) ~ 
habitatF*(areaPatchFath+poligF01+StdLayingDate+ageFath1+ageMoth1)+(1|year)+(1|ringMoth)+(1|ringFath),data=dati,family= 
"compois"))
summary(FitglmmTMB)

system.time(FitglmmTMB<- glmmTMB(as.factor(fledges) ~ 
habitatF*(areaPatchFath+poligF01+StdLayingDate+ageFath1+ageMoth1)+(1|year)+(1|ringMoth)+(1|ringFath),data=dati,family= 
"compois"))
summary(FitglmmTMB)

# This lasts much more (3-4')
system.time(Fitfitme<- fitme(fledges ~ 
habitatF*(areaPatchFath+poligF01+StdLayingDate+ageFath1+ageMoth1)+(1|year)+(1|ringFath)+(1|ringMoth),data=dati,COMPoisson(),method 
= "ML"))
summary(Fitfitme)











El 08/12/2016 a las 4:32, Ben Bolker escribi?: