View source: R/ensemble_rescale.R

ensemble_rescale | R Documentation |

Rescale SDM predictions and (if applicable) associated uncertainties

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

`x` |
object of class |

`x.idx` |
vector of column names or column indices;
indicates columns in |

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

`y.abund` |
numeric value; ignored if |

`x.var.idx` |
vector of column names or column indices;
indicates columns in |

`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)`

)

The `sf`

object `x`

with the columns specified by `x.idx`

and `x.var.idx`

rescaled.
The `agr`

attributes of `x`

will be conserved

```
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)
)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.