calibration.predx: Calibrate predictions and models.

View source: R/calibration.R

calibration.predxR Documentation

Calibrate predictions and models.

Description

Enables post-hoc quantile GAM calibration of the regression predictions and models using the qgam tool.

Usage

## S3 method for class 'predx'
calibration(
  x,
  bs = "cr",
  k = 20,
  qu = 0.5,
  form = NULL,
  lsig = NULL,
  err = NULL,
  control = list(link = "identity"),
  argGam = NULL,
  ...
)

## S3 method for class 'caretx'
calibration(
  x,
  newdata = NULL,
  bs = "cr",
  k = 20,
  qu = 0.5,
  form = NULL,
  lsig = NULL,
  err = NULL,
  control = list(link = "identity"),
  argGam = NULL,
  ...
)

Arguments

x

a caretx model or predx prediction object.

bs

basis function for the smoother, ignored if a formula provided.

k

degrees of freedom for the smoother, ignored if a formula provided.

qu

quantile or quantiles for the calibration, see: qgam for details.

form

optional GAM formula as specified by formula.gam. The uncalibrated predictions are stored internally in the '.raw' variable, which needs to be included in the user-provided formula.

lsig

the value of the log learning rate used to create the Gibbs posterior, see: qgam for details.

err

an upper bound on the error of the estimated quantile curve, see: qgam for details.

control

a list of control parameters passed to qgam.

argGam

a list of parameters to be passed to gam, with the exception of formula, family and data.

...

extra arguments passed to qgam.

newdata

a data frame with the test data.#'

Details

Currently, only quantile calibration for regression predx and caretx objects is implemented. If a vector of quantiles is provided, the optimal one is choosen based on the minimum RMSE (more formal criteria are in development).

Value

A list with the predx object (.raw stores the uncalibrated predctions, .fitted stores the calibrated predictions) along with the gamObject named cal_fit, the chosen quantile value (qu) and values of explained deviance (qu_tbl).


PiotrTymoszuk/caretExtra documentation built on Oct. 15, 2023, 10:03 p.m.