ensemble_rescale: Rescale SDM predictions

View source: R/ensemble_rescale.R

ensemble_rescaleR Documentation

Rescale SDM predictions

Description

Rescale SDM predictions and (if applicable) associated uncertainties

Usage

ensemble_rescale(x, x.idx, y, y.abund = NULL, x.var.idx = NULL)

Arguments

x

object of class sf

x.idx

vector of column names or column indices; indicates columns in x with prediction values that will be rescaled

y

rescaling method; must be either "abundance" or "sumto1". See 'Details' section for descriptions of the rescaling methods

y.abund

numeric value; ignored if y is not "abundance"

x.var.idx

vector of column names or column indices; indicates columns in x with variance values that will be rescaled. If x.var.idx is specified, it must be the same length as x.idx. Use x.var.idx = NULL (the default) if none of the predictions have associated uncertainty values; see the 'Details' section for more information

Details

ensemble_rescale is intended to be used after overlaying predictions with overlay_sdm and before creating ensembles with ensemble_create. The provided rescaling methods are:

  • 'abundance' - Rescale the density values so that the predicted abundance is y.abund

  • 'sumto1' - Rescale the density values so their sum is 1

SDM uncertainty values must be rescaled differently than the prediction values. Columns specified in x.var.idx must contain variance values. These values will be rescaled using the formula var(c * x) = c^2 * var(x), where c is the rescaling factor for the associated predictions.

If x.var.idx is not NULL, then the function assumes x.var.idx[1] contains the variance values associated with the predictions in x.idx[1], x.var.idx[2] contains the variance values associated with the predictions in x.idx[2], etc. Use NA in x.var.idx to indicate a set of predictions that does not have associated uncertainty values (e.g., x.var.idx = c(4, NA, 5))

Value

The sf object x with the columns specified by x.idx and x.var.idx rescaled. The agr attributes of x will be conserved

Examples

ensemble_rescale(preds.1, c("Density", "Density2"), "abundance", 50)
ensemble_rescale(preds.1, c(1, 2), "sumto1")

ensemble_rescale(
  preds.1, c("Density", "Density2"), "abundance", 100, c(3,4)
)



eSDM documentation built on Oct. 8, 2024, 1:07 a.m.