Skip to contents

Rendered from docs/guides/esg-multi-year-projection.qmd. The code runs each time the site is built, so the output below is current.

Use this guide when

You need more than one year: the surplus of a company over a five-year plan, the probability that it is ruined or breaches its capital requirement within the plan, and how much of that comes from the economy (interest rates and inflation) rather than from the losses. That is dynamic financial analysis (DFA): an economic scenario generator (ESG) simulates the economy, and a projection runs the company’s premium, losses, reserves, assets, tax and capital rules along each economic path.

This is the R twin of the Python guide esg-multi-year-projection.md, with the same sections, seeds and numbers.

Terms:

  • Short rate: the instantaneous interest rate that a one-factor model simulates (Vasicek, Cox-Ingersoll-Ross or Hull-White); bond prices and the yield curve follow from it.
  • Economic inflation and superimposed inflation: the general price index, and the extra growth of claims costs above it (legal, medical). The claims index carries both.
  • Ruin: the surplus before any capital injection falls below zero at a year end. Breach: it falls below a required capital.
  • Underwriting cycle: the rate adequacy of the premium moving in waves, an AR(2) on its logarithm.

The design note is docs/design/esg-dfa.md; the models’ formulas are in the Rust reference of prospicio-esg and prospicio_aggregate::dfa.

How the numbers here are checked. CI (R/prospicio/tests/test-guides.R) runs each chunk that has a text block after it and compares its output with that text.

1. The economy

esg() puts a short-rate model, economic inflation (an Ornstein-Uhlenbeck rate) and superimposed inflation (an AR(1)) together, with the correlation of their shocks. Annual steps suffice for a five-year plan; monthly steps are the default.

library(prospicio)

model <- esg(
  vasicek(0.25, 0.035, 0.012, 0.03),          # speed, long-run rate, volatility, rate today
  inflation = esg_inflation(0.4, 0.025, 0.01, 0.03),
  superimposed = superimposed_inflation(0.01, 0.5, 0.01),  # mean, persistence, volatility
  correlation = rbind(c(1, 0.5, 0.2), c(0.5, 1, 0.3), c(0.2, 0.3, 1)),
  step = "annual"
)
SIMS <- 2000
YEARS <- 5
scenarios <- esg_simulate(model, YEARS, SIMS, seed = 1)
rates <- short_rates(scenarios)
claims_index <- index_levels(scenarios, "claims")
cat("shape", dim(rates), "\n")
## shape 2000 6
cat("mean short rate by year end ", sprintf("%.4f", colMeans(rates)), "\n")
## mean short rate by year end  0.0300 0.0307 0.0316 0.0321 0.0326 0.0331
cat("mean claims index by year end", sprintf("%.3f", colMeans(claims_index)), "\n")
## mean claims index by year end 1.000 1.040 1.079 1.120 1.161 1.204
q <- quantile(claims_index[, YEARS + 1], c(0.05, 0.95))
cat(sprintf("claims index at year 5: 5%% %.3f, 95%% %.3f\n", q[1], q[2]))
## claims index at year 5: 5% 1.091, 95% 1.320

Each matrix has one row per path and one column per step from today. Path s draws from its own stream, so it is the same whatever the number of paths or threads. scenario_curve(scenarios, s, j) and bond_prices(scenarios, j) give the yield curve and bond prices on a path, and deflators() the stochastic discount factors.

2. A company along the paths

dfa_projection() takes the new losses of each year in today’s money (one row per path), the opening assets, and the plan: premiums, the expense ratio, the opening reserves’ run-off, the payout pattern of new losses, the assets’ bond buckets (a data frame of share and duration, the rest in cash) and tax. Along each economic path the losses are scaled by the claims index, the reserves by the same index as they are paid, and the assets earn the path’s rates.

losses <- matrix(draws(lognormal_from_mean_cv(650, 0.25), SIMS * YEARS, seed = 2),
                 nrow = SIMS, byrow = TRUE)
plan <- list(
  premiums = rep(1000, YEARS),
  expense_ratio = 0.3,
  opening_reserves = c(400, 250, 150, 100, 50),
  payout = c(0.4, 0.3, 0.2, 0.1),
  bonds = data.frame(share = 0.6, duration = 5),
  tax_rate = 0.21
)
project <- function(...) run_projection(do.call(dfa_projection, c(list(losses, 2000), plan, list(...))),
                                        scenarios)
