fitList.Rd
Organize models for model selection or model-averaged prediction.
fitList(..., fits, autoNames=c("object", "formula"))
Fitted models. Preferrably named.
An alternative way of providing the models. A (preferrably named) list of fitted models.
Option to change the names unmarked
assigns to models if you don't name them yourself. If autoNames="object"
, models in the fitList
will be named based on their R object names. If autoNames="formula"
, the models will instead be named based on their formulas. This is not possible for some model types.
Two requirements exist to conduct AIC-based model-selection and model-averaging in unmarked. First, the data objects (ie, unmarkedFrames) must be identical among fitted models. Second, the response matrix must be identical among fitted models after missing values have been removed. This means that if a response value was removed in one model due to missingness, it needs to be removed from all models.
data(linetran)
(dbreaksLine <- c(0, 5, 10, 15, 20))
#> [1] 0 5 10 15 20
lengths <- linetran$Length * 1000
ltUMF <- with(linetran, {
unmarkedFrameDS(y = cbind(dc1, dc2, dc3, dc4),
siteCovs = data.frame(Length, area, habitat), dist.breaks = dbreaksLine,
tlength = lengths, survey = "line", unitsIn = "m")
})
fm1 <- distsamp(~ 1 ~1, ltUMF)
fm2 <- distsamp(~ area ~1, ltUMF)
fm3 <- distsamp( ~ 1 ~area, ltUMF)
## Two methods of creating an unmarkedFitList using fitList()
# Method 1
fmList <- fitList(Null=fm1, .area=fm2, area.=fm3)
# Method 2. Note that the arugment name "fits" must be included in call.
models <- list(Null=fm1, .area=fm2, area.=fm3)
fmList <- fitList(fits = models)
# Extract coefficients and standard errors
coef(fmList)
#> lam(Int) p(Int) p(area) lam(area)
#> Null -0.1710554 2.386380 NA NA
#> .area -0.1678270 3.002507 -0.120364 NA
#> area. 0.2364320 2.386386 NA -0.08005895
SE(fmList)
#> lam(Int) p(Int) p(area) lam(area)
#> Null 0.1337819 0.1273598 NA NA
#> .area 0.1340212 0.5401575 0.09548038 NA
#> area. 0.5122837 0.1273614 NA 0.0979427
# Model-averaged prediction
predict(fmList, type="state")
#> Predicted SE lower upper
#> 1 0.8312132 0.1182056 0.6325438 1.092772
#> 2 0.8524076 0.1169823 0.6528972 1.112951
#> 3 0.8331920 0.1166589 0.6358157 1.092103
#> 4 0.8315502 0.1179278 0.6331133 1.092628
#> 5 0.8444727 0.1130560 0.6495892 1.097823
#> 6 0.8628921 0.1284214 0.6509868 1.145233
#> 7 0.8625919 0.1280257 0.6511054 1.144148
#> 8 0.8271520 0.1219457 0.6253753 1.095368
#> 9 0.8195735 0.1303255 0.6112124 1.103804
#> 10 0.8555768 0.1198427 0.6529052 1.121399
#> 11 0.8164013 0.1341851 0.6052469 1.108477
#> 12 0.8488432 0.1145846 0.6520535 1.105031
# Model selection
modSel(fmList, nullmod="Null")
#> nPars AIC delta AICwt cumltvWt Rsq
#> Null 2 164.75 0.00 0.43 0.43 0.000
#> .area 3 165.18 0.43 0.35 0.78 0.122
#> area. 3 166.08 1.32 0.22 1.00 0.055