## Defining and Sampling Vectors of Discrete and Cumulative Distributions

**Download**

# Description

Overview: There are a few stochastic types in GoldSim that cannot be defined as a vector. These are discrete, cumulative and sampled distributions. For at least the discrete and cumulative distribution types, there is a way to effectively define and sample a vector stochastic. This example shows how to do this using (1) a vector uniform 0-1 stochastic to sample probability level values and (2) a script element to get the corresponding values.

Required inputs to the script element are a vector of values and a matrix of probabilities. Each column of the matrix corresponds to a different distribution definition. The size of a column (i.e. the number of rows in the probability matrix) is the same as the size of the value vector. A column contains probabilities that correspond to the values in the value vector. For a discrete distribution, the probabilities in each column should add to 1. For a cumulative distribution, the probabilities in each column should monotonically increase to 1.

Results: Run the model and compare observed discrete probabilities in 'Sampled Values 1' and 'Sampled Values 2' to the screenshot of defined discrete probability values. Latin Hypercube sampling is turned on, so the observed probabilities should be identical or very close to the expected probabilities. If LHS is turned off, observed probabilities should approach the expected values as the number of realizations is increased.

# Additional Information

## Keywords

vector, stochastic, distribution, discrete, cumulative

## Categories

GoldSim Features & Capabilities, Probabilistic Modeling, Arrays, DLLs & Scripts