Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Scenario Stress and Sensitivity Analysis | Monte Carlo Simulation for Uncertainty and Risk
Simulation and Monte Carlo Modeling with Python

bookScenario Stress and Sensitivity Analysis

Scenario stress testing and sensitivity analysis are essential tools in Monte Carlo simulation, especially when you want to understand how robust your model is to changes in assumptions or input parameters. Scenario stress testing involves intentionally changing one or more key parametersβ€”such as the mean or volatility of a distributionβ€”to see how extreme or adverse scenarios would affect the outcome. Sensitivity analysis, on the other hand, systematically explores how variations in inputs influence the results, helping you identify which parameters have the most significant impact on your simulation outputs. Both techniques are critical for risk management and decision-making, as they reveal how sensitive your predictions are to uncertainty in the model's assumptions.

12345678910111213141516171819202122232425262728293031
import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Set random seed for reproducibility np.random.seed(42) # Define simulation parameters n_simulations = 10000 base_mean = 0 base_std = 1 # Scenario 1: Baseline (mean=0, std=1) baseline = np.random.normal(loc=base_mean, scale=base_std, size=n_simulations) # Scenario 2: Increased mean (mean=1, std=1) increased_mean = np.random.normal(loc=1, scale=base_std, size=n_simulations) # Scenario 3: Increased volatility (mean=0, std=2) increased_volatility = np.random.normal(loc=base_mean, scale=2, size=n_simulations) # Plot the distributions plt.figure(figsize=(10, 6)) sns.kdeplot(baseline, label="Baseline (mean=0, std=1)", fill=True, alpha=0.5) sns.kdeplot(increased_mean, label="Increased Mean (mean=1, std=1)", fill=True, alpha=0.5) sns.kdeplot(increased_volatility, label="Increased Volatility (mean=0, std=2)", fill=True, alpha=0.5) plt.title("Scenario Stress and Sensitivity Analysis") plt.xlabel("Simulated Value") plt.ylabel("Density") plt.legend() plt.show()
copy

When you review the simulation results, you can see how changing the mean shifts the entire distribution to the right, while increasing the volatility spreads the distribution wider, increasing the likelihood of more extreme outcomes. Sensitivity analysis like this makes it clear which parameters most affect your results: in this case, the mean determines the central tendency, and the standard deviation controls the spread or risk. By systematically varying these inputs, you can identify which factors your model is most sensitive to and prepare for possible adverse scenarios. This process is vital for understanding model risk and for making informed decisions when facing uncertainty.

question mark

Which of the following best describes the purpose of sensitivity analysis in Monte Carlo simulation?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 4

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain how to interpret the results of the plot?

What other parameters could I test for sensitivity in this simulation?

How would I apply scenario stress testing to a different type of distribution?

bookScenario Stress and Sensitivity Analysis

Swipe to show menu

Scenario stress testing and sensitivity analysis are essential tools in Monte Carlo simulation, especially when you want to understand how robust your model is to changes in assumptions or input parameters. Scenario stress testing involves intentionally changing one or more key parametersβ€”such as the mean or volatility of a distributionβ€”to see how extreme or adverse scenarios would affect the outcome. Sensitivity analysis, on the other hand, systematically explores how variations in inputs influence the results, helping you identify which parameters have the most significant impact on your simulation outputs. Both techniques are critical for risk management and decision-making, as they reveal how sensitive your predictions are to uncertainty in the model's assumptions.

12345678910111213141516171819202122232425262728293031
import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Set random seed for reproducibility np.random.seed(42) # Define simulation parameters n_simulations = 10000 base_mean = 0 base_std = 1 # Scenario 1: Baseline (mean=0, std=1) baseline = np.random.normal(loc=base_mean, scale=base_std, size=n_simulations) # Scenario 2: Increased mean (mean=1, std=1) increased_mean = np.random.normal(loc=1, scale=base_std, size=n_simulations) # Scenario 3: Increased volatility (mean=0, std=2) increased_volatility = np.random.normal(loc=base_mean, scale=2, size=n_simulations) # Plot the distributions plt.figure(figsize=(10, 6)) sns.kdeplot(baseline, label="Baseline (mean=0, std=1)", fill=True, alpha=0.5) sns.kdeplot(increased_mean, label="Increased Mean (mean=1, std=1)", fill=True, alpha=0.5) sns.kdeplot(increased_volatility, label="Increased Volatility (mean=0, std=2)", fill=True, alpha=0.5) plt.title("Scenario Stress and Sensitivity Analysis") plt.xlabel("Simulated Value") plt.ylabel("Density") plt.legend() plt.show()
copy

When you review the simulation results, you can see how changing the mean shifts the entire distribution to the right, while increasing the volatility spreads the distribution wider, increasing the likelihood of more extreme outcomes. Sensitivity analysis like this makes it clear which parameters most affect your results: in this case, the mean determines the central tendency, and the standard deviation controls the spread or risk. By systematically varying these inputs, you can identify which factors your model is most sensitive to and prepare for possible adverse scenarios. This process is vital for understanding model risk and for making informed decisions when facing uncertainty.

question mark

Which of the following best describes the purpose of sensitivity analysis in Monte Carlo simulation?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 4
some-alt