if (FALSE) {
library(Distance)
data("wren_cuecount")
# fit hazard-rate key models
w3.hr0 <- ds(wren_cuecount, transect="point", key="hr", adjustment=NULL,
truncation=92.5)
w3.hr1 <- ds(wren_cuecount, transect="point", key="hr", adjustment="cos",
order=2, truncation=92.5)
w3.hr2 <- ds(wren_cuecount, transect="point", key="hr", adjustment="cos",
order=c(2, 4), truncation=92.5)
# fit unform key models
w3.u1 <- ds(wren_cuecount, transect="point", key="unif", adjustment="cos",
order=1, truncation=92.5)
w3.u2 <- ds(wren_cuecount, transect="point", key="unif", adjustment="cos",
order=c(1,2), monotonicity="none", truncation=92.5)
w3.u3 <- ds(wren_cuecount, transect="point", key="unif", adjustment="cos",
order=c(1,2,3), monotonicity="none", truncation=92.5)
# fit half-normal key functions
w3.hn0 <- ds(wren_cuecount, transect="point", key="hn", adjustment=NULL,
truncation=92.5)
w3.hn1 <- ds(wren_cuecount, transect="point", key="hn", adjustment="herm",
order=2, truncation=92.5)
# stage 1: calculate QAIC per model set
QAIC(w3.hr0, w3.hr1, w3.hr2) # no adjustments smallest
QAIC(w3.u1, w3.u2, w3.u3) # 2 adjustment terms (by 0.07)
QAIC(w3.hn0, w3.hn1) # no adjustments smallest
# stage 2: select using chi^2/degrees of freedom between sets
chi2_select(w3.hr0, w3.u2, w3.hn0)
# example using a pre-calculated chat
chat <- attr(QAIC(w3.hr0, w3.hr1, w3.hr2), "chat")
QAIC(w3.hr0, chat=chat)
}
Run the code above in your browser using DataLab