confidence_map: Create confidence maps

View source: R/confidence_map.R

confidence_mapR Documentation

Create confidence maps

Description

Create confidence maps using bootstrap replicates

Usage

confidence_map(model, ...)

## S3 method for class 'train'
confidence_map(
  model,
  rasterStack,
  nrep = 10,
  doclamp = FALSE,
  progress = TRUE,
  ...
)

## S3 method for class 'list'
confidence_map(
  model,
  rasterStack,
  nrep = 10,
  doclamp = FALSE,
  progress = TRUE,
  ...
)

## S3 method for class 'ensemble.train'
confidence_map(
  model,
  rasterStack,
  nrep = 10,
  doclamp = FALSE,
  progress = TRUE,
  return.all = FALSE,
  ...
)

Arguments

model

A model returned by train or createEnsemble.

...

ignored

rasterStack

A RasterStack from the raster package, used to create predictions.

nrep

Number of bootstrap replicates.

doclamp

logical. Clamp RasterStack based on training data before predictions?

progress

logical. Show progress text? If parallel is activated, it automatically defaults to FALSE.

return.all

logical. If TRUE, return predictions and cvs for all models. Else, return only the CV for the ensemble model.

Details

For each interaction (defined by nrep), the trained data set for each model is resampled (bootstrap) and each model retrained using this new data.
Predictions are made for each model for each interaction, separately.

For 'train' objects, the mean and standard deviation from all replicates are returned.

For 'ensemble.train' objects, the coefficient of variation is calculated for each model, which in turn is assembled based on algorithmic used to create the ensemble:

mean, weighted_mean -> eq_mean.png
median, number_votes -> eq_median.png

Where cvi = mean coefficient of variation for model i,
pi = predictions for model i using all training data,
wi = weight of model i,
and p = predictions of the ensemble using all training data.
For weighted_mean, wi = metric/sum(all metrics); and for mean, wi = 1/(number of models).

Value

For 'train' or 'list' methods, a 'RasterLayer' or a 'RasterStack' containing the coefficient of variation (CV) of the bootstrap output for each model.

For 'ensemble.train' method, if return.all is TRUE, return a list with $preds and $cvs containing each a 'RasterStack' of the predictions and CVs of all models, including the ensemble. Else, return a single 'RasterLayer' with CV of the ensemble model.

Note

When using progress = TRUE in parallel, you must make clusters using the doSNOW package. Using package doParallel will return a warning, and the progress bar will not be updated.


correapvf/caretSDM documentation built on June 2, 2022, 8:29 a.m.