lizards | R Documentation |
This data set describes the habitat preference of two species of lizards, Anolis grahami and A. opalinus, on the island of Jamaica and is originally from Schoener (1970). McCullagh and Nelder (1989) and Burnham and Anderson (2002) reanalyzed the data. Note that a typo occurs in table 3.11 of Burnham and Anderson (2002).
data(lizards)
A data frame with 48 rows and 6 variables.
Insolation
position of perch, either shaded
or
sunny
.
Diameter
diameter of the perch, either < 2 in
or >= 2 in
.
Height
perch height, either < 5
or
>= 5
.
Time
time of day, either morning
,
midday
, or afternoon
.
Species
species observed, either grahami
or
opalinus
.
Counts
number of individuals observed.
Burnham and Anderson (2002, p. 137) use this data set originally from Schoener (1970) to illustrate model selection for log-linear models.
Burnham, K. P., Anderson, D. R. (2002) Model Selection and Multimodel Inference: a practical information-theoretic approach. Second edition. Springer: New York.
McCullagh, P., Nelder, J. A. (1989) Generalized Linear Models. Second edition. Chapman and Hall: New York.
Schoener, T. W. (1970) Nonsynchronous spatial overlap of lizards in patchy habitats. Ecology 51, 408–418.
data(lizards)
## Not run:
##log-linear model as in Burnham and Anderson 2002, p. 137
##main effects
m1 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species,
family = poisson, data = lizards)
##main effects and all second order interactions = base
m2 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species +
Insolation:Diameter + Insolation:Height + Insolation:Time +
Insolation:Species + Diameter:Height + Diameter:Time +
Diameter:Species + Height:Time + Height:Species +
Time:Species, family = poisson, data = lizards)
##base - DT
m3 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species +
Insolation:Diameter + Insolation:Height + Insolation:Time +
Insolation:Species + Diameter:Height + Diameter:Species +
Height:Time + Height:Species + Time:Species,
family = poisson, data = lizards)
##base + HDI + HDT + HDS
m4 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species +
Insolation:Diameter + Insolation:Height + Insolation:Time +
Insolation:Species + Diameter:Height + Diameter:Time +
Diameter:Species + Height:Time + Height:Species +
Time:Species + Height:Diameter:Insolation +
Height:Diameter:Time + Height:Diameter:Species,
family = poisson, data = lizards)
##base + HDI + HDS + HIT + HIS + HTS + ITS
m5 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species +
Insolation:Diameter + Insolation:Height + Insolation:Time +
Insolation:Species + Diameter:Height + Diameter:Time +
Diameter:Species + Height:Time + Height:Species +
Time:Species + Height:Diameter:Insolation +
Height:Diameter:Species + Height:Insolation:Time +
Height:Insolation:Species + Height:Time:Species +
Insolation:Time:Species, family = poisson, data = lizards)
##base + HIT + HIS + HTS + ITS
m6 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species +
Insolation:Diameter + Insolation:Height + Insolation:Time +
Insolation:Species + Diameter:Height + Diameter:Time +
Diameter:Species + Height:Time + Height:Species +
Time:Species + Height:Insolation:Time +
Height:Insolation:Species + Height:Time:Species +
Insolation:Time:Species, family = poisson, data = lizards)
##base + HIS + HTS + ITS
m7 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species +
Insolation:Diameter + Insolation:Height + Insolation:Time +
Insolation:Species + Diameter:Height + Diameter:Time +
Diameter:Species + Height:Time + Height:Species +
Time:Species + Height:Insolation:Species +
Height:Time:Species + Insolation:Time:Species,
family = poisson, data = lizards)
##base + HIT + HIS + HTS + ITS - DT
m8 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species +
Insolation:Diameter + Insolation:Height + Insolation:Time +
Insolation:Species + Diameter:Height + Diameter:Species +
Height:Time + Height:Species + Time:Species +
Height:Insolation:Time + Height:Insolation:Species +
Height:Time:Species + Insolation:Time:Species,
family = poisson, data = lizards)
##base + HIT + HIS + ITS - DT
m9 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species +
Insolation:Diameter + Insolation:Height + Insolation:Time +
Insolation:Species + Diameter:Height + Diameter:Species +
Height:Time + Height:Species + Time:Species +
Height:Insolation:Time + Height:Insolation:Species +
Insolation:Time:Species,
family = poisson, data = lizards)
##base + HIT + HIS - DT
m10 <- glm(Counts ~ Insolation + Diameter + Height + Time + Species +
Insolation:Diameter + Insolation:Height + Insolation:Time +
Insolation:Species + Diameter:Height + Diameter:Species +
Height:Time + Height:Species + Time:Species +
Height:Insolation:Time + Height:Insolation:Species,
family = poisson, data = lizards)
##set up in list
Cands <- list(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10)
Modnames <- paste("m", 1:length(Cands), sep = "")
##model selection
library(AICcmodavg)
aictab(Cands, Modnames)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.