paths <- project()
surplus <- projection_values(paths, "surplus")
cat(sprintf("opening surplus %.0f\n", paths@opening_surplus))
## opening surplus 1050
cat("mean surplus by year end", sprintf("%.0f", colMeans(surplus)), "\n")
## mean surplus by year end 1093 1116 1121 1110 1079
cat(sprintf("1%% of the year-5 surplus %.0f\n", quantile(surplus[, YEARS], 0.01)))
## 1% of the year-5 surplus -111
cat("lines:", paste(projection_lines(), collapse = ", "), "\n")
## lines: premium, expenses, incurred_losses, reserve_development, investment_income, result, paid, assets, reserves, surplus, tax, dividends, injections, surplus_before_capital

The losses are 65% of premium in today’s money, but the claims index grows about 4% a year, so the margin shrinks year by year and the mean surplus turns down after year 3. projection_values(paths, line) gives any line of the projection by path and year.

3. Ruin and capital breach

ruin_probability(paths, horizon) is the share of paths whose surplus before capital falls below zero at some year end within the horizon, with its binomial standard error. capital_breach(paths, horizon, capital) tests a required capital: an amount, a vector by year, or a ratio to premium or to reserves with basis.

show <- function(label, p) {
  r <- ruin_probability(p, 5)
  b <- capital_breach(p, 5, 0.6, basis = "premium")
  cat(sprintf("%-12s ruin %.4f (se %.4f), breach of 60%% of premium %.4f, mean shortfall %.0f\n",
              label, r$probability, r$standard_error, b$probability, b$shortfall))
}
show("independent", paths)
## independent  ruin 0.0150 (se 0.0027), breach of 60% of premium 0.1615, mean shortfall 144

4. Losses that move with the economy

The claims index already moves the losses’ level with the economy. A bad year for inflation is often a bad year for losses beyond that (the same courts, the same supply shortages), which dependence adds: a copula on the ranks of each year’s losses and the path’s index growth. A Gumbel copula puts the dependence in the upper tail, which is where it hurts.

dependent <- project(dependence = "gumbel", dependence_parameter = 1.5, dependence_seed = 3)
show("gumbel 1.5", dependent)
## gumbel 1.5   ruin 0.0695 (se 0.0057), breach of 60% of premium 0.2205, mean shortfall 190
cat(sprintf("1%% of the year-5 surplus %.0f\n",
            quantile(projection_values(dependent, "surplus")[, YEARS], 0.01)))
## 1% of the year-5 surplus -759

The losses’ distribution in each year is unchanged; only which path gets which loss moves. The mean surplus hardly changes, but the ruin probability is several times higher and the 1% surplus far lower: the high losses now fall on the paths where the index grew fastest. "gaussian", "t" (with dependence_nu), "clayton", "frank" and "joe" are the other families.

5. The underwriting cycle and capital rules

An underwriting_cycle() scales each year’s premium by an AR(2) rate adequacy; its period is cycle@period years. Capital rules pay dividends above a ratio of premium (or reserves) and inject capital up to a floor.

cycle <- underwriting_cycle(0, 1.2, -0.6, 0.05, 0)   # mean, phi1, phi2, volatility, start
cat(sprintf("cycle period %.1f years\n", cycle@period))
## cycle period 9.2 years
cyclical <- project(cycle = cycle, cycle_seed = 4)
premium <- projection_values(cyclical, "premium")
cat("premium standard deviation by year",
    sprintf("%.1f", apply(premium, 2, function(x) sqrt(mean((x - mean(x))^2)))), "\n")
## premium standard deviation by year 48.2 79.5 92.3 92.5 91.0
show("cycle", cyclical)
## cycle        ruin 0.0260 (se 0.0036), breach of 60% of premium 0.1720, mean shortfall 150
managed <- project(dividend_above = 1.8, inject_below = 0.8)
cat("mean injections by year", sprintf("%.1f", colMeans(projection_values(managed, "injections"))),
    "\n")
## mean injections by year 5.7 10.4 17.1 22.4 32.2
cat(sprintf("ruin with injections up to 80%% of premium %.4f\n",
            ruin_probability(managed, 5)$probability))
## ruin with injections up to 80% of premium 0.0030

The cycle adds premium volatility, and with it ruin. The ruin test reads the surplus before capital, so the injections lower it only because a company topped up in an earlier year starts the next one stronger. Their mean by year is the capital the plan needs from outside.

See also