Learn R Programming

pintervals (version 1.0.1)

bootstrap_inner: Bootstrap function for bootstrapping the prediction intervals

Description

Bootstrap function for bootstrapping the prediction intervals

Usage

bootstrap_inner(
  pred,
  calib,
  error,
  nboot,
  alpha,
  dw_bootstrap = FALSE,
  distance_function = NULL,
  error_type = c("raw", "absolute"),
  distance_weighted_bootstrap = FALSE,
  distance_features_calib = NULL,
  distance_features_pred = NULL,
  distance_type = c("mahalanobis", "euclidean"),
  normalize_distance = c("minmax", "sd", "none"),
  weight_function = gauss_kern
)

Value

a numeric vector with the predicted value and the lower and upper bounds of the prediction interval

Arguments

pred

predicted value

calib

a vector of true values of the calibration partition. Used when weighted_bootstrap is TRUE

error

vector of errors.

nboot

number of bootstrap samples

alpha

confidence level

dw_bootstrap

logical. If TRUE, the bootstrap samples will be weighted according to the distance function

distance_function

a function that takes two numeric vectors and returns a numeric vector of distances. Default is NULL, in which case the absolute error will be used

error_type

The type of error to use for the prediction intervals. Can be 'raw' or 'absolute'. If 'raw', bootstrapping will be done on the raw prediction errors. If 'absolute', bootstrapping will be done on the absolute prediction errors with random signs. Default is 'raw'

distance_weighted_bootstrap

logical. If TRUE, the bootstrap samples will be weighted according to the distance function

distance_features_calib

a matrix of features for the calibration partition. Used when distance_weighted_bootstrap is TRUE

distance_features_pred

a matrix of features for the prediction partition. Used when distance_weighted_bootstrap is TRUE

distance_type

The type of distance metric to use when computing distances between calibration and prediction points. Options are 'mahalanobis' (default) and 'euclidean'.

normalize_distance

Either "none", "minmax", or "sd". Indicates how to normalize the distances when distance_weighted_bootstrap is TRUE

weight_function

a function to use for weighting the distances. Can be 'gaussian_kernel', 'caucy_kernel', 'logistic', or 'reciprocal_linear'. Default is 'gaussian_kernel'