By the end of this chapter, the student should be able to:
Previous chapters introduced Value-at-Risk, Expected Shortfall, Extreme Value Theory, the Generalized Pareto Distribution, and threshold selection. These methods provide statistical tools for estimating tail risk. However, statistical tail models do not answer every practical risk management question.
A risk manager may also want to ask direct questions such as: what would happen if the exchange rate depreciated sharply tomorrow? What would happen if equity prices fell by 20%? What would happen if interest rates increased suddenly? What would happen if several adverse events occurred at the same time?
These questions are answered using stress testing and scenario analysis. Stress testing examines the effect of extreme but plausible shocks on a portfolio, institution, or financial system. Scenario analysis studies the effect of a defined set of changes in risk factors. The two ideas are closely related. A stress test may be built using one or more scenarios, and a scenario analysis may be designed specifically to represent stressed conditions.
Stress testing is important because financial crises often involve combinations of events that are difficult to capture fully using ordinary statistical models. During crises, correlations may increase, liquidity may disappear, volatility may rise, and market participants may behave differently from normal periods. A model based only on historical averages or recent volatility may underestimate these effects.
Therefore, stress testing complements VaR, Expected Shortfall, and EVT-based risk measurement. It does not replace them. Instead, it helps risk managers understand what could happen under severe but plausible conditions.
Stress testing is a risk management technique used to evaluate the effect of extreme adverse conditions on a portfolio, firm, bank, insurer, pension fund, or financial system.
In simple terms, stress testing asks: what would happen to the portfolio if a severe shock occurred?
The shock may affect one risk factor or many risk factors. Examples of risk factors include exchange rates, interest rates, equity prices, commodity prices, credit spreads, inflation rates, default rates, and volatility.
For example, a Kenyan importer with large dollar-denominated obligations may be concerned about depreciation of the Kenya shilling against the US dollar. A stress test may ask what happens if the exchange rate increases by 10%, 20%, or 30%. A bank may stress test its loan book by asking what happens if default rates double. A pension fund may stress test its assets by assuming a large fall in equity prices and a simultaneous rise in bond yields.
The output of a stress test is usually a stressed loss, change in portfolio value, capital shortfall, liquidity gap, or solvency impact. The purpose is not only to estimate a number but also to support decision-making. If the stressed loss is too large, management may reduce exposures, hedge risks, increase capital, revise limits, or prepare contingency plans.
VaR estimates a loss threshold associated with a chosen confidence level and time horizon. For example, a one-day 99% VaR estimates a loss level that is exceeded with probability 1% under the model.
Expected Shortfall estimates the average loss beyond the VaR threshold. It gives more information about the severity of tail losses than VaR.
Stress testing is different. It does not necessarily begin with a probability level. Instead, it begins with a specified adverse event or set of adverse conditions. The event may be based on history, expert judgement, macroeconomic assumptions, regulatory requirements, or internal risk concerns.
For example, VaR may say that the 99% one-day loss is KSh 50 million. Expected Shortfall may say that the average loss beyond that level is KSh 75 million. A stress test may ask what happens if the shilling depreciates by 25%, interest rates rise by 300 basis points, and equity markets fall by 20% at the same time.
Thus, VaR and Expected Shortfall are probability-based tail measures, while stress testing is scenario-based. The two approaches answer different questions and should be used together.
Scenario analysis is the process of evaluating the effect of a specified set of changes in risk factors. A scenario describes a possible state of the world. It may involve one shock or several shocks occurring together.
For example, a simple exchange rate scenario may be that the KES/USD exchange rate depreciates by 15%.
A broader macro-financial scenario may be that the Kenya shilling depreciates by 20%, equity prices fall by 25%, and interest rates rise by 300 basis points.
Scenario analysis is useful because it allows the analyst to examine the combined impact of several risk factors. In real crises, losses rarely come from one isolated factor. Exchange rates, interest rates, equity prices, credit spreads, and liquidity conditions may move together.
The scenario must be clear enough to be applied to the portfolio. A vague statement such as “markets become bad” is not enough. The analyst must translate the scenario into numerical changes in risk factors.
Stress scenarios can be classified into historical scenarios, hypothetical scenarios, sensitivity scenarios, and reverse stress tests.
Historical scenarios are based on actual past events. Examples include the 1987 stock market crash, the Asian financial crisis, the global financial crisis, currency crises, sovereign debt crises, or pandemic-related market shocks. The advantage of historical scenarios is that they are realistic because they actually occurred. Their limitation is that the future may not repeat the past exactly.
Hypothetical scenarios are designed by analysts, risk managers, regulators, or policymakers. They may be based on expert judgement or imagined but plausible adverse conditions. For example, a bank may ask what happens if interest rates rise by 500 basis points and default rates double. The advantage of hypothetical scenarios is flexibility. Their limitation is that they may depend heavily on subjective assumptions.
Sensitivity scenarios change one risk factor at a time. For example, the analyst may increase the exchange rate by 5%, 10%, 15%, 20%, and 25% and observe the effect on portfolio value. Sensitivity analysis is useful for understanding which risk factors have the greatest effect.
Reverse stress testing starts with an adverse outcome and asks what scenario could cause it. For example, a firm may ask: what combination of exchange rate movement, interest rate increase, and sales decline would cause insolvency? Reverse stress testing is useful because it helps identify vulnerabilities that may not be obvious under ordinary stress scenarios.
A useful stress test should be severe, plausible, relevant, and interpretable.
A severe scenario is strong enough to challenge the institution or portfolio. If the shock is too mild, the stress test may provide little information beyond ordinary risk measurement.
A plausible scenario is extreme but not impossible. Stress testing is not about arbitrary fantasy numbers. It should represent conditions that could reasonably occur, even if their probability is low.
A relevant scenario is connected to the actual risk exposures of the institution. A firm with no foreign-currency exposure gains little from a detailed exchange-rate stress test. A bank with a large loan book should pay attention to default rates, credit spreads, collateral values, and interest rates.
An interpretable scenario is stated clearly enough for management and students to understand. The assumptions should be explicit. The output should explain the effect of the scenario on losses, capital, liquidity, profitability, or solvency.
A simple stress-testing workflow is: identify the portfolio or exposure to be stressed; identify the key risk factors; choose the stress scenario; translate the scenario into numerical shocks; revalue the portfolio under the stressed conditions; calculate the stressed loss; interpret the result; and recommend possible risk management actions.
Exchange rate risk is a major concern for firms with foreign-currency assets, liabilities, revenues, or costs. If a firm owes money in foreign currency, depreciation of the local currency can increase the local-currency value of the obligation.
Suppose a Kenyan firm must pay USD 1,000,000 in three months. If the current exchange rate is KSh 130 per USD, the current shilling value of the obligation is KSh 130,000,000. If the Kenya shilling depreciates by 20%, the new exchange rate becomes KSh 156 per USD. The new shilling obligation becomes KSh 156,000,000. The stress loss is therefore KSh 26,000,000.
usd_liability <- 1000000
spot_rate <- 130
stress_depreciation <- c(0.05, 0.10, 0.15, 0.20, 0.25, 0.30)
exchange_stress <- tibble(
Depreciation = stress_depreciation,
Stressed_Exchange_Rate = spot_rate * (1 + Depreciation),
Current_KSh_Value = usd_liability * spot_rate,
Stressed_KSh_Value = usd_liability * Stressed_Exchange_Rate,
Stress_Loss = Stressed_KSh_Value - Current_KSh_Value
)
exchange_stress
exchange_stress_plot <- exchange_stress %>%
mutate(
KES_Depreciation_Percent = Depreciation * 100,
Loss_Millions = Stress_Loss / 1000000
)
ggplot(exchange_stress_plot, aes(x = KES_Depreciation_Percent, y = Loss_Millions)) +
geom_line() +
geom_point() +
scale_x_continuous(labels = label_number(suffix = "%")) +
scale_y_continuous(labels = label_number()) +
labs(
title = "Exchange Rate Stress Test",
x = "KES depreciation",
y = "Loss (KSh millions)"
)
The stress loss increases as the depreciation becomes more severe. This kind of table is useful for firms that have foreign-currency obligations and need to understand the possible effect of exchange rate movements.
An equity portfolio is exposed to falls in market prices. A simple equity stress test applies percentage declines to the portfolio value.
Suppose a portfolio is currently worth KSh 50 million. If equity prices fall by 10%, the portfolio loses KSh 5 million. If equity prices fall by 30%, the portfolio loses KSh 15 million.
portfolio_value <- 50000000
equity_shocks <- c(-0.05, -0.10, -0.15, -0.20, -0.25, -0.30, -0.40)
equity_stress <- tibble(
Equity_Shock = equity_shocks,
Stressed_Portfolio_Value = portfolio_value * (1 + Equity_Shock),
Stress_Loss = portfolio_value - Stressed_Portfolio_Value
)
equity_stress
equity_stress_plot <- equity_stress %>%
mutate(
Equity_Price_Fall_Percent = abs(Equity_Shock) * 100,
Loss_Millions = Stress_Loss / 1000000
)
ggplot(equity_stress_plot, aes(x = Equity_Price_Fall_Percent, y = Loss_Millions)) +
geom_line() +
geom_point() +
scale_x_continuous(labels = label_number(suffix = "%")) +
scale_y_continuous(labels = label_number()) +
labs(
title = "Equity Portfolio Stress Test",
x = "Equity price fall",
y = "Loss (KSh millions)"
)
The stress loss is larger for more severe market declines. This simple example assumes that the whole portfolio moves exactly with the equity shock. In practice, different assets may have different sensitivities to market movements.
Interest rate stress testing is important for banks, bond investors, pension funds, insurers, and borrowers. Bond prices generally fall when interest rates rise. A simple approximation uses duration.
If a bond portfolio has modified duration D, then the approximate percentage change in value for a small change in yield is:
\[ \frac{\Delta P}{P}\approx -D\Delta y. \]
Suppose a bond portfolio is worth KSh 100 million and has modified duration 4. If interest rates rise by 2%, or 0.02 in decimal form, the approximate percentage change in value is -8%. The portfolio loses approximately KSh 8 million.
bond_portfolio_value <- 100000000
modified_duration <- 4
rate_shocks <- c(0.005, 0.01, 0.015, 0.02, 0.025, 0.03)
interest_rate_stress <- tibble(
Rate_Shock_Basis_Points = rate_shocks * 10000,
Approx_Percentage_Change = -modified_duration * rate_shocks,
Stressed_Portfolio_Value = bond_portfolio_value * (1 + Approx_Percentage_Change),
Stress_Loss = bond_portfolio_value - Stressed_Portfolio_Value
)
interest_rate_stress
interest_rate_stress_plot <- interest_rate_stress %>%
mutate(
Interest_Rate_Increase_Bps = Rate_Shock_Basis_Points,
Loss_Millions = Stress_Loss / 1000000
)
ggplot(interest_rate_stress_plot, aes(x = Interest_Rate_Increase_Bps, y = Loss_Millions)) +
geom_line() +
geom_point() +
scale_x_continuous(labels = label_number()) +
scale_y_continuous(labels = label_number()) +
labs(
title = "Interest Rate Stress Test Using Duration",
x = "Interest rate increase (basis points)",
y = "Loss (KSh millions)"
)
The duration approximation is useful for simple stress testing, but it becomes less accurate for very large interest rate changes or portfolios with strong convexity effects.
Real stress events often involve several shocks at the same time. For example, a financial crisis may involve exchange rate depreciation, equity market decline, interest rate increases, widening credit spreads, and reduced liquidity.
Suppose a firm has three exposures: a USD liability of USD 1,000,000; an equity portfolio worth KSh 50 million; and a bond portfolio worth KSh 100 million with modified duration 4.
Consider a stress scenario in which the Kenya shilling depreciates by 20%, equity prices fall by 25%, and interest rates rise by 200 basis points. The total stress loss is the sum of the losses from the three risk factors, assuming no offsetting effects.
usd_liability <- 1000000
spot_rate <- 130
equity_value <- 50000000
bond_value <- 100000000
duration <- 4
kes_depreciation <- 0.20
equity_decline <- 0.25
rate_increase <- 0.02
fx_loss <- usd_liability * spot_rate * kes_depreciation
equity_loss <- equity_value * equity_decline
bond_loss <- bond_value * duration * rate_increase
total_stress_loss <- fx_loss + equity_loss + bond_loss
combined_scenario <- tibble(
Risk_Factor = c("Exchange rate", "Equity market", "Interest rate"),
Scenario = c("KES depreciates by 20%", "Equity prices fall by 25%", "Rates rise by 200 bps"),
Stress_Loss = c(fx_loss, equity_loss, bond_loss)
)
combined_scenario
tibble(Total_Stress_Loss = total_stress_loss)
combined_scenario_plot <- combined_scenario %>%
mutate(Loss_Millions = Stress_Loss / 1000000)
ggplot(combined_scenario_plot, aes(x = Risk_Factor, y = Loss_Millions)) +
geom_col() +
scale_y_continuous(labels = label_number()) +
labs(
title = "Loss Contribution Under Combined Stress Scenario",
x = "Risk factor",
y = "Loss (KSh millions)"
)
The combined scenario shows how different exposures contribute to total stress loss. This is useful for identifying the largest sources of vulnerability.
A historical scenario applies shocks observed during a past crisis. A hypothetical scenario applies shocks chosen by the analyst. The following example compares three scenarios: mild stress, severe stress, and crisis stress.
scenario_assumptions <- tibble(
Scenario = c("Mild stress", "Severe stress", "Crisis stress"),
KES_Depreciation = c(0.10, 0.20, 0.30),
Equity_Decline = c(0.10, 0.25, 0.40),
Rate_Increase = c(0.01, 0.02, 0.035)
)
scenario_results <- scenario_assumptions %>%
mutate(
FX_Loss = usd_liability * spot_rate * KES_Depreciation,
Equity_Loss = equity_value * Equity_Decline,
Bond_Loss = bond_value * duration * Rate_Increase,
Total_Loss = FX_Loss + Equity_Loss + Bond_Loss
)
scenario_results
scenario_results_plot <- scenario_results %>%
mutate(Total_Loss_Millions = Total_Loss / 1000000)
ggplot(scenario_results_plot, aes(x = Scenario, y = Total_Loss_Millions)) +
geom_col() +
scale_y_continuous(labels = label_number()) +
labs(
title = "Total Loss Under Alternative Stress Scenarios",
x = "Scenario",
y = "Total loss (KSh millions)"
)
Scenario analysis allows the analyst to compare different levels of severity. The crisis stress scenario gives the largest loss because it combines the most severe exchange rate, equity, and interest rate shocks.
Reverse stress testing starts from a specified failure point and asks what conditions could cause it. Instead of asking what loss would result from a given scenario, reverse stress testing asks what scenario would produce an unacceptable loss.
Suppose management states that a total stress loss of KSh 50 million would be unacceptable. We can ask what equity decline, exchange rate depreciation, and interest rate increase might produce that loss.
A simple reverse stress test can vary one factor while holding others fixed. For example, if the exchange rate depreciation and interest rate increase are fixed, we can solve for the equity decline that would produce the target loss.
target_loss <- 50000000
fixed_fx_depreciation <- 0.20
fixed_rate_increase <- 0.02
fixed_fx_loss <- usd_liability * spot_rate * fixed_fx_depreciation
fixed_bond_loss <- bond_value * duration * fixed_rate_increase
required_equity_loss <- target_loss - fixed_fx_loss - fixed_bond_loss
required_equity_decline <- required_equity_loss / equity_value
tibble(
Target_Loss = target_loss,
Fixed_FX_Loss = fixed_fx_loss,
Fixed_Bond_Loss = fixed_bond_loss,
Required_Equity_Loss = required_equity_loss,
Required_Equity_Decline = required_equity_decline
)
If the required equity decline is plausible, then the firm has identified a meaningful vulnerability. If the required decline is extremely unrealistic, the target loss may require a different combination of stress factors.
Stress testing and EVT are complementary. EVT provides statistical tools for estimating tail probabilities and extreme quantiles. Stress testing provides scenario-based tools for evaluating losses under specified adverse conditions.
EVT may help inform stress testing by estimating the size of rare tail losses. For example, an EVT model may estimate a 99.5% VaR or Expected Shortfall. These estimates can be used as inputs when designing severe but plausible scenarios.
Stress testing may also reveal weaknesses in statistical models. A VaR model may appear acceptable under normal back-testing, but a scenario analysis may show that the institution is highly exposed to a particular risk factor. Similarly, an EVT model may estimate tail losses from historical data, while a hypothetical stress scenario may consider new combinations of shocks not present in the historical record.
The most useful risk management framework combines statistical risk measures, EVT-based tail modelling, stress testing, scenario analysis, and expert judgement.
Stress testing is powerful, but it has limitations.
First, scenario design can be subjective. Different analysts may choose different shocks, and the results may depend strongly on the assumptions.
Second, stress tests may ignore probabilities. A scenario may be severe, but the stress test may not say how likely it is. This is different from VaR and Expected Shortfall, which are tied to probability levels.
Third, stress tests may miss important interactions between risk factors. During crises, relationships between variables may change. Correlations may increase, liquidity may decline, and market reactions may be nonlinear.
Fourth, stress testing may create a false sense of security if the chosen scenarios are too mild or too narrow. A portfolio may pass the selected stress tests but still be vulnerable to scenarios that were not considered.
Fifth, stress tests depend on data quality and valuation models. If the exposure data or pricing models are wrong, the stress-test results may be misleading.
For these reasons, stress testing should be repeated regularly, updated as market conditions change, and used together with other risk measurement tools.
This application combines VaR, Expected Shortfall, and stress testing. We simulate portfolio returns, compute empirical VaR and ES, then compare these statistical tail measures with losses under specified stress scenarios.
set.seed(2026)
n <- 2500
portfolio_value <- 100000000
portfolio_returns <- rt(n, df = 5) / 100
portfolio_losses_percent <- -portfolio_returns
portfolio_losses_ksh <- portfolio_value * portfolio_losses_percent
VaR_95 <- as.numeric(quantile(portfolio_losses_ksh, 0.95))
VaR_99 <- as.numeric(quantile(portfolio_losses_ksh, 0.99))
ES_95 <- mean(portfolio_losses_ksh[portfolio_losses_ksh > VaR_95])
ES_99 <- mean(portfolio_losses_ksh[portfolio_losses_ksh > VaR_99])
statistical_risk <- tibble(
Measure = c("VaR", "VaR", "Expected Shortfall", "Expected Shortfall"),
Confidence_Level = c("95%", "99%", "95%", "99%"),
Loss_KSh = c(VaR_95, VaR_99, ES_95, ES_99)
)
statistical_risk
stress_scenarios <- tibble(
Scenario = c("Market falls 5%", "Market falls 10%", "Market falls 20%", "Market falls 30%"),
Portfolio_Shock = c(-0.05, -0.10, -0.20, -0.30),
Stress_Loss_KSh = portfolio_value * abs(Portfolio_Shock)
)
stress_scenarios
comparison_data <- bind_rows(
statistical_risk %>%
transmute(Item = paste(Measure, Confidence_Level), Loss_Millions = Loss_KSh / 1000000),
stress_scenarios %>%
transmute(Item = Scenario, Loss_Millions = Stress_Loss_KSh / 1000000)
)
ggplot(comparison_data, aes(x = reorder(Item, Loss_Millions), y = Loss_Millions)) +
geom_col() +
coord_flip() +
scale_y_continuous(labels = label_number()) +
labs(
title = "Comparison of Statistical Risk Measures and Stress Scenario Losses",
x = "Measure or scenario",
y = "Loss (KSh millions)"
)
This comparison shows that stress scenario losses can be larger or smaller than VaR and Expected Shortfall depending on the severity of the assumed shock. This is why stress testing and statistical risk measurement should be interpreted together.
Students often confuse stress testing with VaR. VaR is tied to a probability level, while stress testing is tied to a specified adverse scenario.
Another common mistake is to design scenarios that are too mild. A stress test should be severe enough to challenge the portfolio or institution.
Students may also forget to state assumptions clearly. A scenario must specify the size and direction of each risk factor shock.
Another mistake is to treat stress-test results as forecasts. A stress test does not necessarily predict what will happen. It evaluates what would happen if the stated scenario occurred.
Students also sometimes ignore interactions between risk factors. In real crises, several shocks may occur together.
Finally, students may assume that passing a stress test means the institution is safe. This is not true. It only means that the institution appears able to withstand the selected scenario under the assumptions used.
A financial institution uses VaR and Expected Shortfall to measure market risk. However, senior management is concerned that these statistical measures may not fully capture the effect of severe market disruptions. The risk manager is asked to design a stress testing and scenario analysis framework.
Required: