response: Calculate response plots for train models

View source: R/response.R

responseR Documentation

Calculate response plots for train models

Description

Evaluation Strip method proposed by Elith et al.(2005), applied to models created using caret::train. Here we use the same process as described in biomod2::response.plot2.

Usage

response(model, ...)

## S3 method for class 'train'
response(
  model,
  fixedvarFunction = mean,
  errorFunction = ci_95,
  n = 100,
  progress = FALSE,
  ...
)

## S3 method for class 'response.train'
plot(
  x,
  plot_errorbar = TRUE,
  plot_rugs = TRUE,
  free_y = TRUE,
  plot_thr = TRUE,
  ...
)

Arguments

model

A model returned by train.

...

ignored

fixedvarFunction

A function used to fix as constant the other variables when the predicting responses.

errorFunction

A function used to calculate error across resamples. Default is 95% confidence interval. If NULL, responses are calculated from the final model only.

n

Number of responses to get for each variable, as in seq(min(variable), max(variable), length.out=n).

progress

logical. Show progress bar?

x

An object returned by response.

plot_errorbar

logical. Should plot errors? Only valid if resample = TRUE.

plot_rugs

logical. Should plot rugs representing quantiles?

free_y

logical. Free or fixed y axis in plots?

plot_thr

logical. Should plot a line representing the probability threshold of the model? A threshold must be set using setThreshold and its only plotted if there is only one model (to avoid to much noise in the plot).

Value

An S3 object of class 'response.train', including:

  • num and factData.tables with responses for each variable of type numeric and factors. If errorFunction != NULL, responses are means from resamples and errors are also provided.

  • num_resample and fact_resampleData.tables with responses for each resample, only provided if errorFunction != NULL.

  • quantilesA matrix with quantiles for each variable used to plot rugs.


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