ic | R Documentation |
Calculate AIC, AICc, and BIC for Maxent models as implemented in ENMTools.
ic(x, occ, lambdas)
x |
Either a |
occ |
A |
lambdas |
A |
An n x 6 matrix, where n is the number of Maxent models for which
information criteria are to be calculated. Columns give n
(the
number of occurrence records used for model training), k
(the number
of features with non-zero weights), ll
(the negative log likelihood
of the model), AIC
, AICc
, and BIC
(as calculated in
ENMTools).
These information criteria should not be calculated for models that use hinge or threshold features because the number of predictors is not estimated correctly.
Warren, D. L., Glor, R. E. and Turelli, M. 2009. ENMTools: a toolbox for comparative studies of environmental niche models. Ecography 33:607-611.
# Below we use the dismo::maxent example to fit a Maxent model:
if (require(dismo) && require(rJava) &&
file.exists(system.file('java/maxent.jar', package='dismo'))) {
fnames <- list.files(system.file('ex', package='dismo'), '\\.grd$',
full.names=TRUE )
predictors <- stack(fnames)
occurrence <- system.file('ex/bradypus.csv', package='dismo')
occ <- read.table(occurrence, header=TRUE, sep=',')[,-1]
me <- maxent(predictors, occ, args=c('hinge=false', 'threshold=false'),
path=tempdir())
r <- project(me, predictors, quiet=TRUE)$prediction_raw
# passing the raster object to pred.raw and the maxent object to lambdas:
ic(r, occ, me)
# passing a lambdas file path to lambdas:
ic(r, occ, file.path(tempdir(), 'species.lambdas'))
# comparing multiple models
me2 <- maxent(predictors, occ, args=c('hinge=false', 'threshold=false',
'betamultiplier=3'), path=tempdir())
r2 <- project(me2, predictors, quiet=TRUE)$prediction_raw
ic(stack(r, r2), occ, list(me, me2))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.