risk | R Documentation |
Computes Value-at-Risk (VaR) and Tail Value-at-Risk (TVaR) based on simulated insurance cash flows. The function supports discounting for multi-year horizons and can evaluate loss ratio (LR) or balance (BAL).
risk(
cf,
time_horizon = c(1),
level = c(0.005, 0.01, 0.1, 0.2, 0.5, 0.8, 0.9, 0.99, 0.995),
discount = 0,
output = "LR"
)
cf |
A data.frame containing simulated cash flow results. Must include columns: |
time_horizon |
A numeric vector specifying time horizons (e.g., c(1, 5, 10)). |
level |
A numeric vector of confidence levels for risk quantification (e.g., c(0.01, 0.1, 0.99)). |
discount |
Annual discount rate to convert future cash flows to present value. Default is 0 (no discount). |
output |
The metric to be analyzed: |
A data.frame summarizing VaR and TVaR values across the specified horizons and confidence levels.
# Using example_simulation dataset (assumes data is loaded)
result <- risk(example_simulation,
time_horizon = c(1, 10),
level = c(0.01, 0.99),
discount = 0.02,
output = "BAL")
print(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.