rc_unc | R Documentation |
Uncertainty assessment of the return curve estimates following the procedure of \insertCiteMurphyBarltropetal2023;textualReturnCurves.
rc_unc(retcurve, blocksize = 1, nboot = 250, nangles = 150, alpha = 0.05)
retcurve |
An S4 object of class |
blocksize |
Size of the blocks for the block bootstrap procedure. If |
nboot |
Number of bootstrap samples to be taken. Default is |
nangles |
\loadmathjax Number of angles \mjeqnmm in the interval \mjeqn(0, \pi/2) \insertCiteMurphyBarltropetal2023ReturnCurves. Default is |
alpha |
Significance level to compute the \mjeqn(1-\alpha)% confidence intervals. Default is |
Define a set of angles \mjdeqn\boldsymbol\Theta:= \left\lbrace \frac\pi(m+1-j)2(m+1) \mid 1\leq j\leq m\right\rbrace decreasing from near \mjeqn\pi/2 to \mjeqn00, and let \mjeqnL_\theta:=\left\lbrace(x,y)\in R^2_+ | \tan(\theta)=y/x\right\rbrace denote the line segment intersecting the origin with gradient \mjeqn\tan(\theta) > 0. For each \mjeqn\theta\in \boldsymbol\Theta, \mjeqnL_\theta intersects the estimated \mjeqn\hatRC(p) exactly once, i.e. \mjeqn\lbrace(\hatx_\theta, \haty_\theta)\rbrace:= \hatRC(p)\cap L_\theta. Uncertainty of the return curve is then quantified by the distribution of \mjeqn\hatd_\theta:=(\hatx^2_\theta + \haty^2_\theta)^1/2 via a (block) bootstrap procedure.
This procedure is as follows; for \mjeqnk = 1, ..., nboot
:
1. (Block) bootstrap the original data set;
2. For each \mjeqn\theta\in \boldsymbol\Theta, obtain \mjeqn\hatd_\theta,k for the corresponding return curve point estimate.
Full details can be found in \insertCiteMurphyBarltropetal2023;textualReturnCurves
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. |
library(ReturnCurves)
data(airdata)
n <- dim(airdata)[1]
prob <- 10/n
margdata <- margtransf(airdata)
rc_orig <- rc_est(margdata = margdata, p = prob, method = "hill")
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.