Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ecospat.cv.me

Maxent Cross Validation


Description

K-fold and leave-one-out cross validation for Maxent.

Usage

ecospat.cv.me(data.cv.me, name.sp, names.pred, K=10, cv.lim=10, 
              jack.knife=FALSE, verbose=FALSE)

Arguments

data.cv.me

A dataframe object containing the calibration data set of a Maxent object to validate with the same names for response and predictor variables.

name.sp

Name of the species / response variable.

names.pred

Names of the predicting variables.

K

Number of folds. 10 is recommended; 5 for small data sets.

cv.lim

Minimum number of presences required to perform the K-fold cross-validation.

jack.knife

If TRUE, then the leave-one-out / jacknife cross-validation is performed instead of the 10-fold cross-validation.

verbose

Boolean indicating whether to print progress output during calculation. Default is FALSE.

Details

This function takes a calibrated Maxent object with a binomial error distribution and returns predictions from a stratified 10-fold cross-validation or a leave-one-out / jack-knived cross-validation. Stratified means that the original prevalence of the presences and absences in the full dataset is conserved in each fold.

Value

Returns a dataframe with the observations (obs) and the corresponding predictions by cross-validation or jacknife.

Author(s)

Christophe Randin christophe.randin@unibas.ch and Antoine Guisan antoine.guisan@unil.ch

References

Randin, C.F., T. Dirnbock, S. Dullinger, N.E. Zimmermann, M. Zappa and A. Guisan. 2006. Are niche-based species distribution models transferable in space? Journal of Biogeography, 33, 1689-1703.

Pearman, P.B., C.F. Randin, O. Broennimann, P. Vittoz, W.O. van der Knaap, R. Engler, G. Le Lay, N.E. Zimmermann and A. Guisan. 2008. Prediction of plant species distributions across six millennia. Ecology Letters, 11, 357-369.

Examples

data('ecospat.testData')

# data for Soldanella alpina
data.Solalp<- ecospat.testData[c("Soldanella_alpina","ddeg","mind","srad","slp","topo")] 

# maxent modelling and cross-validated predictions

# copy maxent.jar file in the right folder
path.from<-system.file("extdata", "maxent.txt", package="ecospat")
path.to <- paste0(system.file(package="dismo"), "/java/maxent.txt")
path.to.renamed <- paste0(system.file(package="dismo"), "/java/maxent.jar")
file.copy(path.from,path.to,overwrite = TRUE)
file.rename(path.to, path.to.renamed)

if (file.exists(path.to.renamed) & require(rJava)) {
  me.pred <- ecospat.cv.me(data.Solalp, names(data.Solalp)[1],
             names(data.Solalp)[-1], K = 10, cv.lim = 10, jack.knife = FALSE)
  }

ecospat

Spatial Ecology Miscellaneous Methods

v3.2
GPL
Authors
Olivier Broennimann [cre, aut, ctb], Valeria Di Cola [aut, ctb], Blaise Petitpierre [ctb], Frank Breiner [ctb], Daniel Scherrer [ctb], Manuela D`Amen [ctb], Christophe Randin [ctb], Robin Engler [ctb], Wim Hordijk [ctb], Heidi Mod [ctb], Julien Pottier [ctb], Mirko Di Febbraro [ctb], Loic Pellissier [ctb], Dorothea Pio [ctb], Ruben Garcia Mateo [ctb], Anne Dubuis [ctb], Luigi Maiorano [ctb], Achilleas Psomas [ctb], Charlotte Ndiribe [ctb], Nicolas Salamin [ctb], Niklaus Zimmermann [ctb], Antoine Guisan [aut]
Initial release
2021-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.