tails_ev: Extreme value distirbutions for distribution tails

View source: R/tails_ev.R

tails_evR Documentation

Extreme value distirbutions for distribution tails

Description

This function fits semi-parametric models for extreme value distributions using evgam with facilities for cross-validation.

Usage

tails_ev(
  data,
  mqr_data,
  tail_starts = range(as.numeric(gsub("q", "", names(mqr_data))), na.rm = T),
  formula,
  formula_r = formula,
  CVfolds = NULL,
  BadData_col = NULL,
  evgam_family = "gpd",
  print_summary = F,
  return_models = F
)

Arguments

data

The modelling table as a data.frame or data.table

mqr_data

A MultiQR object corresponding to data

tail_starts

The upper and lower probability levels beyond which the tail distribution is used. E.g. c(5,95) to use tail distribution for probabilities below quantile 0.05 and above 0.95. Defaults to min and max from mqr_data

formula_r

as formula but for the upper tail only.

CVfolds

Control for cross-validation if not supplied in data.

BadData_col

Name of a boolean column in data indicating bad data which should be excluded from parameter estimation.

evgam_family

specifies distribution, see ?evgam.

print_summary

If TRUE, summary is printed for each evgam fit.

return_models

If TRUE, the function returns a list including both the data and the fitted data models.

formala

A formula object with the response on the left of an ~ operator, and the terms, separated by + operators, on the right. This formula is used for both upper and lower tails unless formula_r is specified in which case formula is used for the lower tail only.

Details

The returned predictive quantiles are those produced out-of-sample for each cross-validation fold (using models trained on the remaining folds but not "Test" data). Predictive quantiles corresponding to "Test" data are produced using models trained on all non-test data.

Value

If 'return_models' is TRUE, then returns a list containing a list of tail models, and data with additional columns containing the predicted parameters of the specified tail distribution. Otherwise, just returns data.

Author(s)

Jethro Browell, jethro.browell@strath.ac.uk


jbrowell/ProbCast documentation built on July 20, 2024, 1:53 p.m.