Previous Next


Setting up a Default Distribution for an Input

A default distribution object can be assigned to an input to overcome the previously shown limits on distribution objects. For example, in your simulation setup code, you could write:

RDKApp.Inputs.Add "Revenue","RiskNormal(100,10)"

This makes RiskNormal(100,10) the default distribution for the "Revenue" input. When this is done, the default distribution is automatically sampled for you before the iteration event of your simulation. The sampled value for the input is then accessible in code using the default Value property of the input. For example, if you have already defined two inputs "Revenue" and "Cost" using default distributions and you have one output, called "Profit", your iteration event code might look like this:

Private Sub RDKApp_Iteration(whichSim As Long, whichIter As Long, cancel as Boolean)
    With RDKApp
        .Outputs("Profit") = Inputs("Revenue") -         Inputs("Cost")
    End With    
End Sub

Since the "Revenue" and "Cost" inputs have already been sampled before the iteration event was called, the code to combine the two samples is greatly simplied.

Another benefit of using a default distribution is that all samples are stored with the input for later analysis. Samples for the 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.