# Vector Distributions

## Using Vector Sampled, Cumulative and Discrete Distributions

### Description

Overview: It is not possible to define vector distributions for Sampled, Cumulative and Discrete Stochastics. This example shows how a vector of sampled values can be generated from a single distribution definition for any of these stochastic types.

Background: Stochastic elements have a distribution definition output from which statistics (e.g. mean, SD, percentile value) can be obtained using built-in GoldSim functions. One built-in function, PDF_Value, allows you to get a value corresponding to a specified cumulative probability. The syntax is as follows:

PDF_Value(Stochastic.Distribution, 0.8 )

The first argument is a Stochastic element distribution definition and the second argument is a cumulative probability. If this stochastic were a uniform distribution from 0 to 10, the expression would evaluate to 8.

Model Logic: This example model permits the selection of a Sampled, Cumulative or Discrete distribution from which to sample. A Selector element ('SampledValues') is used to generate a vector of sampled values for the selected distribution type. A vector uniform 0-1 stochastic ('ProbLevels') is sampled on each realization to provide a vector of cumulative probabilities. The Selector element uses the PDF_Value built-in function to get values corresponding to the sampled probability levels. A vector constructor must be used as shown in the example below:

vector( PDF_Value ( Cumulative.DistributionProbLevels[row] ) )

The 'row' keyword only has meaning when used inside of a vector constructor. GoldSim constructs the vector by iterating over indexes from 1 to the size of the vector (in this case 10). The vector generated by the expression above is composed of 10 evaluated expressions as shown below:

PDF_Value ( Cumulative.DistributionProbLevels[1] )
PDF_Value ( Cumulative.DistributionProbLevels[2] )
...
...
PDF_Value ( Cumulative.DistributionProbLevels[10] )

The vector is thus populated with 10 values corresponding to the 10 sampled cumulative probabilities from ProbLevels. To view the model logic, navigate to the model root (using the 'Go to Model Root' button).

Running the Model: Buttons are provided for running the model ('Run the Model') and for editing Monte Carlo settings ('Edit Monte Carlo settings'). A drop-list allows you to select a Sampled, Cumulative or Discrete distribution to sample. Use the Distribution Inputs button to go to the Stochastic element properties and see the specified value and probability inputs. Once you have run the model, press the 'View Results' button to view the sampled results.

##### Keywords

Vector stochastic, PDF functions, Vector constructor, Sampled distribution, Cumulative distribution, Discrete distribution

Intermediate
##### Contact

GoldSim Technology Group