Prediction and cross-validation using the Maximum Entropy

Description

Runs MaxEnt algorithm on a set of observations ("ppp" class from the spatstat package) and environmental covariates (of "SpatialPixelsDataFrame" class) and returns predicted probability of occurrence and cross-validation of models with presence/absence data.

Usage

1
2
3
4
## S4 method for signature '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).

Note

MaxEnt is one of the standard tools used in ecology for Niche analysis and species distribution modelling. What makes it especially robust is the fact that it can take both continuous and factor data as inputs, and has no requirements considering the distribution of covariates (Phillips et al., 2006). In the example below, I use MaxEnt to analyze representation of feature space by a given soil sampling pattern (i.e. mis-representation or the sampling preference by the surveyors). For more information on how to install MaxEnt and use it in R, see dismo package documentation.

Author(s)

Tomislav Hengl

References

See Also

dismo::maxent, plotKML::SpatialMaxEntOutput-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# load data:
library(plotKML)
library(rJava)
library(spatstat)
library(maptools)
library(dismo)
library(rgdal)

data(eberg)
data(eberg_grid)
## prepare data for spatial analysis:
eberg.xy <- eberg[runif(nrow(eberg))<0.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:
eberg.ppp <- as.ppp(eberg.xy)
## 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="")
}

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.