Previous Next


Sampling Distributions with RISK Functions

In an RDKX application you may call the @RISK distribution functions directly using the same functions you would use in the Excel version of @RISK. For example, you could write in your code:

    x = RiskNormal(100,10)

This returns a sample from a normal distribution. However, it does not store that sample for later analyses (e.g. the Sensitivity or Regression analyses) in the RDK. Also, the sampling will always be based on the Monte Carlo sampling method instead of the more efficient Latin Hypercube sampling method. To fix these issues, you can also sample a probability distribution by defining an RDKInput object and using the same RISK functions. For example, if you have an input object named "Revenue", you could sample it with the code:

    x = RDKApp.Inputs("Revenue").RiskNormal(100,10)

As before, this draws a random sample from the normal distribution, but now the sample is stored with the "Revenue" input. Samples for this input can then be retrieved from your program and used in @RISK's sensitivity and scenario analyses. In addition, you can also use the Latin Hypercube stratified sampling technique when sampling this input.