#Mazerolle (2006) frog water loss example
data(dry.frog)
#setup a subset of models of Table 1
Cand.models<-list()
Cand.models[[1]] <- lm(log_Mass_lost ~ Shade + Substrate +
cent_Initial_mass + Initial_mass2, data = dry.frog)
Cand.models[[2]] <- lm(log_Mass_lost ~ Shade + Substrate +
cent_Initial_mass + Initial_mass2 + Shade:Substrate, data = dry.frog)
Cand.models[[3]] <- lm(log_Mass_lost ~ cent_Initial_mass +
Initial_mass2, data = dry.frog)
Cand.models[[4]] <- lm(log_Mass_lost ~ Shade + cent_Initial_mass +
Initial_mass2, data = dry.frog)
Cand.models[[5]] <- lm(log_Mass_lost ~ Substrate + cent_Initial_mass +
Initial_mass2, data = dry.frog)
#create a vector of names to trace back models in set
Modnames<-paste("mod", 1:length(Cand.models), sep="")
#generate AICc table
aictab(cand.set = Cand.models, modnames = Modnames, sort=TRUE)
#Burnham and Anderson (2002) flour beetle data
data(beetle)
#models as suggested by Burnham and Anderson p. 198
Cand.set <- list( )
Cand.set[[1]] <- glm(Mortality_rate ~ Dose, family =
binomial(link = "logit"), weights = Number_tested, data = beetle)
Cand.set[[2]] <- glm(Mortality_rate ~ Dose, family =
binomial(link = "probit"), weights = Number_tested, data = beetle)
Cand.set[[3]] <- glm(Mortality_rate ~ Dose, family =
binomial(link ="cloglog"), weights = Number_tested, data = beetle)
#check c-hat
c_hat(Cand.set[[1]])
c_hat(Cand.set[[2]])
c_hat(Cand.set[[3]])
#lowest value of c-hat < 1 for these non-nested models, thus use
#c.hat = 1
Modnames <- paste("Mod", 1:length(Cand.set), sep="")
aictab(cand.set = Cand.set, modnames = Modnames, second.ord = FALSE)
#note that delta AIC and Akaike weights are identical to Table 4.7
Run the code above in your browser using DataLab