I have two responses which conform to beta
(also known as betar
) and Poisson
families, and I am looking into fitting additive mixed-models with beta
and quasi-families (count data is over-dispersed), respectively.
I am aware that I could use gamm
function from mgcv
package which accepts both beta
and quassi-families, however I am considering that it uses PQL, and the AIC
reported is not useful for comparing models - which is the primary objective of my analyses.
In the case of the count response, I am aware that QAIC
has been used for ranking/comparing overdispersed mixed models but I cannot find anything that says this it is appropriate for overdispersed GAMM.
I understand these are potentially two questions in one but they both have a common theme of model selection with extended families and potentially have different solutions. Below I provide reproducible examples for each case.
##generate data
library(gamm4)
library(mgcv)
dat <- gamSim(1,n=400,scale=2)
dat<-subset(dat, select=c(x0,x1,x2,x3,f) )
dat$g <- as.factor(sample(1:20,400,replace=TRUE))#random factor
dat$yb<-runif(400)#yb ranges between 0-1 hence fitted with beta family
dat$f <- dat$f + model.matrix(~ g-1)%*%rnorm(20)*2
dat$yp <- rpois(400,exp(dat$f/7))#y2 is counts hence poisson family
#beta family example with gamm function (this works - however not sure if the subsequent model comparisons are valid!)
m1b<- gamm(yb~s(x0)+s(x1)+s(x2)+s(x3),family=betar(link='logit'),data=dat,random=list(g=~1))
m2b<-gamm(yb~s(x1)+s(x2)+s(x3),family=betar(link='logit'),data=dat,random=list(g=~1))
m3b<-gamm(yb~s(x0)+s(x2)+s(x3),family=betar(link='logit'),data=dat,random=list(g=~1))
#AIC to compare models
AIC(m1b,m2b,m3b)
#try the same using gamm4 (ideally)- it obviously fails with beta family.
m<-gamm4(yb~s(x0)+s(x1)+s(x2)+s(x3),family=betar(link='logit'),data=dat,random = ~ (1|g))
##Example with quassi family - yp response is overdispersed count data (may not be overdispered in this example
#example using gamm function
m1p<-gamm(yp~s(x0)+s(x1)+s(x2)+s(x3),family = quasipoisson,data=dat,random=list(g=~1))
m2p<-gamm(yp~s(x1)+s(x2)+s(x3),family = quasipoisson,data=dat,random=list(g=~1))
m3p<-gamm(yp~s(x0)+s(x2)+s(x3),family = quasipoisson,data=dat,random=list(g=~1))
#AIC to compare models
AIC(m1p,m2p,m3p)
#again the example with using gamm4 function will not work as it doesnt accept quassi falimies
m<-gamm4(yp~s(x0)+s(x1)+s(x2)+s(x3),family = quasipoisson,data=dat,random = ~ (1|g))