Introduction
Modeling asset returns or small-sample outcomes as Normal often understates how often extreme values actually occur — real financial and clinical data tend to have fatter tails than a bell curve accounts for. SimulateTDistributedOutcome runs a Monte Carlo simulation from a Student's T distribution instead, which behaves like a Normal distribution but with heavier tails controlled by a degrees-of-freedom parameter (approaching Normal as that parameter grows), making it a better fit for processes prone to outliers or built on sparse historical data.
Student's T distribution simulations are essential for:
- Finance: Modeling stock or asset returns that exhibit high kurtosis and "fat tails."
- Healthcare: Simulating patient outcomes in clinical trials with small sample sizes.
- Engineering: Modeling material failure stress where sparse data leads to higher uncertainty.
- Intelligence Analysis: Estimating the range of adversary capabilities with limited signal intelligence.
- Quality Control: Simulating product weight or dimension variability during initial production ramps.
- Environmental Science: Modeling extreme wind loads or rainfall events with high outlier potential.
- Social Science: Simulating standardized scores or survey metrics from niche demographics.
- Project Management: Estimating activity durations when historical records are sparse and risks are high.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
degrees_of_freedomrequired | float | — | The degrees of freedom (nu) parameter, which controls the 'fatness' of the tails. |
expected_outcome | float | 0 | The location (mean) of the distribution. Defaults to 0. |
standard_deviation_of_outcome | float | None | The scale (spread) of the distribution. If None, it must be estimated from min_max_of_outcome. Defaults to None. |
min_max_of_outcome | list | None | A list of length 2 [min, max] used to estimate the scale parameter based on the T distribution range rule. Defaults to None. |
number_of_trials | int | 10000 | The number of stochastic simulations (Monte Carlo trials) to run. Defaults to 10000. |
return_format | str | 'dataframe' | The format of the returned data: 'dataframe' (pd.DataFrame) or 'array' (np.ndarray). Defaults to 'dataframe'. |
simulated_variable_name | str | 'Simulated Outcome' | The label for the simulated variable in the output and plot. Defaults to 'Simulated Outcome'. |
random_seed | int | 412 | The seed for the random number generator to ensure replicability. Defaults to 412. |
plot_simulation_results | bool | True | Whether to display a histogram of the simulation outcomes. Defaults to True. |
fill_color | str | '#999999' | The hex color code for the histogram bars. Defaults to '#999999'. |
fill_transparency | float | 0.6 | The transparency level (0-1) for the histogram plot. Defaults to 0.6. |
figure_size | tuple | (8, 6) | The size of the plot figure in inches (width, height). Defaults to (8, 6). |
show_mean | bool | True | Whether to display the mean value as a vertical dashed line. Defaults to True. |
show_median | bool | True | Whether to display the median value as a vertical dotted line. Defaults to True. |
title_for_plot | str | 'Simulation Results' | The main title for the distribution plot. Defaults to 'Simulation Results'. |
subtitle_for_plot | str | 'Showing the distribution of the outcome' | The descriptive subtitle for the plot. |
caption_for_plot | str | None | Optional caption text displayed at the bottom of the plot. Defaults to None. |
data_source_for_plot | str | None | Optional data source identification text. Defaults to None. |
show_y_axis | bool | False | Whether to display the frequency/density scale on the y-axis. Defaults to False. |
title_y_indent | float | 1.1 | Vertical position for the title text. Defaults to 1.1. |
subtitle_y_indent | float | 1.05 | Vertical position for the subtitle text. Defaults to 1.05. |
caption_y_indent | float | -0.15 | Vertical position for the caption text. Defaults to -0.15. |
Returns
The simulated outcomes across all Monte Carlo runs — a pandas DataFrame or a NumPy array, depending on return_format.
Example
from analysistoolbox.simulations import SimulateTDistributedOutcome
# Finance: simulating daily returns with fat tails (df=5, mean=0.001, SD=0.02)
return_sim = SimulateTDistributedOutcome(
degrees_of_freedom=5,
expected_outcome=0.001,
standard_deviation_of_outcome=0.02,
simulated_variable_name='Daily Return',
title_for_plot='Asset Return Simulation with Outliers'
)