additionalStats: Generate miscellaneous statistics for species range shifts

View source: R/additionalStats.R

additionalStatsR Documentation

Generate miscellaneous statistics for species range shifts

Description

This function generates graphs showing the changes in range size and position between the data a species distribution model was trained on and future or past projections of species ranges.

Usage

additionalStats(
  result_dir,
  time_periods,
  scenarios,
  dispersal = FALSE,
  contiguous = FALSE,
  dispersaldata = NA,
  ncores = 1
)

Arguments

result_dir

the directory where the ensembled and binary maps are placed in addition to the "Results.csv" file. If projectSuit was used to make these maps, this should be the same as the output argument in that function.

time_periods

a vector of the years in which the projection will occur, with the first element as the year the model will be trained on (usually the current data).If no precise years are available (e.g., using data from the Last Glacial Maximum), order time periods from current to least current 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. In no projection is needed, set to NA (defualt).

dispersal

(logical TRUE or FALSE) Should these statistics be calculated for the dispersal-constrained distribution maps? If dispersal rate analysis are not needed, or if the megaSDM::dispersalRate function has yet to be run, this should be set to FALSE (the default).

contiguous

(logical TRUE or FALSE) If dispersal == TRUE, do the statistics that need to be calculated come from the analysis that constrained the suitable habitat at the first time step to the existing occurrences? See the contiguous argument in the dispersalRate() function. Default is FALSE

dispersaldata

A dataframe or the full file path to a .csv file with two columns:

  1. Species.

  2. Dispersal Rate in km/yr. See the function megaSDM::dispersalRate for more details.

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.

Details

NOTE: this function is dependent on the outputs generated by the projectSuit function, in particular the "Results.csv" file, which includes information on changes in range size and position across the projected time periods and scenarios.

Value

creates .pdf files of graphs showing changes in range size and distribution across multiple time periods and scenarios:

  1. The overall modelled range size across all time periods and scenarios.

  2. The percent change from the current range size.

  3. Average range size for each year given multiple climate scenarios.

  4. (If dispersal = TRUE) the difference in range size between dispersal constrained and non-dispersal constrained species ranges.


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