Parametric Sampling
Parametric distributions can be either normal (mean-variance assumption) or lognormal (Black-Scholes assumption). When moments=’deterministic’ (default), the algorithm from Simulations with Exact Means and Covariances is applied to the discrete or log returns.
- simulate_multivariate_normal(mean, covariance_matrix, S, distribution='normal', moments='deterministic', seed=None)
Function for simulating from a multivariate normal or lognormal distribution.
- Parameters:
mean (
ndarray) – np.ndarray with shape (I,) containing the means of the normal distribution.covariance_matrix (
ndarray) – Covariance matrix with shape (I, I) containing the covariances of the normal distribution.S (
int) – Number of simulation scenarios (must be an even number for moments=’deterministic’).distribution (
str) – {‘normal’, ‘lognormal’}. Default: ‘normal’.moments (
str) – {‘deterministic’, ‘stochastic’}. Default: ‘deterministic’.seed (
int) – Random seed for the simulation.
- Return type:
ndarray- Returns:
Simulation with shape (S, I).
- Raises:
ValueError – If there is a mismatch between mean and covariance_matrix dimensions.
ValueError – If covariance_matrix is not a square two-dimensional matrix.
TypeError – If S is not an integer.
ValueError – If distribution is not in {‘normal’, ‘lognormal’}.
ValueError – If moments are not in {‘deterministic’, ‘stochastic’}.
ValueError – If S is not an even integer for moments=’deterministic’.
TypeError – If seed is not an integer.