R AIC model selection table with glmer (package lme4)

6.6k views Asked by At

I'm trying to us package "AICcmodavg" to select among a group of candidate mixed models using function "glmer" with a binomial link function under package "lme4".However, when I attempt to run the "aictab" function on this list of models, I get this error message "Error in formatCands (cand.set):Functions do not support mixture of model classes". My code is posted below.

Table<- read.delim("C:/Analysis/Data Files/Text Files/QuadSEFull.txt",  header=TRUE)
Table<- subset(Table,Species!="None")

library("lme4", lib.loc="C:/Users/mcs7gb/Documents/R/win-library/3.0")
library("AICcmodavg",lib.loc="C:/Users/mcs7gb/Documents/R/win-library/3.0")

y<-cbind(Table$Visual,Table$Excavation)

mod<-list()

mod[[1]]<-glmer(y~(1|Species)+Discharge,family=binomial,data=Table)
mod[[2]]<-glmer(y~(1|Species)+Visibility,family=binomial,data=Table)
mod[[3]]<-glmer(y~(1|Species)+Depth,family=binomial,data=Table)
mod[[4]]<-glmer(y~(1|Species)+AvgDepth,family=binomial,data=Table)
mod[[5]]<-glmer(y~(1|Species)+MaxDepth,family=binomial,data=Table)
mod[[6]]<-glmer(y~(1|Species)+DomSub,family=binomial,data=Table)
mod[[7]]<-glmer(y~(1|Species)+SubDomSub,family=binomial,data=Table)
mod[[8]]<-glmer(y~(1|Species)+Embed,family=binomial,data=Table)
mod[[9]]<-glmer(y~(1|Species)+CoreArea,family=binomial,data=Table)
mod[[10]]<-glmer(y~(1|Species)+BedArea,family=binomial,data=Table)
mod[[12]]<-glmer(y~(1|Species)+Temp,family=binomial,data=Table)
mod[[14]]<-glmer(y~(1|Species)+Bottom_Velocity,family=binomial,data=Table)
mod[[15]]<-glmer(y~(1|Species)+AvgVelocity,family=binomial,data=Table)
mod[[17]]<-glmer(y~(1|Species)+Macrophytes,family=binomial,data=Table)
mod[[18]]<-glmer(y~(1|Species)+WoodyDebris,family=binomial,data=Table)
mod[[19]]<-glmer(y~(1|Species)+Stream,family=binomial,data=Table)
mod[[20]]<-glmer(y~(1|Species)+JulDate,family=binomial,data=Table)
mod[[21]]<-glmer(y~(1|Species)+Site,family=binomial,data=Table)
mod[[22]]<-glmer(y~(1|Species)+Discharge+Visibility+Depth+AvgDepth
      +MaxDepth+Table$DomSub+SubDomSub+Embed+CoreArea+BedArea
      +Temp+Bottom_Velocity+AvgVelocity+Table$Macrophytes+WoodyDebris
      +JulDate+Site+Stream,family=binomial,data=Table)
Modnames<- paste("mod", 1:length(mod), sep = " ")
z<-aictab(cand.set=mod,modnames=Modnames,second.ord=TRUE,nobs=NULL,sort=TRUE)
0

There are 0 answers