MaxEntProj: Construct ensemble models and project habitat suitability to...

View source: R/MaxEntProj.R

MaxEntProjR Documentation

Construct ensemble models and project habitat suitability to current, past, and future climates

Description

This function conducts ensemble modelling on all replicates of the maxent model (see MaxEntModel for information on the different replicates the function provides), by calculating the median habitat suitability for each pixel across all replicates. Next, the function generates binary presence/absence maps by applying a given threshold to the data. These processes are repeated for each scenario/time period combination provided, to predict past or future species distributions.

Usage

MaxEntProj(
  input,
  time_periods,
  scenarios = NA,
  study_dir,
  predict_dirs,
  output,
  ThreshMethod = "Maximum.test.sensitivity.plus.specificity",
  aucval = NA,
  ncores = 1
)

Arguments

input

the full path name of the directory holding all model runs and outputs. Outputs should be divided into sub-directories based on the species, named with the species name (e.g. "./Results/Canis_lupus/"). The maxent.jar file should also be in this directory (gets copied over if MaxEntModel is run).

time_periods

a vector of the years in which the projection will occur. The first element of this vector should be the original year (the year in which the model was generated). If no precise years are available (e.g., using data from the Last Glacial Maximum), order from current to least current (farthest into the future/past) and give character strings for the years (e.g., "LGM").

scenarios

a vector of character strings detailing the different climate models used in the forecasted/hindcasted species distribution models. If only one distinct climate scenario is used, still provide a name for that scenario. If no projection is needed, set to NA (default).

study_dir

The directory where all of the current/modern study area environmental rasters are (should be the the same time period that the model was trained on).

predict_dirs

A list of vectors: Each vector should include the directories of the environmental rasters for all time periods in a single climate scenario. For example: list(Scenario1 = c(Time1, Time2), Scenario2 = c(Time1, Time2)).

If there is only one climate scenario, still create the list before the vector: list(Scenario1 = c(Time1,Time2)).

output

The directory name where the outputs of the ensemble modelling and prediction will be placed.

ThreshMethod

Which threshold to use for binary mapping; see MAXENT manual for details. Default is "Maximum.test.sensitivity.plus.specificity".

aucval

(numeric or vector) Minimum AUC value necessary for each run to be counted. AUC values estimate the predictive ability of a model, usually ranging from 0.5 (random) to 1 (perfect). Can be a single number (same AUC threshold applied to all species) or a vector with the same length as input. If set to NA (default), all replicates will be used for ensembling and projection.

ncores

the number of computer cores to parallelize the background point generation on. Default is 1; Using one fewer core than the computer has is usually optimal.

Value

Returns binary (presence/absence) and ensembled distribution maps for all given species, time periods, and climate scenarios provided. Each projected replicate of the maxent model is placed in a newly-created folder (provided by the projections argument) within the directory given by the input argument. The ensembled and binary maps are placed in the directory given by the output argument.


brshipley/megaSDM documentation built on Nov. 26, 2024, 6:08 a.m.