importance | R Documentation |
This function calculates the relative importance of variables (w+) based on the sum of Akaike weights (model probabilities) of the models that include the variable. Note that this measure of evidence is only appropriate when the variable appears in the same number of models as those that do not include the variable.
importance(cand.set, parm, modnames = NULL, second.ord = TRUE,
nobs = NULL, ...)
## S3 method for class 'AICaov.lm'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICbetareg'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICsclm.clm'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICclm'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICclmm'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICclogit.coxph'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICcoxme'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICcoxph'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICglm.lm'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, ...)
## S3 method for class 'AICglmerMod'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AIClmerModLmerTest'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICglmmTMB'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, ...)
## S3 method for class 'AICgls'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AIClm'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AIClme'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AIClmekin'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICmaxlikeFit.list'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, ...)
## S3 method for class 'AICmer'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICmultinom.nnet'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, ...)
## S3 method for class 'AICnegbin.glm.lm'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICnlmerMod'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICpolr'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICrlm.lm'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICsurvreg'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
## S3 method for class 'AICunmarkedFitColExt'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitOccu'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitOccuFP'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitOccuRN'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitPCount'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitPCO'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitDS'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitGDS'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitMPois'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitGMM'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitGPC'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitOccuMulti'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL, ...)
## S3 method for class 'AICunmarkedFitOccuMS'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL,
...)
## S3 method for class 'AICunmarkedFitOccuTTD'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL,
...)
## S3 method for class 'AICunmarkedFitMMO'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL,
...)
## S3 method for class 'AICunmarkedFitDSO'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, parm.type = NULL,
...)
## S3 method for class 'AICvglm'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, c.hat = 1, ...)
## S3 method for class 'AICzeroinfl'
importance(cand.set, parm, modnames = NULL,
second.ord = TRUE, nobs = NULL, ...)
cand.set |
a list storing each of the models in the candidate model set. |
parm |
the parameter of interest for which a measure of relative importance is required. |
modnames |
a character vector of model names to facilitate the identification of
each model in the model selection table. If |
second.ord |
logical. If |
nobs |
this argument allows to specify a numeric value other than total sample
size to compute the AICc (i.e., |
c.hat |
value of overdispersion parameter (i.e., variance inflation factor) such
as that obtained from |
parm.type |
this argument specifies the parameter type on which
the variable of interest will be extracted and is only relevant for
models of |
... |
additional arguments passed to the function. |
importance
returns an object of class importance
consisting of the following components:
parm |
the parameter for which an importance value is required. |
w.plus |
the sum of Akaike weights for the models that include the parameter of interest. |
w.minus |
the sum of Akaike weights for the models that exclude the parameter of interest. |
Marc J. Mazerolle
Burnham, K. P., and Anderson, D. R. (2002) Model Selection and Multimodel Inference: a practical information-theoretic approach. Second edition. Springer: New York.
Dail, D., Madsen, L. (2011) Models for estimating abundance from repeated counts of an open population. Biometrics 67, 577–587.
MacKenzie, D. I., Nichols, J. D., Lachman, G. B., Droege, S., Royle, J. A., Langtimm, C. A. (2002) Estimating site occupancy rates when detection probabilities are less than one. Ecology 83, 2248–2255.
MacKenzie, D. I., Nichols, J. D., Hines, J. E., Knutson, M. G., Franklin, A. B. (2003) Estimating site occupancy, colonization, and local extinction when a species is detected imperfectly. Ecology 84, 2200–2207.
Royle, J. A. (2004) N-mixture models for estimating population size from spatially replicated counts. Biometrics 60, 108–115.
AICc
, aictab
, c_hat
,
confset
, evidence
, modavg
,
modavgShrink
, modavgPred
##example on Orthodont data set in nlme
## Not run:
require(nlme)
##set up candidate model list
Cand.models <- list( )
Cand.models[[1]] <- lme(distance ~ age, data = Orthodont, method = "ML")
##random is ~ age | Subject
Cand.models[[2]] <- lme(distance ~ age + Sex, data = Orthodont,
random = ~ 1, method = "ML")
Cand.models[[3]] <- lme(distance ~ 1, data = Orthodont, random = ~ 1,
method = "ML")
Cand.models[[4]] <- lme(distance ~ Sex, data = Orthodont, random = ~ 1,
method = "ML")
##create a vector of model names
Modnames <- paste("mod", 1:length(Cand.models), sep = "")
importance(cand.set = Cand.models, parm = "age", modnames = Modnames,
second.ord = TRUE, nobs = NULL)
##round to 4 digits after decimal point
print(importance(cand.set = Cand.models, parm = "age", modnames = Modnames,
second.ord = TRUE, nobs = NULL), digits = 4)
detach(package:nlme)
## End(Not run)
##single-season occupancy model example modified from ?occu
## Not run:
require(unmarked)
##single season
data(frogs)
pferUMF <- unmarkedFrameOccu(pfer.bin)
## add some fake covariates for illustration
siteCovs(pferUMF) <- data.frame(sitevar1 = rnorm(numSites(pferUMF)),
sitevar2 = rnorm(numSites(pferUMF)))
## observation covariates are in site-major, observation-minor order
obsCovs(pferUMF) <- data.frame(obsvar1 = rnorm(numSites(pferUMF) *
obsNum(pferUMF)))
##set up candidate model set
fm1 <- occu(~ obsvar1 ~ sitevar1, pferUMF)
fm2 <- occu(~ 1 ~ sitevar1, pferUMF)
fm3 <- occu(~ obsvar1 ~ sitevar2, pferUMF)
fm4 <- occu(~ 1 ~ sitevar2, pferUMF)
Cand.mods <- list(fm1, fm2, fm3, fm4)
Modnames <- c("fm1", "fm2", "fm3", "fm4")
##compute importance value for 'sitevar1' on occupancy
importance(cand.set = Cand.mods, modnames = Modnames, parm = "sitevar1",
parm.type = "psi")
##compute importance value for 'obsvar1' on detectability
importance(cand.set = Cand.mods, modnames = Modnames, parm = "obsvar1",
parm.type = "detect")
##example with multispecies occupancy modify from ?occuMulti
##Simulate 3 species data
N <- 80
nspecies <- 3
J <- 4
occ_covs <- as.data.frame(matrix(rnorm(N * 10),ncol=10))
names(occ_covs) <- paste('par',1:10,sep='')
det_covs <- list()
for (i in 1:nspecies){
det_covs[[i]] <- matrix(rnorm(N*J),nrow=N)
}
names(det_covs) <- paste('par',1:nspecies,sep='')
##True vals
beta <- c(0.5,0.2,0.4,0.5,-0.1,-0.3,0.2,0.1,-1,0.1)
f1 <- beta[1] + beta[2]*occ_covs$par1
f2 <- beta[3] + beta[4]*occ_covs$par2
f3 <- beta[5] + beta[6]*occ_covs$par3
f4 <- beta[7]
f5 <- beta[8]
f6 <- beta[9]
f7 <- beta[10]
f <- cbind(f1,f2,f3,f4,f5,f6,f7)
z <- expand.grid(rep(list(1:0),nspecies))[,nspecies:1]
colnames(z) <- paste('sp',1:nspecies,sep='')
dm <- model.matrix(as.formula(paste0("~.^",nspecies,"-1")),z)
psi <- exp(f
psi <- psi/rowSums(psi)
##True state
ztruth <- matrix(NA,nrow=N,ncol=nspecies)
for (i in 1:N){
ztruth[i,] <- as.matrix(z[sample(8,1,prob=psi[i,]),])
}
p_true <- c(0.6,0.7,0.5)
## fake y data
y <- list()
for (i in 1:nspecies){
y[[i]] <- matrix(NA,N,J)
for (j in 1:N){
for (k in 1:J){
y[[i]][j,k] <- rbinom(1,1,ztruth[j,i]*p_true[i])
}
}
}
names(y) <- c('coyote','tiger','bear')
##Create the unmarked data object
data <- unmarkedFrameOccuMulti(y=y,siteCovs=occ_covs,obsCovs=det_covs)
## Formulas for state and detection processes
## Length should match number/order of columns in fDesign
occFormulas <- c('~par1 + par2','~par2','~par3','~1','~1','~1','~1')
occFormulas2 <- c('~par1 + par3','~par1 + par2','~par1 + par2 + par3',
"~ 1", "~1", "~ 1", "~1")
##Length should match number/order of species in data@ylist
detFormulas <- c('~1','~1','~1')
fit <- occuMulti(detFormulas,occFormulas,data)
fit2 <- occuMulti(detFormulas,occFormulas2,data)
##importance
importance(cand.set = list(fit, fit2), parm = "[coyote] par2",
parm.type = "psi")
detach(package:unmarked)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.