kuenm_modstats_swd: Calculation of descriptive statistics of models created in...

View source: R/kuenm_modstats_swd.R

kuenm_modstats_swdR Documentation

Calculation of descriptive statistics of models created in SWD format

Description

kuenm_modstats_swd calculates raster layers with some descriptive statistics of all model replicates across multiple parameter settings, for models created in SWD format and projected to one or multiple projection areas (scenarios).

Usage

kuenm_modstats_swd(sp.name, fmod.dir, format = "asc", statistics,
                   proj.scenarios, ext.type, out.dir = "Final_Model_Stats")

Arguments

sp.name

(character) name of the species. This name must be the one that appears as part of the raster file of each model. If results are from Maxent, this is the name that is in the first column of the csv containing species occurrence data (species) but changing spaces (if there is any) by underscore.

fmod.dir

(character) the name of the folder in which final models are (e.g., the output folder after using the kuenm_mod_swd) function. It is important to have only the folders containing the models in this directory. It can be only one folder or multiple subfolders containing models for the same species, created with distinct parameter settings. If models were projected, and distinct types of extrapolation were used, the name of the folders contained in this directory should include a pattern describing the type of extrapolation used (e.g., "EC" for extrapolation and clamping in Maxent).

format

(character) format of model raster files. Options are: "asc" or "tif"; default = "asc".

statistics

(character) vector of descriptive statistics to be calculated. Options include med = median, mean, min = minimum, max = maximum, range, sd = standard deviation, and se = standard error. By default c("med", "min", "max", "range") are calculated, unless a character vector with the desired statistics is provided.

proj.scenarios

(character) vector of pattern(s) that identify each projection area (scenario) to which models were projected.

ext.type

(character) vector of pattern(s) to be searched in the folders inside fmod.dir that identify the extrapolation type(s) of model projections. This pattern(s) need to be clearly distinguishable from the rest of the name of the folder. For instance, capital letter can be used to separate this pattern from the rest of the folder name (e.g., "EC" will be the patter that denotes extrapolation and clamping in the folder named "M_0.1_F_l_set1_EC").

out.dir

(character) name of the output directory to be created in which resulting raster layers of model statistics will be written. Default = "Final_Model_Stats".

Details

Users must be specific when defining the patterns that the function will search for. These patterns must be part of the model (raster layer) names so the function can locate each file without problems. This function uses this system of work to avoid high demands of the RAM while performing these analyses.

Value

Folders named Statistics or Statistics_("pattern" depending on the ext.type) with all the raster layers of the descriptive statistics for models in fmod.dir. Folders will be written inside out.dir.

Examples

# Models should be ready before starting these analyses, for an example of how
to create them see https://github.com/marlonecobos/kuenm

# Arguments
sp_name <- "sp1"
fmod_dir <- "Final_Models"
format <- "asc"
project <- TRUE
stats <- c("med", "range")
rep <- TRUE
scenarios <- c("current", "GCM1_RCP4.5", "GCM1_RCP8.5", "GCM2_RCP4.5", "GCM2_RCP8.5")
ext_type <- c("E", "EC", "NE") # you can select only one type of extrapolation if needed
out_dir <- "Final_Model_Stats"

kuenm_modstats_swd(sp.name = sp_name, fmod.dir = fmod_dir,
                   statistics = stats, proj.scenarios = scenarios,
                   ext.type = ext_type, out.dir = out_dir)

manubio13/ku.enm documentation built on Jan. 5, 2024, 5:55 a.m.