Learn R Programming

GSIF (version 0.3-1)

MaxEnt: Prediction and cross-validation using the Maximum Entropy

Description

Runs http://www.cs.princeton.edu/~schapire/maxent/{MaxEnt} algorithm on a set of observations ("ppp" class from the http://www.spatstat.org{spatstat} package) and environmental covariates (of "SpatialPixelsDataFrame" class) and returns predicted probability of occurrence and cross-validation of models with presence/absence data.

Usage

## S3 method for class 'ppp,SpatialPixelsDataFrame':
MaxEnt(occurrences, covariates,
          nfold = 5, Npoints = 1000, sciname = as.character(NA), 
          period = c(Sys.Date()-1, Sys.Date()), ...)

Arguments

occurrences
object of type "ppp"; occurrences
covariates
object of type "SpatialPixelsData"; list of covariate layers
nfold
object of type "integer"; number of folds used for cross-validation
Npoints
object of type "integer"; number of points used for cross-validation
sciname
object of type "character"; usually species latin name (it can also be a surveyor's team name or a sampling design)
period
object of type "Date"; sampling period
...
for more additional arguments see dismo::predict

Value

  • Returns an object of type "SpatialMaxEntOutput" with the following slots: sciname (usually latin "genus" and "species" name), occurrences (occurrence-only records), TimeSpan.begin (begin of sampling), TimeSpan.end (end of sampling), maxent (object of class "MaxEnt" produced as an output of the dismo::maxent function), sp.domain (assumed spatial domain), and predicted (results of prediction produced using the MaxEnt software).

References

  • Phillips, S.J., Anderson, R.P., Schapire, R.E., (2006)http://dx.doi.org/10.1016/j.ecolmodel.2005.03.026{Maximum entropy modeling of species geographic distributions}. Ecological Modelling, 190:231-259.
  • MaxEnt software (http://www.cs.princeton.edu/~schapire/maxent/)
  • Dismo package (http://CRAN.R-project.org/package=dismo)

See Also

dismo::maxent, plotKML::SpatialMaxEntOutput-class

Examples

Run this code
# load data:
library(plotKML)
library(dismo)
data(eberg)
data(eberg_grid)
# prepare data for spatial analysis:
eberg.xy <- eberg[runif(nrow(eberg)) < .3,]
coordinates(eberg.xy) <- ~X+Y
proj4string(eberg.xy) <- CRS("+init=epsg:31467")
# format gridded data:
gridded(eberg_grid) <- ~x+y
proj4string(eberg_grid) <- CRS("+init=epsg:31467")
# convert to a "ppp" object:
library(spatstat)
library(maptools)
eberg.ppp <- as.ppp(eberg.xy)
library(dismo)
# run MaxEnt analysis (evaluates sampling bias or mis-representation):
jar <- paste(system.file(package="dismo"), "/java/maxent.jar", sep='')
if(file.exists(jar)){
  me.eberg <- MaxEnt(occurrences=eberg.ppp, covariates=eberg_grid)
  ## NOTE: MaxEnt can be time-consuming!
  # plot the results:
  par(mfrow=c(1,2), mar=c(0.5,0.5,0.5,0.5), oma=c(0,0,0,0))
  image(as(me.eberg@predicted, "SpatialPixelsDataFrame"), 
    col=rev(heat.colors(25)), xlab="", ylab="")
  points(me.eberg@occurrences, pch="+", cex=.7)
  image(me.eberg@sp.domain, col="grey", xlab="", ylab="")
}

Run the code above in your browser using DataLab