pirf: pirf()

View source: R/pirf.R

pirfR Documentation

pirf()

Description

Implements seven different random forest prediction interval methods.

Usage

pirf(
  formula = NULL,
  train_data = NULL,
  method = "oob",
  alpha = 0.1,
  symmetry = TRUE,
  seed = NULL,
  m_try = NULL,
  num_trees = 500,
  min_node_size = NULL,
  num_threads = parallel::detectCores(),
  calibrate = FALSE,
  Roy_method = "quantile",
  featureBias = FALSE,
  predictionBias = TRUE,
  Tung_R = 5,
  Tung_num_trees = 75,
  variant = 1,
  Ghosal_num_stages = 2,
  prop = 0.618,
  concise = TRUE,
  interval_type = "two-sided",
  ...
)

Arguments

formula

Object of class formula or character describing the model to fit. Interaction terms supported only for numerical variables.

train_data

Training data of class data.frame.

method

Choose what method to generate RF prediction intervals. Options are method = c("oob", "quantile", "cqrf", "brf", "bop", "bcqrf", "hdi"). Defaults to method = "oob".

alpha

Significance level for prediction intervals. Defaults to alpha = 0.1.

symmetry

True if constructing symmetric out-of-bag prediction intervals, False otherwise. Used only method = "oob". Defaults to symmetry = TRUE.

seed

Seed for random number generation. Currently not utilized.

m_try

Number of variables to randomly select from at each split.

num_trees

Number of trees used in the random forest.

min_node_size

Minimum number of observations before split at a node.

num_threads

The number of threads to use in parallel. Default is the current number of cores.

calibrate

If calibrate = TRUE, intervals are calibrated to achieve nominal coverage. Currently uses quantiles to calibrate. Only for method = "bop".

Roy_method

Interval method for method = "bop". Options are Roy_method = c("quantile", "hdi", "CHDI").

featureBias

Remove feature bias. Only for method = "bcqrf".

predictionBias

Remove prediction bias. Only for method = "bcqrf".

Tung_R

Number of repetitions used in bias removal. Only for method = "bcqrf".

Tung_num_trees

Number of trees used in bias removal. Only for method = "bcqrf".

variant

Choose which variant to use. Options are method = c("1", "2"). Only for method = "brf".

Ghosal_num_stages

Number of total stages. Only for method = "brf".

prop

Proportion of training data to sample for each tree. Only for method = "brf".

concise

If concise = TRUE, only predictions output. Defaults to concise = FALSE.

interval_type

Type of prediction interval to generate. Options are method = c("two-sided", "lower", "upper"). Default is method = "two-sided".

test_data

Test data of class data.frame. Utilizes ranger::predict() to produce prediction intervals for test data.

Details

The seven methods implemented are cited in the References section. Additional information can be found within those references. Each of these methods are implemented by utilizing the ranger package. For method = "oob", prediction intervals are generated using out-of-bag residuals. method = "cqrf" utilizes a split-conformal approach. method = "bop" uses a bag-of-predictors approach. method = "brf" performs boosting to reduce bias in the random forest, and estimates variance. The authors provide multiple variants to their methodology. method = "bcqrf" debiases feature selection and prediction. Prediction intervals are generated using quantile regression forests. method = "hdi" delivers prediction intervals through highest-density interval regression forests. method = "quantile" utilizes quantile regression forests.

Author(s)

Chancellor Johnstone

Haozhe Zhang

See Also

ranger

rfinterval

predict.pirf


chancejohnstone/piRF documentation built on April 14, 2025, 3:02 a.m.