QRM (version 0.4-13)

game-aux: Auxiliary Functions for Extracting/Computing Results Related to gamGPDfit()/gamGPDboot()

Description

get.gam.fit() extracts a convenient list containing unique covariate combinations and corresponding fitted values from an object returned by gam().

gam.predict() computes a convenient list containing unique covariate combinations and corresponding predicted values and pointwise asymptotic confidence intervals (obtained from the estimated standard errors obtained by predict(..., se.fit=TRUE)).

get.GPD.fit() extracts a convenient list containing (for each of the GPD parameters) unique covariate combinations, the fitted GPD parameter (vector), bootstrapped pointwise two-sided 1-\(\alpha\) confidence intervals, and a matrix of bootstrapped parameter values.

GPD.predict() computes a convenient list containing (for each of the GPD parameters) unique covariate combinations and corresponding predicted values.

risk.measure() computes the selected risk measure at a matrix of values for \(\rho\), \(\xi\), \(\beta\).

Usage

get.gam.fit(x)
gam.predict(x, newdata=NULL, alpha=0.05, value=c("lambda", "rho"))
get.GPD.fit(x, alpha=0.05)
GPD.predict(x, xi.newdata=NULL, beta.newdata=NULL)

risk.measure(x, alpha, u, method = c("VaR", "ES"))

Arguments

x

For get.gam.fit() and gam.predict() an object as returned by gam(); for get.GPD.fit() and GPD.predict() an object as returned by gamGPDboot(); for risk.measure() a matrix with three columns containing an estimate \(\rho\) of the tail of the loss distribution at the threshold u for a covariate combination, the corresponding \(\xi\) and the corresponding \(\beta\) (in this order).

newdata

object as required by predict(). Typically a named data.frame of type expand.grid(covar1=, covar2=) with at least the covariates used for fitting with gam(); if more are provided, predict() returns values which are equal uniformly over all of these additional covariates. Each covariate which appears when fitting with gam() can have more values than were actually used in gam(). In this case predict() “interpolates” correctly with the fitted model.

xi.newdata, beta.newdata

as newdata, just for the GPD parameters \(\xi\) and \(\beta\).

alpha

for gam.predict(), get.GPD.fit() the significance level (typcially 0.05); for risk.measure() the confidence level (typically close to 1).

u

threshold.

value

either "lambda" or "rho" depending on whether \(\lambda\) or \(\rho\) is predicted.

method

character string indicating the kind of risk measure (Value-at-Risk (VaR) or expected shortfall (ES)).

Value

get.gam.fit() returns a list with components

covar:

(unique/minimalized) covariate combinations;

fit:

corresponding fitted values of lambda or rho.

gam.predict() returns a list with components

covar:

covariate combinations as provided by newdata;

predict:

predicted lambda or rho;

CI.low:

lower confidence interval (based on predicted values);

CI.up:

upper confidence interval (based on predicted values).

get.GPD.fit() returns a list with components

xi:

list with components

covar:

(possibly empty) data.frame containing the unique/minimal covariate combinations for the covariates used for fitting \(\xi\);

fit:

corresponding fitted \(\xi\);

CI.low:

lower confidence interval (bootstrapped pointwise two-sides 1-\(\alpha\));

CI.up:

upper confidence interval (bootstrapped pointwise two-sides 1-\(\alpha\));

boot:

matrix containing the corresponding bootstrapped \(\xi\)'s (or NULL if none of the bootstrap repetitions worked).

beta:

similar as for xi.

GPD.predict() returns a list with components

xi:

list with components

covar:

data.frame containing the covariate combinations as provided by xi.newdata;

predict:

predicted \(\xi\)'s;

beta:

similar as for xi.

risk.measure() returns a vector of values of the selected risk measure.

Details

Note that if gam() fails in gamGPDfit() or the fitting or one of the bootstrap replications in gamGPDboot(), then x contains (an) empty (sub)list(s). These empty lists will be removed from the output of get.GPD.fit(). Hence, the subcomponent xi$fit of the output of get.GPD.fit() can contain less columns than the chosen number of bootstrap replications for creating x (each bootstrap replication with failed gam() calls is omitted). If there is any such failure, get.GPD.fit() outputs a warning. These failures typically happen for too small sample sizes.

References

Chavez-Demoulin, V., Embrechts, P., and Hofert, M., An extreme value approach for modeling Operational Risk losses depending on covariates.

Examples

Run this code
# NOT RUN {
## see demo(game) for how to use these functions
# }

Run the code above in your browser using DataCamp Workspace