Learn R Programming

MuMIn (version 0.13.21)

QAIC: Quasi AIC(c))

Description

Calculates quasi AIC (or quasi AICc) for one or several fitted model objects. This function is provided mainly as an example of custom rank function for use with model.avg and dredge

Usage

QAIC(object, ..., chat)
QAICc(object, ..., chat)

Arguments

object
a fitted model object.
...
optionally more fitted model objects.
chat
c - hat

Value

  • If just one object is provided, returns a numeric value with the corresponding QAIC; if more than one object are provided, returns a data.frame with rows corresponding to the objects.

encoding

utf-8

See Also

AICc

quasi family used for models with over-dispersion. AIC, BIC in nlme (or BIC in stats4) may also be used as a custom rank function in dredge and model.avg.

Examples

Run this code
# Based on "example(predict.glm)"
require(graphics)

budworm <- data.frame(ldose = rep(0:5, 2), numdead = c(1, 4, 9, 13, 18, 20, 0,
	2, 6, 10, 12, 16), sex = factor(rep(c("M", "F"), c(6, 6))))
budworm$SF = cbind(numdead = budworm$numdead, numalive = 20 - budworm$numdead)

budworm.lg <- glm(SF ~ sex*ldose, data = budworm, family = quasibinomial)

plot(c(1,32), c(0,1), type = "n", xlab = "dose",
     ylab = "prob", log = "x")
text(2^budworm$ldose, budworm$numdead/20, as.character(budworm$sex))
ld <- seq(0, 5, 0.1)
lines(2^ld, predict(budworm.lg, data.frame(ldose=ld,
   sex=factor(rep("M", length(ld)), levels=levels(budworm$sex))),
   type = "response"))
lines(2^ld, predict(budworm.lg, data.frame(ldose=ld,
   sex=factor(rep("F", length(ld)), levels=levels(budworm$sex))),
   type = "response"))


dd <- dredge(budworm.lg, rank = "QAIC",
	chat = summary(budworm.lg)$dispersion)
mod <- get.models(dd, seq(nrow(dd)))
budworm.avg <- model.avg(mod)
model.avg(mod[[1]], mod[[2]], rank = "QAIC", rank.args = list(chat = 1))

linkinv <- quasibinomial()$linkinv
lines(2^ld, linkinv(predict(budworm.avg, data.frame(ldose=ld,
   sex=factor(rep("M", length(ld)), levels=levels(budworm$sex))))), col=2)
lines(2^ld, linkinv(predict(budworm.avg, data.frame(ldose=ld,
   sex=factor(rep("F", length(ld)), levels=levels(budworm$sex))))), col=2)
legend("bottomright", legend=c("full", "averaged"), title="Model",
	   col=1:2, lty=1)

Run the code above in your browser using DataLab