fitSDM: Fit species distribution models.

View source: R/SDMFunctions.R

fitSDMR Documentation

Fit species distribution models.

Description

Fit logistic regression, random forest or Maxent models using the outputs of createPresAb and some covariates.

Usage

fitSDM(species, model, envDat, spDat, k = 5, write, outPath)

Arguments

species

String. Species name (see getSpNames).

model

string. One of "lr", "rf" or "max" for logistic regression, random forest or Maxent.

envDat

String. rasterStack object with n layers each representing a covariate.

spDat

String. Outputs of createPresAb for the chosen species.

k

Numeric. Number of folds for cross validation. Defaults to 5.

write

Logical. If TRUE writes results to file in outPath.

outPath

String. Where to store the outputs if write = TRUE.

Value

A list with seven elements: 1) species name; 2) number of occurrence records; 3) a model object (either of type glm for "lr" or randomForest); 4) Number of folds for validation; 5) AUC score; 6) predicted probabilities of occurrence in raster format; and 7) the data used to fit the model (a dataframe with a column for observations and further columns for the corresponding covariates).


robboyd/soaR documentation built on April 24, 2022, 9:44 a.m.