risk {mistr} | R Documentation |
Risk Measures of Fitted Objects
Description
risk
computes the VaR, ES and expectiles at a given level for fitted distribution.
Usage
risk(
model,
alpha,
expectile = TRUE,
plot = FALSE,
ggplot = FALSE,
text_ylim = -0.15,
size = 1
)
## S3 method for class 'PNP'
risk(
model,
alpha = 0.05,
expectile = TRUE,
plot = FALSE,
ggplot = FALSE,
text_ylim = -0.15,
size = 1
)
## S3 method for class 'GNG'
risk(
model,
alpha = 0.05,
expectile = TRUE,
plot = FALSE,
ggplot = FALSE,
text_ylim = -0.15,
size = 1
)
Arguments
model |
output object of |
alpha |
levels of risk measures. |
expectile |
logical, if also expectiles should be computed, default: TRUE. |
plot |
plot the results?, default: FALSE. |
ggplot |
plot the results with ggplot2?, default: FALSE. |
text_ylim |
y coordinate for annotation in ggplot2, default: -0.15. |
size |
size of the text indicating the risk measures in the plot, default: 1. |
Details
VaR are computed using the q()
call of the fitted distribution.
ES is computed directly (i.e. the integrals are precomputed, not numerically) as an integral of the quantile function.
Expectiles can be obtained as a unit-root solution of the identity between quantiles
and expectiles. These are equivalent for corresponding \tau
and \alpha
if
\tau=(\alpha q(\alpha) -G(\alpha))/(\mu - 2G(\alpha)-(1-2\alpha)q(\alpha))
where \mu
is mean, q()
is the quantile function and G(\alpha) =\int_{-\infty}^{q(\alpha)} y dF(y)
.
Value
List of class risk_measures.
Examples
## Not run:
GNG <- GNG_fit(stocks$SAP)
PNP <- PNP_fit(stocks$MSFT)
risk(PNP, alpha = c(0.01,0.05,0.08,0.1))
risk(GNG, alpha = c(0.01,0.05,0.08,0.1), plot = TRUE)
## End(Not run)