mcframework.core.SimulationResult#

class mcframework.core.SimulationResult[source]#

Bases: object

Container for the outcome of a Monte Carlo run.

Attributes:
resultsnumpy.ndarray

Float array of raw simulation values of length n_simulations.

n_simulationsint

Number of simulations performed.

execution_timefloat

Time taken to execute the simulations in seconds.

meanfloat

Sample mean \(\bar X\).

stdfloat

Sample standard deviation with ddof=1 (default for NumPy’s numpy.std()).

percentilesdict[int, float]

Dictionary of computed percentiles, e.g. {5: 0.05, 50: 0.50, 95: 0.95}.

statsdict

Additional statistics from the stats engine (e.g. "ci_mean", "skew", etc.).

metadatadict

Freeform metadata. Includes "simulation_name", "timestamp", "seed_entropy", "requested_percentiles", and "engine_defaults_used".

Methods

result_to_string

Pretty, human-readable summary of the result.

result_to_string(confidence: float = 0.95, method: str = 'auto') str[source]#

Pretty, human-readable summary of the result.

Prints the dictionary attributes in a readable format.

Parameters:
confidencefloat

Confidence level for the displayed CI. (default 0.95)

methodstr

Which critical value to use ("auto" chooses based on n). (default "auto")

Returns:
str

Multiline textual summary.

Notes

The parametric CI method for the mean is given by:

\[\bar{X} \pm c \frac{s}{\sqrt{n}}\]

where \(c\) is either a z or t critical value depending on method.

classmethod __new__(*args, **kwargs)#
__init__(results: ~numpy.ndarray, n_simulations: int, execution_time: float, mean: float, std: float, percentiles: dict[int, float], stats: dict[str, ~typing.Any] = <factory>, metadata: dict[str, ~typing.Any] = <factory>) None#