enmtools.rf: Takes an emtools.species object with presence and background...

View source: R/enmtools.rf.R

enmtools.rfR Documentation

Takes an emtools.species object with presence and background points, and builds a random forest model

Description

Takes an emtools.species object with presence and background points, and builds a random forest model

Usage

enmtools.rf(
  species,
  env,
  f = NULL,
  test.prop = 0,
  eval = TRUE,
  nback = 1000,
  env.nback = 10000,
  report = NULL,
  overwrite = FALSE,
  rts.reps = 0,
  bg.source = "default",
  verbose = FALSE,
  clamp = TRUE,
  corner = NA,
  bias = NA,
  ...
)

Arguments

species

An enmtools.species object

env

A SpatRaster of environmental data.

f

A formula for fitting the model

test.prop

Proportion of data to withhold randomly for model evaluation, or "block" for spatially structured evaluation.

eval

Determines whether model evaluation should be done. Turned on by default, but moses turns it off to speed things up.

nback

Number of background points to draw from range or env, if background points aren't provided

env.nback

Number of points to draw from environment space for environment space discrimination metrics.

report

Optional name of an html file for generating reports

overwrite

TRUE/FALSE whether to overwrite a report file if it already exists

rts.reps

The number of replicates to do for a Raes and ter Steege-style test of significance

bg.source

Source for drawing background points. If "points", it just uses the background points that are already in the species object. If "range", it uses the range raster. If "env", it draws points at randome from the entire study area outlined by the first environmental layer.

verbose

Controls printing of various messages progress reports. Defaults to FALSE.

clamp

When set to TRUE, clamps the environmental layers so that predictions made outside the min/max of the training data for each predictor are set to the value for the min/max for that predictor. Prevents the model from extrapolating beyond the min/max bounds of the predictor space the model was trained in, although there could still be projections outside the multivariate training space if predictors are strongly correlated.

corner

An integer from 1 to 4. Selects which corner to use for "block" test data. By default the corner is selected randomly.

bias

An optional raster estimating relative sampling effort per grid cell. Will be used for drawing background data.

...

Arguments to be passed to rf()

Value

An enmtools model object containing species name, model formula (if any), model object, suitability raster, marginal response plots, and any evaluation objects that were created.

Examples


enmtools.rf(iberolacerta.clade$species$monticola, env = euro.worldclim, nback = 500)


ENMTools documentation built on April 11, 2023, 6:09 p.m.