CB.DefineAssumFromForeND Example

The following example creates an assumption with a gamma distribution, creates a forecast with those parameters, runs a simulation, and then defines an assumption from the forecast. It then defines a custom distribution from the forecast and retains the sequence of values for sequential sampling.

Sub DefineAssumptionFromForecast()
    
    ' Define a Gamma distribution assumption and forecast to fit.
    [A1].Select
    CB.DefineAssumND cbDfaGamma, 0, 1, 2
    [B1] = "=A1"
    [B1].Select
    CB.DefineForeND "Forecast to Fit"
    
    ' Run 1000 trial simulation.
    CB.Simulation 1000
    
    ' Define an assumption from best fit distribution for forecast in cell B1.
    ' Extract the assumption parameters as cell references with
    '   parameter name labels.
    CB.DefineAssumFromForeND [B1], [D1], cbAsmFromFstDistTypeBestFit, _ 
       "Best Fit", True, True, True
    
    ' Define a custom assumption with the values from forecast in B1.
    ' Retain the sequence of generated values to sample sequentially.
    CB.DefineAssumFromForeND [B1], [E1], cbAsmFromFstDistTypeCustom, _ 
       "Sequential Custom Values", SequentialCustom:=True
   
    ' Reset simulation to view new assumptions
    CB.ResetND
    
End Sub