risk | R Documentation |
risk
computes the VaR, ES and expectiles at a given level for fitted distribution.
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 )
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. |
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 τ and α if
τ=(α q(α) -G(α))/(μ - 2G(α)-(1-2α)q(α))
where μ is mean, q() is the quantile function and G(α) =\int_{-∞}^{q(α)} y dF(y).
List of class risk_measures.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.