Learn R Programming

ReturnCurves (version 1.0.1)

rc_unc: Uncertainty of the Return Curve estimates

Description

Uncertainty assessment of the return curve estimates following the procedure of MurphyBarltropetal2023;textualReturnCurves.

Usage

rc_unc(retcurve, blocksize = 1, nboot = 250, nangles = 150, alpha = 0.05)

Value

An object of S4 class rc_unc.class. This object returns the arguments of the function and an extra slot unc which is a list containing:

median

A vector containing the median estimates of the return curve.

mean

A vector containing the mean estimates of the return curve.

lower

A vector containing the lower bound of the confidence interval.

upper

A vector containing the upper bound of the confidence interval.

The plot function takes an object of S4 class rc_unc.class, and a which argument specifying the type of plot desired (see Examples):

"rc"

Plots the estimated Return Curve and its uncertainty (default).

"median"

Plots the median estimates of the Return Curve and its uncertainty.

"mean"

Plots the mean estimates of the Return Curve and its uncertainty.

"all"

Plots the estimated Return Curve, the median and mean estimates of the Return Curve together, and the associated uncertainty.

Arguments

retcurve

An S4 object of class rc_est.class. See rc_est for more details.

blocksize

Size of the blocks for the block bootstrap procedure. If 1 (default), then a standard bootstrap approach is applied.

nboot

Number of bootstrap samples to be taken. Default is 250 samples.

nangles

Number of angles mm in the interval (0, /2) MurphyBarltropetal2023ReturnCurves. Default is 150 angles.

alpha

Significance level to compute the (1-)% confidence intervals. Default is 0.05.

Details

Define a set of angles := (m+1-j)2(m+1) 1 j m decreasing from near /2 to 00, and let L_:=(x,y) R^2_+ | ()=y/x denote the line segment intersecting the origin with gradient () > 0. For each , L_ intersects the estimated RC(p) exactly once, i.e. (x_, y_):= RC(p) L_. Uncertainty of the return curve is then quantified by the distribution of d_:=(x^2_ + y^2_)^1/2 via a (block) bootstrap procedure.

This procedure is as follows; for k = 1, ..., nboot:

1. (Block) bootstrap the original data set;

2. For each , obtain d_,k for the corresponding return curve point estimate.

Full details can be found in MurphyBarltropetal2023;textualReturnCurves

References

Examples

Run this code
library(ReturnCurves)

data(airdata)

n <- dim(airdata)[1]

prob <- 10/n

margdata <- margtransf(airdata)

rc_orig <- rc_est(margdata = margdata, p = prob, method = "hill")

# \donttest{
# Set nboot = 50 for an illustrative example
# blocksize to account for temporal dependence
unc <- rc_unc(rc_orig, blocksize = 10) 

# Plots the estimated Return Curve 
plot(unc, which = "rc") 

# Plots the median estimates of the Return Curve
plot(unc, which = "median") 

# Plots the mean estimates of the Return Curve
plot(unc, which = "mean") 

# Plots the estimated Return Curve and its the median and mean estimates
plot(unc, which = "all") 

# To see the the S4 object's slots
str(unc)

# To access the list of vectors
unc@unc
# }

Run the code above in your browser using DataLab