This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Welcome to the @RISK 6.0 Automation Library. Using this library you can automate the features of @RISK for Excel.
Please Note: While Palisade Corporation will make every effort to maintain compatibility with the information presented here, we can not guarantee that we will do so in future releases of
NOTE: You must have the Professional or Industrial Edition of @RISK 6.0 to be able to run any automation code. The Standard Edition of @RISK does not support automation.
Making the Appropriate References From VBA
To automate @RISK 6.0 from VBA, you must first make two references. From within the VBA Editor window, make sure your VBA project is active, and then select the Tools / References
menu item. In the References dialog, choose the two items labeled “RiskXLA” and "Palisade @RISK 6.0 for Excel Object Library". The image below shows the references that must be
made.
The first of these references, RiskXLA, is the main @RISK add-in file (Risk.xla on disk). This reference serves three functions. First, it gives you access to the root “Risk” object from which
all automation calls to @RISK begin. Second, it provides all the constants used in @RISK Automation. Finally, it ensures that @RISK will automatically be loaded when the workbook
containing the reference is opened. (In some cases, this last feature may not be desired. It is possible to load @RISK on demand instead of automatically, which is described later in this
document.)
The second reference is the @RISK 6.0 object library, which gives you access to all the objects and types needed to control @RISK. Once you make this reference, you will have access to
Getting Started
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
the entire @RISK object model via the root "Risk" object. For example, you can now run an @RISK simulation of 150 iterations and display the mean of the output named "Profit" with the
Examing the @RISK example file "@RISK Developer Kit - @RISK Automation Macro" is an excellent way to get started using the @RISK Developer Kit. In @RISK, go to the Help Menu and
choose the Example Spreadsheets command. The file is located in the "@RISK Features" category of examples.
Automation of RiskOptimizer FunctionalityThe RISKOptimizer feature of @RISK is quite extensive, and has its own object model, which is described in a separate document. See the “RISKOptimizer 6.0 Developer’s Kit”
documentation for more information.
Updating @RISK 5.x Automation Code to Run with @RISK 6.0If you have @RISK automation code written for @RISK 5.x, that code should continue to work with @RISK 6.0 provided you change the references as described above. Likewise most
code written for @RISK 6.0 will work in 5.x if again you make the appropriate reference changes and if you don't use any of the new properties and methods that were added in version 6.0.
Keep in mind, the referencing scheme described above for @RISK 6.0 is somewhat different from that of @RISK versions 5.x. In that version, you only made a single reference to the
@RISK 5.0 for Excel Object Library. If you are converting automation code designed for use with @RISK 5.x to @RISK 6.0, you must remove this old reference, and make the two
references described above.
In @RISK version 5.7, to automate 64-bit Excel you were required to include a block of code to obtain the root automation object and access to various constant values used in the
automation library. This code block is no longer needed and should be removed from your code.
Demand-Loading @RISKUsually, you want @RISK to load automatically when you open your add-in. By adding the reference to Risk.xla in the VBA references as described above, this will occur. However, there
are some instances where this is not the desired behavior. For example, you might want to write an add-in that only uses @RISK part of the time, and requiring @RISK to always be loaded
is not appropriate. Of course, then the loading and shutdown of @RISK itself is your code’s responsibility.
If you remove the Risk.xla reference, you can still automate @RISK (provided of course that you load the @RISK add-in yourself) but you need to do some extra work to obtain the root Risk
reference object and also to use any @RISK constants defined in that file.
You can get the root Risk object in a “late-bound” fashion (that is without an early-bound reference to Risk.xla) by using Excel’s Application.Run command, as follows:
Visual Basic
Dim Risk As AtRiskOL6.Risk
Set Risk = Application.Run(“Risk.xla!Risk”)
This code assumes @RISK is already loaded and calls the public property Risk in a late-bound fashion to retrieve the root automation object. If you store as a global (non-local) variable, we
recommend you set it to Nothing when you are finished using @RISK for automation. (Strictly you could call this variable anything, but by using the variable name of “Risk” your code will
only be minimally changed.)
An other function that the early-bound reference to Risk.xla served was to provide all the automation constants (RiskAutoNumIterations, RiskNaN, etc.) that you might need for your code.
the constant RiskAutoNumIterations is provided by the reference to Risk.xla. If you choose to demand load @RISK however, and thus do not have a reference to Risk.xla, these constants
won’t be available directly. Instead you will need to access these constants from the Risk.Constants object, as demonstrated below:
Automating @RISK from .NETWhile the @RISK automation library is primarily designed for use from within Excel’s VBA language (and all the code examples of this documentation, excepting this section, are written for
VBA) it is also possible to use the .NET environment to control @RISK. To automate @RISK from .NET, first a reference needs to be added in the Visual Studio "Add Reference" dialog: in
the COM tab of that dialog, select "Palisade @RISK 6.0 for Excel Object Library".
Since in .NET you can’t make a reference to Risk.xla, the same issues described above for late-bound loading of @RISK apply for .NET programmers. Namely, you must get access to the
root Risk object manually, you must access @RISK constants indirectly, and @RISK won’t automatically be loaded for you.
To obtain the root Risk object, assuming @RISK is loaded, the .NET programmer must obtain it from a COM call to Excel and then store it in an object variable. The .NET programmer is
free to choose any name for that variable, but the recommended name is "Risk". With this name automation code written for .NET will be very similar to the VBA code examples used in this
document.
As with the demand-loaded @RISK described above, all @RISK constants must be accessed via the Risk.Constants object.
Here are examples of VB .NET and C# methods for a simple @RISK automation. Assuming it is passed a reference to Excel that already has @RISK loaded, it sets up the root Risk object,
sets the number of iterations to be “automatic” and then runs a simulation. These methods could be part of .NET class libraries, and those libraries could be accessed from Excel using
COM/.NET Interoperability if desired.
Note: To automate Excel, an appropriate reference and "Imports"/"using" lines need to be added. Please consult relevant documentation from Microsoft.
C#
//This code assumes "using AtRiskOL6;" line has been added, as well as an appropriate "using" line to access Excel automation interface.
public void RunSimulation(Application ExcelApplication) {
Risk Risk;
//Unfortunately C# has no support for missing arguments, thus this call to Excel’s Application.Run (which takes up to 30 optional arguments after the macro name)
//"Missing.Value" can be used after "using System.Reflection;" has been added.
RiskSimulationReportQuick A "Quick" Report, one page per output, with a summary of the most important information for each output.
RiskSimulationReportInputResultsSummary A summary report of all the simulated inputs. This matches the information in the Input tab of the @RISK Results
Summary window.
RiskSimulationReportOutputResultsSummary A summary report of all the simulated outputs. This matches the information in the Output tab of the @RISK Results
Summary window.
RiskSimulationReportDetailedStatistics A set of detailed statistical results for all inputs and outputs. This matches the information in the @RISK Detailed
Statistics window.
RiskSimulationReportData The complete set of simulation data for all inputs and outputs. This matches the information in the @RISK Data
window.
RiskSimulationReportSensitivity The sensitivity results for all outputs. This matches the information in the @RISK Sensitivities window.
RiskSimulationReportScenarios The scenarios report for all outputs. This matches the information in the @RISK Scenarios window.
RiskSimulationReportTemplateSheets A static copy of all open template sheet. Template sheets must start with the prefix "RiskTemplate_".
RiskModelReportInputs A report summarizing all the currently defined inputs. This matches the information in the Inputs tab of the @RISK
Model window.
RiskModelReportOutputs A report summarizing all the currently defined outputs. This matches the information in the Outputs tab of
the @RISK Model window.
RiskModelReportCorrelations A report summarizing all the currently defined correlations. This matches the information in the Correlations tab of
the @RISK Model window.
Return Type
Excel Workbook Object - the workbook where the reports were created.
Remarks
You can add the various report constants together to generate multiple reports at the same time.
The user's current report selection can be gotten from Risk.SimulationSettings.ReportsToGenerate property.
The placement of the reports is controled by several report settings in the Risk.ApplicationSettings object.
Example
[[New Example] (Visual Basic)]
'Run a simulation and then generate the input and output result summary reports
Optional ByVal p_ContextWorksheet As Worksheet = Nothing _
) As Variant
Parameters
p_Expression
An @RISK distribution function. The must be specified in US/English format and have standard @RISK function syntax. It may have references to spreadsheet cells (in A1 format
only) but those references will be resolved with respect to the ContextWorksheet argument.
p_ContextWorksheet
An optional worksheet parameter which is used to resolve any spreadsheet references in the specified expression. If omitted, the active worksheet is implied.
Return Type
Variant - Most often this will be a numeric value. However, illegal distribution definition will return error variants in the standard Excel manner. For example, Excel's #VALUE! error is
represented by an Error Variant of type 2015.
Example
[[New Example] (Visual Basic)]
'Samples ten independent Normal(0,1) distributions, adds up the result, and displays it.
Public Sub SampleNormals()
Dim result As Variant
Dim i As Integer
For i = 1 To 10
result = result + Risk.Sample("RiskNormal(0,1)")
Next i
Sample Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
The shutdown of @RISK is asynchronous. That is, it will not occur immediately when you make this call, but rather will start the shut-down process after your code has finished executing
Writes @RISK information to the specified Excel workbook.
Syntax
Public Sub WriteWorkbookInformation( _
ByVal p_Workbook As Workbook _
)
Parameters
p_Workbook
The workbook to which @RISK information should be written.
Remarks
When the user saves an Excel workbook with @RISK open, it automatically writes @RISK information into it. This information includes the simulation settings, fit definitions,
and simulation results if appropriate. However, if you save a workbook via code using the Workbook.Save or Workbook.SaveAs methods, this information is not automatically written into
the workbook and you must use this method to add it.
Calling this method may display an @RISK dialog, asking you for how you want to save your results. If you set the Risk.DisplayAlerts property to FALSE, this dialog will be suppressed
and the default saving options will be chosen.
If you only want to write the @RISK simulation settings to a workbook, you can call instead the Risk.Simulation.Settings.SaveToWorkbook method.
Example
[[New Example] (Visual Basic)]
'Saves the active Excel Workbook with the current @RISK information embedded in it.
'The @RISK Save dialog has been suppress during this process.
Public Function SaveWorkbookWithAtRiskInformation()
Risk.DisplayAlerts = False
Risk.WriteWorkbookInformation ActiveWorkbook
WriteWorkbookInformation Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
NOTE: These constants need only be used from this object when demand-loading @RISK for automation, or automation from .NET. For normal VBA development, these constants are
Controls whether @RISK will display messages during execution.
Property type
Read-write property
Syntax (Visual Basic)
Public Property DisplayAlerts() As Boolean
Remarks
Macro developers may want to turn this message off to suppress the display of @RISK messages. For example, a confirmation message displayed by @RISK will pause the execution of
a macro until the user clicks a button. This is very similar to the property of Excel with the same name. You should be sure to turn this property back to TRUE when your macro has
finished.
Example
[[New Example] (Visual Basic)]
'Perform a fit without displaying the fit status window
Returns the current "interface" mode of @RISK. This property can be used to determine the state of operation of the product.
Property type
Read-only property
Syntax (Visual Basic)
Public Property InterfaceMode() As RiskInterfaceMode
Remarks
Many @RISK actions can only be performed in a particular mode. For example, you can not perform a fit while @RISK is the middle of running a simulation. You can use this property to
check and respond appropriately to this type of situation.
Example
[[New Example] (Visual Basic)]
'Check if we are in "Standard Mode" before doing something
Public Sub DoSomethingOnlyIfInStandardMode()
If Risk.InterfaceMode <> RiskStandardOperation Then
MsgBox "This action can not be performed at this time."
The cell must be an @RISK output. If a cell that is not an @RISK output is selected, it will automatically become an @RISK output when the analysis is run.
Example
[Visual Basic]
'Set up a sensitivity analysis on the 95% of the output in cell B5
Public Sub RunAdvSensitivityAnalysis()
With Risk.Simulation.NewAdvSensitivityAnalysis()
Set .OutputCell = ActiveSheet.Range("B5")
.OutputStatistic = RiskStatisticPercentile
.OutputPercentile = 0.95
'Continue here with code to setup and run the analysis...
Optional ByRef p_DistributionFunctionPosition As Integer = 1 _
)
Parameters
p_Cell
Specifies a cell reference for the input reference. This must be a single cell.
p_AlternateName
Optionally specifies an alternate name for the input. This argument only applies if the InputType Property is RiskSensAnalysisCellBasedInput.
p_DistributionFunctionPosition
Optionally specifies an @RISK functional position for the input. This is only needed if there is more than one @RISK distribution in the same cell. In that case, the value 1 indicates
the first @RISK distribution, 2 the second, and so on. This argument only applies if the InputType Property is RiskSensAnalysisDistributionBasedInput.
Remarks
When an input if created with Add Method, you can specify a single input cell, name, and function position. If that is the only cell reference you want in the input, you need do nothing
else. However, you may want to specify a compound input with more than one cell reference in a single input. In that case, this method must be used to add that additional items.
Example
[Visual Basic]
Public Sub MakeCompoundSensitivityInput(ByVal p_Analysis As RiskAdvSensAnalysis)
With p_Analysis.Inputs.Add(RiskSensAnalysisCellBasedInput)
Retrieves information about a single input reference.
Syntax
Public Function GetInputReferenceInfo( _
ByVal p_Index As Integer, _
Optional ByRef p_Cell As Range, _
Optional ByRef p_AlternateName As String, _
Optional ByRef p_DistributionFunctionPosition As Integer _
) As Range
Parameters
p_Index
Indicates for which input reference information is being sought.
p_Cell
Returns the single cell where the input reference is located.
p_AlternateName
Returns the alternate cell name for the input. This is only relevant if the InputType Property is RiskSensAnalysisCellBasedInput.
p_DistributionFunctionPosition
The functional position of the input. This is only needed if there is more than one @RISK distribution in the same cell. In that case, the value 1 indicates the first @RISK distribution,
2 the second, and so on. This argument only applies if the InputType Property is RiskSensAnalysisDistributionBasedInput.
Returns an array of percentiles used to define the input's variation.
Syntax
Public Function VariationPercentiles_GetArray( _
ByRef p_Array() As Double _
) As Integer
Parameters
p_Array
The array which will be filled with percentile values. Each value is between 0 and 1.
Return Type
Integer - the number of percentiles.
Remarks
This method is only relevant if the input's InputType Property is RiskSensAnalysisDistributionBasedInput and the VariationMethod Property is set to RiskVariationDistributionPercentiles.
Sets an array of percentiles used to define the input's variation.
Syntax
Public Sub VariationPercentiles_SetArray( _
ByRef p_Array() As Double _
)
Parameters
p_Array
The array of percentile values. Each value is between 0 and 1.
Remarks
This method is only relevant if the input's InputType Property is RiskSensAnalysisDistributionBasedInput and the VariationMethod Property is set to RiskVariationDistributionPercentiles.
Returns an array of actual values used to define the input's variation.
Syntax
Public Function VariationValues_GetArray( _
ByRef p_Array() As Double _
) As Integer
Parameters
p_Array
The array which will be filled with values.
Return Type
Integer - the number of values in the array.
Remarks
This method is only relevant if the input's InputType Property is RiskSensAnalysisDistributionBasedInput and the VariationMethod Property is set to RiskVariationValuesFromTable.
Sets an array of actual values used to define the input's variation.
Syntax
Public Sub VariationValues_SetArray( _
ByRef p_Array() As Double _
)
Parameters
p_Array
The array of values.
Remarks
This method is only relevant if the input's InputType Property is RiskSensAnalysisDistributionBasedInput and the VariationMethod Property is set to RiskVariationValuesFromTable.
The base-value is used to determine the values taken by the input during the analysis if the VariationMethod Property is RiskVariationPercentChangeFromBaseValue or
RiskVariationActualChangeFromBaseValue.
The special value RiskAutoBaseValue can be use to specify the input base value is taken from the cell where the input resides.
Example
[Visual Basic]
'Add a sensitivity input at cell A1 that varies +/- 10% from the base-value of 100 in 5 steps.
Public Sub AddSensitivityInput(ByVal p_Analysis As RiskAdvSensAnalysis)
With p_Analysis.Inputs.Add(RiskSensAnalysisCellBasedInput, ActiveSheet.Range("A1"), "My Input")
Specifies how the sensitivity input will be varied.
Property type
Read-write property
Syntax (Visual Basic)
Public Property VariationMethod() As RiskAdvSensVariationMethod
Remarks
If set to either RiskVariationPercentChangeFromBaseValue, RiskVariationActualChangeFromBaseValue, or RiskVariationMinMaxRange, the BaseValue Property, VariationMinimum
Property, VariationMaximum Property, and VariationNumSteps Property are used to specify the other variation parameters.
If set to RiskVariationDistributionPercentiles, use the VariationPercentiles_SetArray Method to specify the percentiles values to use.
If set to RiskVariationValuesFromTable, use the VariationValues_SetArray Method to specify the values to use.
If set to RiskVariationValuesFromExcelRange, use the VariationTableRange Property property to specify an Excel range that contain the values to use.
Example
[Visual Basic]
'Add a sensitivity input at cell A1 that varies +/- 10% from the base-value of 100 in 5 steps.
Public Sub AddSensitivityInput(ByVal p_Analysis As RiskAdvSensAnalysis)
With p_Analysis.Inputs.Add(RiskSensAnalysisCellBasedInput, ActiveSheet.Range("A1"), "My Input")
Specifies the number of steps in the input variation.
Property type
Read-write property
Syntax (Visual Basic)
Public Property VariationNumSteps() As Integer
Remarks
This property only has effect if the VariationMethod Property RiskVariationPercentChangeFromBaseValue, RiskVariationActualChangeFromBaseValue, or RiskVariationMinMaxRange
Example
[Visual Basic]
'Add a sensitivity input at cell A1 that varies +/- 10% from the base-value of 100 in 5 steps.
Public Sub AddSensitivityInput(ByVal p_Analysis As RiskAdvSensAnalysis)
With p_Analysis.Inputs.Add(RiskSensAnalysisCellBasedInput, ActiveSheet.Range("A1"), "My Input")
Optional ByVal p_InputReferenceCell As Range = Nothing, _
Optional ByVal p_AlternateName As String = "", _
Optional ByVal p_DistributionFunctionPosition As Integer = 1 _
) As RiskAdvSensInput
Parameters
p_InputType
Value Description
RiskSensAnalysisCellBasedInput The entire cell (or cells) will be changed during the sensitivity analysis.
RiskSensAnalysisDistributionBasedInput Only the @RISK distribution function in the specified cell (or cells) will be changed during the sensitivity analysis
Indicates the type of input.
p_InputReferenceCell
Optionally specifies a cell reference for the input. This must be a single cell. (Multiple cell references many be added to the same sensitivity input by calling the AddInputReference
Method multiple times for an input.)
p_AlternateName
Optionally specifies an alternate name for the input. This argument only applies if the InputType argument is RiskSensAnalysisCellBasedInput.
p_DistributionFunctionPosition
Optionally specifies an @RISK functional position for the input. This is only needed if there is more than one @RISK distribution in the same cell. In that case, the value 1 indicates
the first @RISK distribution, 2 the second, and so on. This argument only applies if the InputType argument is RiskSensAnalysisDistributionBasedInput.
Remarks
The three optional arguments to this function are a convenient shortcut for when you have a single cell or function you want to add. If you have multiple cells or functions, use the
Add Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
AltParamDefaults Controls the default alternate parameterization for a specified distribution type.
CellFormattingInputColor Controls the (RGB) color to be used when @RISK automatically formats cells containing @RISK input distributions.
CellFormattingOptimizerVariableColor
CellFormattingOutputColor Controls the (RGB) color to be used when @RISK automatically formats cells containing @RISK output functions.
CellFormattingStatisticColor
CellFormattingStyle Controls how @RISK will automatically format spreadsheet cells containing @RISK input or output functions.
CumulativeDescendingPercentiles Sets whether @RISK will display percentiles in cumulative descending format.
DistributionEntryDisplayShiftFactor Controls whether a shift factor entry will be displayed by default in the define distribution window, even if a shift
factor is not present in the distribution being edited.
DistributionEntryDisplayStaticValue Controls whether a static value entry will be displayed by default in the define distribution window, even if a static
value is not present in the distribution being edited.
DistributionEntryDisplayTruncationLimits Controls whether truncation limits entries will be displayed by default in the define distribution window, even if a
truncation limits are not present in the distribution being edited.
GraphBoxPlotCenterline Controls the centerline statistic used for box-plots.
GraphBoxPlotColor Controls the color used for box-plot graphs.
GraphBoxPlotFormattingIsAutomatic Controls whether box-plots are formatted automatically.
GraphBoxPlotInnerRange Controls the bounds of the box in a box-plot.
GraphBoxPlotOuterRange Controls the bounds of the whiskers in a box-plot.
GraphBoxPlotShowCenterlineLabels Controls whether the centerline value are displayed on a box-plot.
GraphDistributionSecondaryAxisOverlay Controls if a cumulative overlay curve is automatically added to distribution graphs.
GraphInputColor Controls the default (RGB) color applied to the curves representing inputs in an @RISK graph.
GraphLeftDelimiter Controls the default value for a distribution graph's left delimiter percentile.
GraphLegendTableDefinition Controls what items appear by default on a graph's legend.
GraphLegendView
GraphLegendViewString
GraphMarkerDefinition Controls what items appear by default as marked items on a graph.
GraphNumberFormatQuantitiesWithUnits Controls the number formatting used for graph statistics that have scaled units.
GraphNumberFormattingIsAutomatic Controls whether the number formatting used in graph statistics is automatically determined.
GraphNumberFormatUnitlessQuantities Controls the number formatting used for unitless graph statistics.
GraphNumDelimitedCurves Controls the maximum number of curves in a graph that will display delimited percentile information.
GraphNumHistogramBins Specifies the number of histogram bins to be used in the display of graphs.
GraphOutputColor Controls the default (RGB) color applied to the curves representing outputs in an @RISK graph.
GraphOutputScalingFactor Specifies a default scaling factor for a output distribution graph.
GraphOutputScalingIsAutomatic Indicates whether the default x-axis scaling of output distributions graphs is automatically determined.
GraphOutputScalingMaximum Specifies a default maximum value for a output distribution graph.
GraphOutputScalingMinimum Specifies a default minimum value for a output distribution graph.
GraphPreferredDistributionFormat Controls the preferred distribution display format for distribution graphs.
GraphRightDelimiter Controls the default value for a distribution graph's left delimiter percentile.
GraphSummaryTrendCenterline Controls the centerline statistic used for summery trend graphs.
GraphSummaryTrendCenterlineColor Controsl the control of the centerline for summary trend graphs.
GraphSummaryTrendFormattingIsAutomatic Controls whether summary trend graphs are formatted automatically.
GraphSummaryTrendInnerColor Controls the color of a summary trend graph's inner band.
GraphSummaryTrendInnerRange Controls the bounds of the inner band of a summary trend graph.
GraphSummaryTrendOuterColor Controls the color of a summary trend graph's outer band.
GraphSummaryTrendOuterRange Controls the bounds of the outer band of a summary trend graph.
GraphSuppressYAxis
GraphTitleDescription Specifies a default graph description to use, overriding the automatic title generated by @RISK.
GraphTitleMainText Specifies a default graph title to use, overriding the automatic title generated by @RISK.
GraphXAxisTickLabelOrientation Specifies how the x-axis tick labels appear on graphs.
GraphXAxisTitle
GraphYAxisTitle
InsertFunctionGraphWindowEnabled Controls if an @RISK graph window automatically is displayed when Excel's 'Insert Function' window is displayed.
InsertStaticValues Controls whether @RISK, by default, will put RiskStatic() property functions into new @RISK input distributions.
LibraryEnabled Controls whether the @RISK Library facility is enabled be default when @RISK is started.
MiniToolbarEnabled
ModelWindowColumns Controls the columns that will be displayed by default in the @RISK Model Window.
PolicyFileInUse Indicates whether the @RISK user has a policy file installed.
ProjectDisplayStandardGanttChart
ProjectManualRecalculation
ProjectProbGanttCalculateCriticalIndex
ProjectProbGanttCalculateStatistics
ProjectProbGanttFinishDatePercentile
ProjectProbGanttLocation
ProjectProbGanttStartDatePercentile
ProjectSimulationDateRange
ReportOverwriteExisting Controls whether newly generated reports in a workbook will replace already existing reports in that same workbook.
ReportPlacement Controls where @RISK's Excel reports will be placed, either in a new workbook or the active workbook.
ReportReuseNewWorkbook Controls whether only a single new Excel workbook will be created to hold reports.
ResultWindowColumns Controls the columns that will be displayed by default in the @RISK Results Window.
RISKOptimizerCrossoverRate Controls the default crossover rate for new optimization models.
RiskOptimizerEngine Controls the default optimization engine for new optimization models.
RISKOptimizerMutationRate Controls the default mutation rate for new optimization models.
RISKOptimizerPopulationSize Controls the default population size for new optimization models.
RISKOptimizerProgressMaxChange Controls the maximum change for new optimization models that use a progress based stopping condition.
RISKOptimizerProgressMaxChangeIsPercent Specifies if the maximum change for new optimization models that use a progress based stopping condition is a
percentage of the output value.
RISKOptimizerProgressStoppingCondition Controls if new optimization models will use, by default, a progress based stopping condition.
RISKOptimizerProgressTrialCount Controls the number of trials used by default for new optimization models that use a progress based stopping
condition.
RISKOptimizerStopOnErrors Controls if new optimization models will stop, by default, when any errors are calculated in output values.
RISKOptimizerTimeSpan Controls the amount of time allowed, by default, for new optimization models in the time span stopping condition.
RISKOptimizerTimeSpanStoppingCondition Controls if new optimization models will use, by default, a time span stopping condition.
RiskOptimizerTimeSpanUnit
RISKOptimizerTrialCount
RISKOptimizerTrialStoppingCondition Controls if new optimization models will use, by default, a maximum trial count stopping condition.
SaveLocation Controls where @RISK stores simulation results.
SensitivityNumDivisions
SensitivityPercentile
SensitivityPreferredMethod
SensitivitySpiderMaxNumLines
SensitivityStatistic
SensitivityTornadoMaxNumBars
ShowWelcomeScreenAtStartup Controls whether the @RISK "Welcome / What's New" windows is automatically displayed each time the
application starts.
SimSettingsAutomaticResultsDisplay Sets the default AutomaticResultsDisplay simulation settings for new models.
SimSettingsCollectDistributionSamples Sets the default CollectDistributionSamples simulation settings for new models.
SimSettingsConvergenceTestingEnabled Sets the default ConvergenceTestingEnabled simulation settings for new models.
SimSettingsLiveUpdate Sets the default LiveUpdate simulation settings for new models.
SimSettingsMinimizeExcel Sets the default MinimizeExcel simulation settings for new models.
SimSettingsNumIterations Sets the default NumIterations simulation settings for new models.
SimSettingsPauseOnOutputErrors Sets the default PauseOnOutputErrors simulation settings for new models.
SimSettingsSamplingType Sets the default SamplingType simulation settings for new models.
SimSettingsShowExcelRecalculations Sets the default ShowExcelRecalculations simulation settings for new models.
SimSettingsSmartSensitivityAnalysisEnabled Controls whether smart sensitivity analysis will is enabled.
SimSettingsStatisticFunctionUpdating Controls when @RISK statistic functions will be updated during a simulation.
SimSettingsStdRecalcBehavior Sets the default StdRecalcBehavior simulation settings for new models.
SimSettingsStdRecalcWithoutRiskStatic Sets the default StdRecalcWithoutRiskStatic simulation settings for new models.
SimSettingsStdRecalcWithoutRiskStaticPercentile Sets the default StdRecalcWithoutRiskStaticPercentile simulation settings for new models.
SimSettingsUseMultipleCPUs Controls whether @RISK will use multiple CPUs (if there is more than one CPU on the machine) to perform
simulations.
SwapPreviewChanges Controls what items are previewed when swapping in formulas.
SwapWithoutRiskStatic Controls what statistic is substituted when the user swaps out @RISK functions that do not contain RiskStatic()
property functions.
SwapWithoutRiskStaticPercentile Controls what percentile is substituted when the user swaps out @RISK functions that do not contain RiskStatic()
property functions.
TimeSeriesCenterline
TimeSeriesCenterlineColor
TimeSeriesCurrentSimulationColor
TimeSeriesHistoricalDataColor
TimeSeriesInnerColor
TimeSeriesInnerRange
TimeSeriesNumberOfDefaultDataPoints
TimeSeriesNumberOfPreviousPaths
TimeSeriesOrientation
TimeSeriesOuterColor
TimeSeriesOuterRange
TimeSeriesPreviousSimulationColor
TimeSeriesVerticalDelimiterColor
WindowDefaultSize Controls the default size of new @RISK windows.
WindowListDisplay Controls under what circumstances the @RISK Windows List will be displayed.
Applies current Application Settings to open windows, graphs, and workbooks.
Syntax
Public Sub ApplyNow()
Remarks
Many application settings only affect new @RISK object (graphs, workbooks, windows, etc.) when they are first created. This property applies the current @RISK settings to already
existing open objects.
Example
[[New Example] (Visual Basic)]
'Change how percentiles are displayed by default in @RISK and apply the change to all open windows.
Controls the default alternate parameterization for a specified distribution type.
Property type
Read-write property
Syntax (Visual Basic)
Public Property AltParamDefaults( _
ByVal p_DistributionType As Variant _
) As String
Parameters
p_DistributionType
The name of the distribution type, e.g. "Normal" or "Weibull".
Remarks
The format of the string must follow the syntax of the distribution type in question (in US/English format) with 'x's replacing the numeric values of the parameters (see the example below).
Sets whether @RISK will display percentiles in cumulative descending format.
Property type
Read-write property
Syntax (Visual Basic)
Public Property CumulativeDescendingPercentiles() As Boolean
Remarks
This property only affects the display of percentiles in the @RISK interface. All methods and properties will continue to return cumulative ascending percentiles.
This settings will affect all new windows created by @RISK. After changing this setting, you can apply it to already open windows using the ApplyNow method.
Example
[[New Example] (Visual Basic)]
'Change how percentiles are displayed by default in @RISK and apply the change to all open windows.
Controls whether a shift factor entry will be displayed by default in the define distribution window, even if a shift factor is not present in the distribution being edited.
Property type
Read-write property
Syntax (Visual Basic)
Public Property DistributionEntryDisplayShiftFactor() As Boolean
Controls whether a static value entry will be displayed by default in the define distribution window, even if a static value is not present in the distribution being edited.
Property type
Read-write property
Syntax (Visual Basic)
Public Property DistributionEntryDisplayStaticValue() As Boolean
Controls whether truncation limits entries will be displayed by default in the define distribution window, even if a truncation limits are not present in the distribution being edited.
Property type
Read-write property
Syntax (Visual Basic)
Public Property DistributionEntryDisplayTruncationLimits() As RiskDistributionTruncation
Example
[Visual Basic]
'Make the distribution entry panel show all the options by default:
Controls the default (RGB) color applied to the curves representing inputs in an @RISK graph.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphInputColor() As Long
Remarks
This property does not apply to all @RISK graph types.
This is an RGB color. You can use either build in VB color constants (e.g. vbRed, vbBlue, etc.) or the RGB function to specify these colors.
Changes to this setting will affect new graphs created in the @RISK interface. Calling the ApplyNow method will apply this color to all open @RISK graph windows.
Example
[[New Example] (Visual Basic)]
'Set @RISK to automatically make graphs on outputs green and graphs of inputs yellow
Controls the default value for a distribution graph's left delimiter percentile.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphLeftDelimiter() As Double
Remarks
This property only applies to distribution graphs.
This is a percentile value which must be between 0 and 1.
Changes to this setting will affect new graphs created in the @RISK interface. Calling the ApplyNow method will apply the change to all open @RISK graph windows.
Example
[[New Example] (Visual Basic)]
'Set the default graph delimiter to be at 2.5% and 97.5% and show delimited values for up to 3 curves.
Controls the number formatting used for graph statistics that have scaled units.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphNumberFormatQuantitiesWithUnits() As String
Remarks
This property does not apply to all @RISK graph types.
This property only has effect when the GraphNumberFormattingIsAutomatic property is False.
This property applies to new graphs when they are first created. To apply this property to existing graphs call the ApplyNow method.
This property is applied to statistics with units (such as mean, standard deviation, etc.) Use the GraphNumberFormatUnitlessQuantities property to specify the number formatting used for
statistics that do not have units (such as skewness, kurtosis, etc.)
This format of this property string may be set to:
A blank string - indicating the "General" number format.
A two character string in the format "C#" where # is a number between 0 and 9. This is a currency format with the specified number of digits trailing the decimal.
A two character string in the format "F#" where # is a number between 0 and 9. This is a fixed format with the specified number of digits trailing the decimal.
Controls whether the number formatting used in graph statistics is automatically determined.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphNumberFormattingIsAutomatic() As Boolean
Remarks
This property does not apply to all @RISK graph types.
This property applies to new graphs when they are first created. To apply this property to existing graphs call the ApplyNow method.
When this property is False, the GraphNumberFomatQuantitiesWithUnits and GraphNumberFormatUnitlessQuantities property specify the number formatting to use.
Controls the number formatting used for unitless graph statistics.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphNumberFormatUnitlessQuantities() As String
Remarks
This property does not apply to all @RISK graph types.
This property only has effect when the GraphNumberFormattingIsAutomatic property is False.
This property applies to new graphs when they are first created. To apply this property to existing graphs call the ApplyNow method.
This property is applied to 'unitless' statistics (such as skewness, kurtosis, etc.) Use the GraphNumberFormatQuantitiesWithUnits property to specify the number formatting used for
statistics with units.
This format of this property string may be set to:
A blank string - indicating the "General" number format.
A two character string in the format "F#" where # is a number between 0 and 9. This is a fixed format with the specified number of digits trailing the decimal.
Controls the maximum number of curves in a graph that will display delimited percentile information.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphNumDelimitedCurves() As Integer
Remarks
This property only applies to distribution graphs.
Changes to this setting will affect new graphs created in the @RISK interface. Calling the ApplyNow method will apply the change to all open @RISK graph windows.
Example
[[New Example] (Visual Basic)]
'Set the default graph delimiter to be at 2.5% and 97.5% and show delimited values for up to 3 curves.
Specifies the number of histogram bins to be used in the display of graphs.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphNumHistogramBins() As Integer
Remarks
This property does not apply to all @RISK graph types.
The special value RiskAutoNumHistogramBins can be used to have @RISK automatically determine this value for you.
Changes to this setting will affect new graphs created in the @RISK interface. Calling the ApplyNow method will apply the change to all open @RISK graph windows.
Controls the default (RGB) color applied to the curves representing outputs in an @RISK graph.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphOutputColor() As Long
Remarks
This property does not apply to all @RISK graph types.
This is an RGB color. You can use either build in VB color constants (e.g. vbRed, vbBlue, etc.) or the RGB function to specify these colors.
Changes to this setting will affect new graphs created in the @RISK interface. Calling the ApplyNow method will apply this color to all open @RISK graph windows.
Example
[[New Example] (Visual Basic)]
'Set @RISK to automatically make graphs on outputs green and graphs of inputs yellow
Indicates whether the default x-axis scaling of output distributions graphs is automatically determined.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphOutputScalingIsAutomatic() As Boolean
Remarks
This property on applies to distribution graphs of outputs.
If this property is set to False, the GraphOutputScalingMinimum, GraphOutputScalingMaximum, and GraphOutputScalingFactor properties will control the default scaling applies to new
distribution graphs.
This property applies to new graphs when they are first created. To apply this property to existing graphs call the ApplyNow method.
Example
[[New Example] (Visual Basic)]
'Change Default Graph Scaling
Public Sub ChangeDefaultGraphScaling()
With Risk.ApplicationSettings
.GraphOutputScalingIsAutomatic = False
.GraphOutputScalingMinimum = 1000
.GraphOutputScalingMaximum = 5000
.GraphOutputScalingFactor = RiskScaleByThousands
End With
End Sub
See Also
GraphOutputScalingIsAutomatic Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Controls the default value for a distribution graph's left delimiter percentile.
Property type
Read-write property
Syntax (Visual Basic)
Public Property GraphRightDelimiter() As Double
Remarks
This property only applies to distribution graphs.
This is a percentile value which must be between 0 and 1.
Changes to this setting will affect new graphs created in the @RISK interface. Calling the ApplyNow method will apply the change to all open @RISK graph windows.
Example
[[New Example] (Visual Basic)]
'Set the default graph delimiter to be at 2.5% and 97.5% and show delimited values for up to 3 curves.
Indicates whether the @RISK user has a policy file installed.
Property type
Read-only property
Syntax (Visual Basic)
Public Property PolicyFileInUse() As Boolean
Remarks
A policy file specifies a set of application for an @RISK user. If a system administrator has set up an @RISK policy file, the user will not be able to modify their application settings
manually. However, the settings can still be changed via automation code. In this case, however, any changes made to the application settings will only remain in effect until @RISK
Controls whether newly generated reports in a workbook will replace already existing reports in that same workbook.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ReportOverwriteExisting() As Boolean
Remarks
This property only has effect if the ReportPlacement property is RiskActiveWorkbook or if the ReportPlacement property is RiskNewWorkbook and the ReportReuseNewWorkbook
property is True.
Example
[[New Example] (Visual Basic)]
'Generate all the output quick reports in the active Excel workbook, replacing any existing reports.
Controls where @RISK's Excel reports will be placed, either in a new workbook or the active workbook.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ReportPlacement() As RiskReportPlacement
Remarks
If this property is set to RiskNewWorkbook, reports that are generated will be placed into a newly created Excel workbook. However, if the ReportReuseNewWorkbook property is set to
True, the new workbook will be generated only the first time reports are generated. Sebsequent reports will be placed in the workbook that was previously created.
If this property is set to RiskActiveWorkbook, reports that are generated will be placed in the currently active Excel workbook.
If the ReportReuseNewWorkbook property is TRUE, the reports created will replace any existing reports in the destination workbook.
Example
[[New Example] (Visual Basic)]
'Generate all the output quick reports in the active Excel workbook, replacing any existing reports.
Controls whether only a single new Excel workbook will be created to hold reports.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ReportReuseNewWorkbook() As Boolean
Remarks
This property only has effect if the ReportPlacement property is set to RiskNewWorkbook, in which case a new Excel workbook will be created only the first time reports are generated. All
subsequent reports will then be put into the workbook originally created.
This can be useful to merge reports together from multiple simulations.
Example
[[New Example] (Visual Basic)]
'Run two different simulations, and generate an output summary for each of them, making sure to place all the
Controls what items are previewed when swapping in formulas.
Property type
Read-write property
Syntax (Visual Basic)
Public Property SwapPreviewChanges() As RiskSwapPreviewChanges
Remarks
When swapping in @RISK function, a preview dialog can be displayed to the user, asking them to approve the changes that will be made to their spreadsheet. This settings controls
under what circumstances this dialog will be displayed, and what items it will contain.
Example
[[New Example] (Visual Basic)]
'Set the swapping option to always swap out to the 75% (when no RiskStatic() value is present)
Controls what statistic is substituted when the user swaps out @RISK functions that do not contain RiskStatic() property functions.
Property type
Read-write property
Syntax (Visual Basic)
Public Property SwapWithoutRiskStatic() As RiskStaticValueType
Remarks
When a swap out occurs, @RISK function are replaced with their static values (if they have one defined with an RiskStatic() property function). This property controls the statistic value to
use for those functions without a static value.
If this property is set to RiskPercentileValue, the SwapWithoutRiskStaticPercentile property specifies which percentile to use.
Example
[[New Example] (Visual Basic)]
'Set the swapping option to always swap out to the 75% (when no RiskStatic() value is present)
Controls what percentile is substituted when the user swaps out @RISK functions that do not contain RiskStatic() property functions.
Property type
Read-write property
Syntax (Visual Basic)
Public Property SwapWithoutRiskStaticPercentile() As Double
Remarks
When a swap out occurs, @RISK function are replaced with their static values (if they have one defined with an RiskStatic() property function). This property controls the percentile value
to use for those functions without a static value.
This property is only relevant if the SwapWithoutRiskStatic property is set to RiskPercentileValue.
Example
[[New Example] (Visual Basic)]
'Set the swapping option to always swap out to the 75% (when no RiskStatic() value is present)
For a list of all members defined in this module, see RiskConstants members.
Remarks
NOTE: These constants need only be used from this object when demand-loading @RISK for automation, or automation from .NET. For normal VBA development, these constants are
A special constant value that may be used in several properties to indicate the specified property is under the automatic control of the @RISK application.
A special value indicating an automatic number of iterations. This typically means the the number of iteration will be determined automatically by the software using convergence
ChiSqBinGetCustomBoundaries Returns the boundaries to be used for custom chi-sq binning.
ChiSqBinSetCustomBoundaries Sets the boundaries to be used for custom chi-sq binning.
Delete Deletes this fit definition and removes if from the collection of fit definitions.
EstimatedFitsGetList Returns an array of distribution types to use in the fitting process.
EstimatedFitsSetList Sets an array of distribution types to use in the fitting process.
PerformFit Performs a fit based on the current definition and returns a new RiskFitResultsCollection object
PredefinedFitsGetList Returns an array of predefined functions to use in the fitting process.
PredefinedFitsSetList Sets an array of predefined functions to use in the fitting process.
Public Properties
BatchFit Indicates if this fit is a "batch" fit or not.
BatchFitReportIncludeCorrelations Indicates if batch fits include correlations between the individually fitted elements in the batch fit report.
BatchFitReportIncludeDetailWorksheets Indicates if batch fits include detailed reports for each of the individually fitted elements in the batch fit report.
BatchFitReportInNewWorkbook Indicates if batch fit reports are put into a new workbook.
BatchFitReportStyle Indicates the style of batch fit reports.
BootstrapConfidenceLevel Specifies the confidence level to use for parametric bootstrap analysis.
BootstrapEnabled Specifies if a parameteric bootstrap analysis should be run as part of the fitting process.
RiskFitDefinition Object Members
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns an array of distribution types to use in the fitting process.
Syntax
Public Function EstimatedFitsGetList( _
ByRef p_DistributionNames() As String _
) As Integer
Parameters
p_DistributionNames
An array of strings. Each string is the name of an @RISK distribution type (without a "Risk" prefix). Examples are "Normal", "Triang", "Uniform". The array is 1-based.
Return Type
Integer - the number of distribution types in the array.
Remarks
This method is only relevant if FitMethod = RiskEstimatedParameters.
Only the distributions which are compatible with the data type and the lower and upper limits specified will actually be used. For example, if discrete data is being fit and there are three
items in the list ("Normal", "IntUniform", and "Geomet"), the Normal distribution will be ignored.
Example
[[New Example] (Visual Basic)]
'Display the list of estimated fits currently selected for "MyFit".
Public Sub DisplaySelectedEstimatedFits()
Dim fitDefinition As RiskFitDefinition
Dim numberOfDists As Integer
Dim distTypesToFit() As String
Dim displayString As String
EstimatedFitsGetList Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Sets an array of distribution types to use in the fitting process.
Syntax
Public Sub EstimatedFitsSetList( _
ByRef p_DistributionNames() As String _
)
Parameters
p_DistributionNames
An array of strings. Each string is the name of an @RISK distribution type (with or without a "Risk" prefix). Examples are "Normal", "Triang", "Uniform". The array must be 1-based.
Remarks
Calling this method automatically sets FitMethod = RiskEstimatedParameters.
Only the distributions which are compatible with the data type and the lower and upper limits specified will actually be used. For example, if discrete data is being fit and there are three
items in the list ("Normal", "IntUniform", and "Geomet"), the Normal distribution will be ignored.
Example
[[New Example] (Visual Basic)]
'Set the list of estimated fits for "MyFit" to include Normal, Expon, and Weibull fits.
Public Sub SetEstimatedFits()
Dim fitDefinition As RiskFitDefinition
Dim distTypesToFit() As String
Set fitDefinition = Risk.Fits("MyFit")
Redim distTypesToFit(1 To 3)
distTypesToFit(1) = "Normal"
EstimatedFitsSetList Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Performs a fit based on the current definition and returns a new RiskFitResultsCollection object
Syntax
Public Function PerformFit() As RiskFitResultCollection
Return Type
If the fit in question is NOT a batch fit, the return value is a new RiskFitResultsCollection Object containing all the information for the fitted results. For a batch fit, however, the return code
will always be a Null reference.
Remarks
To suppress the fitting progress window use the Risk.DisplayAlerts property
Example
[[New Example] (Visual Basic)]
'Performs the fit specified in "MyFit" and displays the best fitting Normal distribution.
Returns an array of predefined functions to use in the fitting process.
Syntax
Public Function PredefinedFitsGetList( _
ByRef p_Fits() As RiskPredefinedFit _
) As Integer
Parameters
p_Fits
An array of RiskPredefinedFit structures, each containing the Name, Distribution Function, and Enabled state of that particular fit. The array is 1-based.
Return Type
Integer - The number of predefined fits.
Remarks
This method is only relevant if FitMethod = RiskPredefinedDistributions.
Only the distributions which are compatible with the data type will actually be used. For example, if discrete data is being fit and there are three items in the list ("RiskNormal(0,10)",
"IntUniform(0,10)", and "Geomet(.5)"), the Normal distribution will be ignored.
Example
[[New Example] (Visual Basic)]
'Display the list of predefined distributions currently selected for "MyFit".
Public Sub DisplayPredefinedFits()
Dim fitDefinition As RiskFitDefinition
Dim numberOfFits As Integer
Dim predefinedFits() As RiskPredefinedFit
Dim displayString As String
PredefinedFitsGetList Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Sets an array of predefined functions to use in the fitting process.
Syntax
Public Sub PredefinedFitsSetList( _
ByRef p_Fits() As RiskPredefinedFit _
)
Parameters
p_Fits
An array of RiskPredefinedFit structures, each containing the Name, Distribution Function, and Enabled state of that particular fit. The array is 1-based.
Remarks
Calling this method will automatically set FitMethod = RiskPredefinedDistributions.
Only the distributions which are compatible with the data type will actually be used. For example, if discrete data is being fit and there are three items in the list ("RiskNormal(0,10)",
"IntUniform(0,10)", and "Geomet(.5)"), the Normal distribution will be ignored.
Example
[[New Example] (Visual Basic)]
'Sets a pair of competing hypotheses for "MyFit"
Public Sub SetPredefinedFits()
Dim fitDefinition As RiskFitDefinition
Dim predefinedFits() As RiskPredefinedFit
Set fitDefinition = Risk.fits("MyFit")
ReDim predefinedFits(1 To 2)
PredefinedFitsSetList Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
For equal interval chi-squared binning, specifies if the first bin extends from -Infinity to a minimum value.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ChiSqBinExtendToMinusInfinity() As Boolean
Remarks
If this option is TRUE, the first chi-sq bin will not, in fact, have the same spacing as the other bins. The first bin will extend from -Infinity to the "minimum" value (either calculated
automatically or specified directly in the ChiSqBinMinimum property.)
This property only is relevant if ChiSqBinArrangement = RiskEqualIntervals.
Example
[[New Example] (Visual Basic)]
'Set the chi-sq binnig of 'MyFit' to use 6 bins. The middle 4 bins are equally spaced from 0 to 10,
'while the first bin extends from -Infinity to 0 and the last from 10 to +Infinity:
Public Sub SpecifyEqualIntervalChiSqBinsWithExtendedLimits()
Dim fitDefinition As RiskFitDefinition
Set fitDefinition = Risk.fits("MyFit")
With fitDefinition
.ChiSqBinArrangement = RiskEqualIntervals
.ChiSqBinCount = 6
.ChiSqBinAutomaticLimits = False
ChiSqBinExtendToMinusInfinity Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
For equal interval chi-squared binning, specifies if the last bin extends from a maximum value to +Infinity
Property type
Read-write property
Syntax (Visual Basic)
Public Property ChiSqBinExtendToPlusInfinity() As Boolean
Remarks
If this option is TRUE, the last chi-sq bin will not, in fact, have the same spacing as the other bins. The last bin will extend from the "maximum" value (either calculated automatically or
specified directly in the ChiSqBinMaximum property) to +Infinity.
This property only is relevant if ChiSqBinArrangement = RiskEqualIntervals.
Example
[[New Example] (Visual Basic)]
'Set the chi-sq binnig of 'MyFit' to use 6 bins. The middle 4 bins are equally spaced from 0 to 10,
'while the first bin extends from -Infinity to 0 and the last from 10 to +Infinity:
Public Sub SpecifyEqualIntervalChiSqBinsWithExtendedLimits()
Dim fitDefinition As RiskFitDefinition
Set fitDefinition = Risk.fits("MyFit")
With fitDefinition
.ChiSqBinArrangement = RiskEqualIntervals
.ChiSqBinCount = 6
.ChiSqBinAutomaticLimits = False
ChiSqBinExtendToPlusInfinity Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
For equal-interval chi-sq binning, controls the location of the right side of the last bin.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ChiSqBinMaximum() As Double
Remarks
This property only is relevant if ChiSqBinAutomaticLimits = False.
This property only is relevant if ChiSqBinArrangement = RiskEqualIntervals.
If ChiSqBinExtendToPlusInfinity = True, this property is actually the right side of the second to last bin, while the last bin extends from this value to +Infinity.
Example
[[New Example] (Visual Basic)]
'Set the chi-sq binning of 'MyFit' to use 4 bins with equally spaced intervals from 0 to 10:
Public Sub SpecifyEqualIntervalChiSqBins()
Dim fitDefinition As RiskFitDefinition
Set fitDefinition = Risk.fits("MyFit")
With fitDefinition
.ChiSqBinArrangement = RiskEqualIntervals
.ChiSqBinCount = 4
.ChiSqBinAutomaticLimits = False
.ChiSqBinMinimum = 0
.ChiSqBinMaximum = 10
ChiSqBinMaximum Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
For equal-interval chi-sq binning, controls the location of the left side of the first bin.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ChiSqBinMinimum() As Double
Remarks
This property only is relevant if ChiSqBinAutomaticLimits = False.
This property only is relevant if ChiSqBinArrangement = RiskEqualIntervals.
If ChiSqBinExtendToMinusInfinity = True, this property is actually the left side of the second bin, while the first bin extends from this -Infinity to this value.
Example
[[New Example] (Visual Basic)]
'Set the chi-sq binning of 'MyFit' to use 4 bins with equally spaced intervals from 0 to 10:
Public Sub SpecifyEqualIntervalChiSqBins()
Dim fitDefinition As RiskFitDefinition
Set fitDefinition = Risk.fits("MyFit")
With fitDefinition
.ChiSqBinArrangement = RiskEqualIntervals
.ChiSqBinCount = 4
.ChiSqBinAutomaticLimits = False
.ChiSqBinMinimum = 0
.ChiSqBinMaximum = 10
ChiSqBinMinimum Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Specifies the Excel Range where the data being fit resides.
Property type
Read-write property
Syntax (Visual Basic)
Public Property DataRange() As Range
Remarks
The data must reside in the same workbook specified in the ExcelWorkbook property.
The data range must be a contiguous block of cells.
The contents and layout of the data range depend on the DataType of the fit, as specified below:
RiskFitContinousSamples : A single rectangular block of cells.
RiskFitDiscreteSamples : A single rectangular block of cells containing only integer values.
RiskFitCountedDiscreteSamples : A block of cells with exactly two columns, both containing only integers. The first column contains the sample values. The second column contains
the number of occurrences of each sample value.
RiskFitUnnormalizedDensityPoints : A block of cells with exactly two columns. The first column contains x-values and the second column contains the y-values that define the density
curve.
RiskFitNormalizedDensityPoints : A block of cells with exactly two columns. The first column contains x-values and the second column contains the y-values that define the density
curve.
DataRange Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
RiskFitCumulativePoints : A block of cells with exactly two columns. The first column contains x-values and the second column contains the p-values that define the cumulative curve.
Example
[[New Example] (Visual Basic)]
'Change the data range used in 'MyFit' to run from $A$1:$A$100 of the active sheet.
Returns the Excel Workbook associated with the fit definition.
Property type
Read-only property
Syntax (Visual Basic)
Public Property ExcelWorkbook() As Workbook
Remarks
While you can change the DataRange associated with a RiskFitDefinition object after it has been created, you must keep it within the same workbook it was originally created in.
Example
[[New Example] (Visual Basic)]
'Display some basic information about the the first fit definition if @RISK's collection of fits:
Public Sub DisplayFitDefinitionInformation()
Dim displayString As String
displayString = "Information about Fit Definition #1:" & vbCrLf
Controls what type of input filtering occurs on the data before fitting takes place.
Property type
Read-write property
Syntax (Visual Basic)
Public Property FilterType() As RiskFitFilterType
Remarks
If this property is set to RiskFitFilterAbsolute, the FilterMinimum and FilterMaximum properties control the limits of the filtering. If this property is set to RiskFitFilterRelative, the
FilterNumStdDeviations property controls the number of standard deviations permitted by the filter.
Example
[[New Example] (Visual Basic)]
'Set up a fit for cell range A1:A1000 of the active sheet, but filter out any values that don't fall between 0 and 100.
Public Sub SetupFilteredFit()
Dim fitDefinition As RiskFitDefinition
'Create the new fit definition object:
Set fitDefinition = Risk.Fits.Add(Range("A1:A1000"), RiskFitContinousSamples, "MyFit")
'Set up the filter:
With fitDefinition
.FilterType = RiskFitFilterAbsolute
.FilterMinimum = 0
.FilterMaximum = 100
End With
FilterType Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Controls whether fits are performed using mathematical estimation techniques or to predefined distributions.
Property type
Read-write property
Syntax (Visual Basic)
Public Property FitMethod() As RiskFitMethod
Remarks
If this property is set to RiskEstimatedParameters, the distribution types that can be set or retrieved using the EstimatedFitsGetList and EstimatedFitsSetList methods. In addition, the
nature and location of the boundary limits for these distributions can be controlled by the LowerLimitType, LowerLimitValue, UpperLimitType, and UpperLimitValue properties.
If this property is set to RiskPredefinedDistributions, the specific distributions to fit can be set or retrieved using the the PredefinedFitGetList and PredefinedSetList methods.
Example
[[New Example] (Visual Basic)]
'Fits to the data in A1:A100 (in the active sheet) for the Gamma, Lognorm, and Weibull distribution types, with a fixed lower bound of zero.
Public Sub PerformEstimatedFits()
Dim fitDefinition As RiskFitDefinition
Dim distributionTypes(1 To 3) As String
Dim fitResults As RiskFitResultCollection
Dim oneFitResult As RiskFitResult
Dim displayString As String
'Set up a new fit definition object with the correct data range, distribution types to fit, and limits:
Set fitDefinition = Risk.Fits.Add(Range("A1:A100"), RiskFitContinousSamples, "MyFitData")
With fitDefinition
.FitMethod = RiskEstimatedParameters
FitMethod Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Controls the nature of the lower limits of distribution that are estimated during the fitting process.
Property type
Read-write property
Syntax (Visual Basic)
Public Property LowerLimitType() As RiskFitLimitType
Remarks
The property is only relevant if the FitMethod property is set to RiskEstimatedParameters.
If this property is set to RiskFixedLimit, the value of the fixed limit is specified in the LowerLimitValue property.
This property can be useful to apply a constraint to the fitting process. For example, if you fit a Gamma distribution leaving this property at its default value of RiskUnsureLimit, the fitting
process will use a 3-parameter Gamma (that is a Gamma where the lower limit, or shift, is adjustable). However, you may want to alway force this Gamma to have a lower limit of zero.
By setting this property to RiskFixedLimit and the LowerLimitType property to zero, you can accomplish this.
The UpperLimitValue property has the corresponding affect on the distribution upper limits. This, however, is much less commonly done.
Example
[[New Example] (Visual Basic)]
'Fits to the data in A1:A100 (in the active sheet) for the Gamma, Lognorm, and Weibull distribution types, with a fixed lower bound of zero.
Public Sub PerformEstimatedFits()
Dim fitDefinition As RiskFitDefinition
Dim distributionTypes(1 To 3) As String
Dim fitResults As RiskFitResultCollection
Dim oneFitResult As RiskFitResult
Dim displayString As String
'Set up a new fit definition object with the correct data range, distribution types to fit, and limits:
LowerLimitType Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Controls the fixed lower value for an estimated fit.
Property type
Read-write property
Syntax (Visual Basic)
Public Property LowerLimitValue() As Double
Remarks
This property is only relevant if the FitMethod property is set to RiskEstimatedParameters and LowerLimitType is set to RiskFixedLimit
This property can be useful to apply a constraint to the fitting process. For example, if you fit a Gamma distribution leaving the LowerLimitType and LowerLimitValue properties at their
default states, the fitting process will use a 3-parameter Gamma (that is a Gamma where the lower limit, or shift, is adjustable). However, you may want to alway force this Gamma to
have a lower limit of zero. By setting the LowerLimitType property to RiskFixedLimit and this property to zero, you can accomplish this.
The UpperLimitValue property has the corresponding affect on the distribution upper limits. This, however, is much less commonly done.
Example
[[New Example] (Visual Basic)]
'Fits to the data in A1:A100 (in the active sheet) for the Gamma, Lognorm, and Weibull distribution types, with a fixed lower bound of zero.
Public Sub PerformEstimatedFits()
Dim fitDefinition As RiskFitDefinition
Dim distributionTypes(1 To 3) As String
Dim fitResults As RiskFitResultCollection
Dim oneFitResult As RiskFitResult
Dim displayString As String
'Set up a new fit definition object with the correct data range, distribution types to fit, and limits:
Set fitDefinition = Risk.Fits.Add(Range("A1:A100"), RiskFitContinousSamples, "MyFitData")
LowerLimitValue Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
The fit name must be unique within the particular workbook where it is defined. That is, you can have two fit definitions with the same name, but only if they are located in two different
workbooks.
Example
[[New Example] (Visual Basic)]
'Displays the names of all fits, and which workbook they are located in.
Public Sub DisplayNamesOfAllFits()
Dim displayString As String
Dim fitDefinition As RiskFitDefinition
displayString = "There are " & Risk.Fits.Count & " fit definitions." & vbCrLf
Controls the nature of the upper limits of distribution that are estimated during the fitting process.
Property type
Read-write property
Syntax (Visual Basic)
Public Property UpperLimitType() As RiskFitLimitType
Remarks
The property is only relevant if the FitMethod property is set to RiskEstimatedParameters.
If this property is set to RiskFixedLimit, the value of the fixed limit is specified in the UpperLimitValue property.
This property can be useful to apply a constraint to the fitting process. For example, if you fit a Triang distribution leaving this property at its default value of RiskUnsureLimit, the fitting
process will allow the upper limit of the triangular distribution to be adjustable during the fitting process. However, you may want to alway force this Triang to have an upper of 5. By
setting this property to RiskFixedLimit and the UpperLimitValue property to 5, you can accomplish this.
It is much more common to set a lower limit than an upper limit.
Example
[[New Example] (Visual Basic)]
'Fits to the data in A1:A100 (in the active sheet) with a Triang distribution with a fixed upper boundary of 5.
Public Sub FitTriangWithFixedUpperLimit()
Dim fitDefinition As RiskFitDefinition
Dim distributionTypes(1 To 1) As String
Dim fitResult As RiskFitResult
Dim displayString As String
'Set up a new fit definition object with the correct data range, distribution types to fit, and limits:
Set fitDefinition = Risk.Fits.Add(Range("A1:A100"), RiskFitContinousSamples, "MyFitData")
UpperLimitType Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Controls the fixed upper value for an estimated fit.
Property type
Read-write property
Syntax (Visual Basic)
Public Property UpperLimitValue() As Double
Remarks
This property is only relevant if the FitMethod property is set to RiskEstimatedParameters and UpperLimitType is set to RiskFixedLimit
This property can be useful to apply a constraint to the fitting process. For example, if you fit a Triang distribution leaving this property and the UpperLimitType properties at their defaults,
the upper limit of the triangular distribution will be adjustable during the fitting process. However, you may want to alway force this Triang to have an upper of 5. By setting the
UpperLimitType property to RiskFixedLimit and this property to 5, you can accomplish this.
It is much more common to set a lower limit than an upper limit.
Example
[[New Example] (Visual Basic)]
'Fits to the data in A1:A100 (in the active sheet) with a Triang distribution with a fixed upper boundary of 5.
Public Sub FitTriangWithFixedUpperLimit()
Dim fitDefinition As RiskFitDefinition
Dim distributionTypes(1 To 1) As String
Dim fitResult As RiskFitResult
Dim displayString As String
'Set up a new fit definition object with the correct data range, distribution types to fit, and limits:
Set fitDefinition = Risk.Fits.Add(Range("A1:A100"), RiskFitContinousSamples, "MyFitData")
With fitDefinition
UpperLimitValue Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Creates a new RiskFitDefinition object for a non-batch fit, and adds it to the collection.
Syntax
Public Function Add( _
ByVal p_DataRange As Range, _
ByVal p_DataType As RiskFitDataType, _
Optional ByVal p_Name As String = "" _
) As RiskFitDefinition
Parameters
p_DataRange
The Excel range which contains the data to be fit.
The data range must be a contiguous block of cells.
The contents and layout of the data range depend on the DataType of the fit, as specified below:
RiskFitContinousSamples : A single rectangular block of cells.
RiskFitDiscreteSamples : A single rectangular block of cells containing only integer values.
RiskFitCountedDiscreteSamples : A block of cells with exactly two columns, both containing only integers. The first column contains the sample values. The second column
contains the number of occurrences of each sample value.
RiskFitUnnormalizedDensityPoints : A block of cells with exactly two columns. The first column contains x-values and the second column contains the y-values that define the
density curve.
RiskFitNormalizedDensityPoints : A block of cells with exactly two columns. The first column contains x-values and the second column contains the y-values that define the density
Add Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
RiskFitCumulativePoints : A block of cells with exactly two columns. The first column contains x-values and the second column contains the p-values that define the cumulative
curve.
p_DataType
Value Description
RiskFitContinuousSamples The data are continuous.
RiskFitDiscreteSamples The data are discrete, integer values.
RiskFitCountedDiscreteSamples The data are discrete, integer values and must arranged in two columns. The first column contains the sample value. The
second column contains the number of samples at that value.
RiskFitUnnormalizedDensityPoints The data are (x,y) points that define a continuous density curve. The data must be arranged in two columns. The first column
contains the x-values, while the second contains the y-values. No normalization transformation is applied to the data before
fitting.
RiskFitNormalizedDensityPoints The data are (x,y) points that define a continuous density curve. The data must be arranged in two columns. The first column
contains the x-values, while the second contains the y-values. Before fitting occurs, the data is transformed so that the area
under the curve defined by the data (assuming linear extrapolation between data points) is equal to one.
RiskFitCumulativePoints The data are (x,p) points that define a continuous cumulative curve. The data must be arranged in two columns. The first
column contains the x-values, while the second contains the p-values.
p_Name
The name of the fit. This name must be unique within the particular workbook where the fit resides. Two fits may have the same name if they are associated with different
workbooks.
Remarks
Note: Adding a fit does not actuall perform the fit. You must call the newly created object's PerformFit method.
Note: This method adds a regular (non-batch) fit. To add a batch fit, use AddBatch Method.
Example
[[New Example] (Visual Basic)]
'Defines a new fit of continuous sample data residing in the range $A$1:$A$100 on the active sheet named 'MyFit'.
Creates a new RiskFitDefinition object for a batch fit, and adds it to the collection.
Syntax
Public Function AddBatch( _
ByVal p_DataRange As Range, _
ByVal p_DataType As RiskFitDataType, _
Optional ByVal p_Name As String = "" _
) As RiskFitDefinition
Parameters
p_DataRange
The Excel range which contains the data to be fit.
The data range must be a contiguous block of cells, containing one or two columns of data for each fit in the batch.
The contents and layout of the data range depend on the DataType of the fit, as specified below:
RiskFitContinousSamples : One column per fit.
RiskFitDiscreteSamples : One column per fit, containing only integer values.
RiskFitCountedDiscreteSamples : Two columns per fit, both containing only integers. The first column for each fit contains the sample values. The second column contains the
number of occurrences of each sample value.
RiskFitUnnormalizedDensityPoints : Two columns per fit. The first column contains x-values and the second column contains the y-values that define the density curve.
RiskFitNormalizedDensityPoints : Two columns per fit. The first column contains x-values and the second column contains the y-values that define the density curve.
RiskFitCumulativePoints : Two columns per fit. The first column contains x-values and the second column contains the p-values that define the cumulative curve.
p_DataType
Value Description
RiskFitContinuousSamples The data are continuous.
AddBatch Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
RiskFitDiscreteSamples The data are discrete, integer values.
RiskFitCountedDiscreteSamples The data are discrete, integer values and must arranged in two columns. The first column contains the sample value. The
second column contains the number of samples at that value.
RiskFitUnnormalizedDensityPoints The data are (x,y) points that define a continuous density curve. The data must be arranged in two columns. The first column
contains the x-values, while the second contains the y-values. No normalization transformation is applied to the data before
fitting.
RiskFitNormalizedDensityPoints The data are (x,y) points that define a continuous density curve. The data must be arranged in two columns. The first column
contains the x-values, while the second contains the y-values. Before fitting occurs, the data is transformed so that the area
under the curve defined by the data (assuming linear extrapolation between data points) is equal to one.
RiskFitCumulativePoints The data are (x,p) points that define a continuous cumulative curve. The data must be arranged in two columns. The first
column contains the x-values, while the second contains the p-values.
p_Name
The name of the fit. This name must be unique within the particular workbook where the fit resides. Two fits may have the same name if they are associated with different workbooks.
Remarks
Note: Adding a fit does not actuall perform the fit. You must call the newly created object's PerformFit method.
Note: This method adds a batch fit. To add a batch fit, use Add Method
Example
[Visual Basic]
Public Sub RunMacro()
Dim fitDefinition As RiskFitDefinition
Set fitDefinition = Risk.Fits.AddBatch(ActiveSheet.Range("b2:h13"), RiskFitContinuousSamples, "MyBatch")
Returns a single fit definition from the collection.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Item( _
ByVal p_Index As Variant _
) As RiskFitDefinition
Parameters
p_Index
This can be specified by name or by numerical index in the collection.
Remarks
If requesting a fit by name, be aware that if two fits have the same name (which can only occur if they are defined in two different workbooks) the one in the active Excel workbook will be
returned. If two names are the same and neither is in the active Excel workbook, which one is returned is not defined.
Note: This is the 'default' property of the collection and thus it does not need to be explicity specified. In other words, the two lines of code below are equivalent:
Set fitDefinition = Risk.Fits.Item("MyFit")
Set fitDefinition = Risk.Fits("MyFit")
Example
[[New Example] (Visual Basic)]
'Get the fit definition named 'MyFit'
Dim fitDefinition as RiskFitDefinition
Set fitDefinition = Risk.Fits("MyFit")
Item Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns the kurtosis (4th standardized central moment) of the input data.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Kurtosis() As Double
Remarks
There are two different definitions commonly used by statisticians for kurtosis, which differ from each other by 3. The one used by @RISK gives the normal distribution a kurtosis of 3 and
not 0.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
Kurtosis Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
Returns the (approximate) mode of the simulation result.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Mode() As Double
Remarks
The mode of a set of continuous sample data is not easily calculated. For data of this type, the result returned here is only an approximation.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
Returns a percentile (x-value) for the fitted input.
Property type
Read-only property
Syntax (Visual Basic)
Public Property PToX( _
ByVal p_PValue As Double _
) As Double
Parameters
p_PValue
The p-value (a number between 0 and 1) for which to return the corresponding x-value.
Remarks
PToX calculates the value of the result (the "x-value") such that the specified percentage of the input data are at that x-value or less.
The XToP method performs the opposite operation, and returns the percentage of input data that fall at or below the specified x-value.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the 10th, 50th, and 90th percentiles of the the input data and normal fit for 'MyFitData'.
Public Sub DisplayFitComparisonPercentiles()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
PToX Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns the skewness (3rd standardized central moment) of the input data.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Skewness() As Double
Remarks
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] ()]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits("MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
Returns the fraction of input probability that occurs at or below the specified value.
Property type
Read-only property
Syntax (Visual Basic)
Public Property XToP( _
ByVal p_XValue As Double _
) As Double
Parameters
p_XValue
The x-value for which to return the corresponding p-value.
Remarks
XToP calculates the fraction of input probability (the 'p-value') that falls below the specified 'x-value'.
The PToX method performs the opposite operation, and returns the x-value which has the specified fraction of probability at or below it.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the fraction of input data that occurs at or below 0 for the input data 'MyFitData'
'and compare this with the same fraction for the fitted normal.
Public Sub DisplayInputDataNegativeFraction()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
XToP Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns the fitted distribution function US/English format.
Property type
Read-only property
Syntax (Visual Basic)
Public Property DistributionFunction() As String
Remarks
If the fitting process failed, this string will be blank.
This property returns the distribution in US/English format. If you need the same function in the current user's locale, use the DistributionFunctionLocal property instead.
Example
[[New Example] (Visual Basic)]
'Do a fit of 'MyFitData' and display the Normal distribution that was fit in US and in local format.
Returns the fitted distribution function local format.
Property type
Read-only property
Syntax (Visual Basic)
Public Property DistributionFunctionLocal() As String
Remarks
If the fitting process failed, this string will be blank.
This property returns the distribution in local format. If you need the same function in the US/English format, use the DistributionFunction property instead.
Example
[[New Example] (Visual Basic)]
'Do a fit of 'MyFitData' and display the Normal distribution that was fit in US and in local format.
For an estimated parameter fit, this will be the name of the distribution type. For a predefined distribution fit, this will be the name specified for that particular fit.
Returns the kurtosis (4th standardized central moment) of the fitted distribution.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Kurtosis() As Double
Remarks
There are two different definitions commonly used by statisticians for kurtosis, which differ from each other by 3. The one used by @RISK gives the normal distribution a kurtosis of 3 and
not 0.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[Visual Basic]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
Kurtosis Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns the maximum value of the fitted distribution.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Maximum() As Double
Remarks
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[Visual Basic]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[Visual Basic]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[Visual Basic]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[Visual Basic]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
Returns a percentile (x-value) for the fitted distribution.
Property type
Read-only property
Syntax (Visual Basic)
Public Property PToX( _
ByVal p_PValue As Double _
) As Double
Parameters
p_PValue
The p-value (a number between 0 and 1) for which to return the corresponding x-value.
Remarks
PToX calculates the value of the result (the "x-value") such that the specified percentage of the fitted distribution are at that x-value or less.
The XToP method performs the opposite operation, and returns the percentage of values that fall at or below the specified x-value.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Returns the skewness (3rd standardized central moment) of the fitted distribution.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Skewness() As Double
Remarks
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[Visual Basic]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
Returns the standard deviation of the fitted distribution.
Property type
Read-only property
Syntax (Visual Basic)
Public Property StdDeviation() As Double
Remarks
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[Visual Basic]
'Display a comparison of the statistic of the input and the normal distribution fit for 'MyFitData'.
Public Sub DisplayFitComparisonStatistics()
Dim displayString As String
Dim fitResultCollection As RiskFitResultCollection
Dim fitInput As RiskFitInput
Dim fitResult As RiskFitResult
Set fitResultCollection = Risk.Fits( "MyFitData").PerformFit
Set fitInput = fitResultCollection.fitInput
Set fitResult = fitResultCollection("Normal")
displayString = "Comparison Statistics of Input vs Fit:" & vbCrLf
A fit can be unsuccessful for a variety of reasons. A textual description of the reason a fit failed can be gotten from the InvalidFitDescription property.
Example
[[New Example] (Visual Basic)]
'Do a fit of 'MyFitData' and display the Gamma distribution that was fit.
'If the fit was invalid, display why.
Public Sub CheckForInvalidFit()
Dim fitResults As RiskFitResultCollection
Dim displayString As String
Set fitResults = Risk.Fits("MyFit").PerformFit
With fitResults("Gamma")
If .ValidFit Then
displayString = .DistributionFunction
Else
displayString = "Gamma was not a valid fit." & vbCrLf & .InvalidFitDescription
End If
End With
ValidFit Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns the fraction of fitted distribution probability that occurs at or below the specified value.
Property type
Read-only property
Syntax (Visual Basic)
Public Property XToP( _
ByVal p_XValue As Double _
) As Double
Parameters
p_XValue
The x-value for which to return the corresponding p-value.
Remarks
XToP calculates the fraction of probability (the 'p-value') that falls below the specified 'x-value'.
The PToX method performs the opposite operation, and returns the x-value which has the specified fraction of probability at or below it.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
This can be specified as a string (the name of the fit - usually the name of the distribution type) or by numerical index in the collection.
Remarks
Note: This is the 'default' property of the collection and thus it does not need to be explicity specified. In other words, the two lines of code below are equivalent:
Set fitResult = MyFitResultCollection.Item("Normal")
Set fitResult = MyFitResultCollection("Normal")
Example
[[New Example] (Visual Basic)]
'Do a fit of 'MyFitData' and display the Normal distribution that was fit.
Public Sub GetNormalFit()
Dim fitResults As RiskFitResultCollection
Set fitResults = Risk.Fits("MyFitData").PerformFit
With fitResults("Normal")
Item Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns the critical value of the test statistic based of the results of the parametric bootstrap analysis of the fit.
Property type
Read-only property
Syntax (Visual Basic)
Public Property CriticalValue( _
ByVal p_SignificanceLevel As Double _
) As Double
Parameters
p_SignificanceLevel
A value between 0 and 1.
Remarks
The value will be the special value RiskNaN if the bootstrap was not performed, failed to run successfully, or for tests that don't have critical values.
Returns the P-Value of the test statistic, based of the results of the parametric bootstrap analysis of the fit.
Property type
Read-only property
Syntax (Visual Basic)
Public Property PValue() As Double
Remarks
The value will be the special value RiskNaN if the bootstrap was not performed, failed to run successfully, or for statistics that don't have P-Values.
Boolean - If the goal was reached, this result will be TRUE and the input cell will be replaced with the number that obtains the desired goal. If the goal could not be reached, the result will
be FALSE and the input cell will be unchanged.
Example
[Visual Basic]
'Make the mean of the output in cell B5 equal to the value 100, by changing the value in A1.
'The output mean must be within 1% of the target value.
Specifies how closely the output statistic must match the target value.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ComparisonTolerance() As Double
Remarks
If the ComparisonMethod Property is set to RiskComparePercentOfTargetValue, this value is a percentage (e.g. .05 = 5%) of the OutputTarget Property. If set to
RiskCompareDistanceFromTargetValue, this value is the absolute distance allowed between the target and the actual calculated value.
Example
[Visual Basic]
'Specify the desired goal to set the 95% of cell A1 to be within 1% of 100.
Public Sub SetGoalSeekOutputInformation(ByVal p_Analysis As RiskGoalSeekAnalysis)
The cell must be an @RISK output. If a cell that is not an @RISK output is selected, it will automatically become an @RISK output when the analysis is run.
Example
[Visual Basic]
'Specify the desired goal to set the 95% of cell A1 to be within 1% of 100.
Public Sub SetGoalSeekOutputInformation(ByVal p_Analysis As RiskGoalSeekAnalysis)
Creates an @RISK for Project parameter entry table.
Syntax
Public Sub CreateParameterEntryTable( _
ByVal p_FieldName As String, _
ByVal p_DistributionName As String, _
ByVal p_MinChange As Double, _
ByVal p_MaxChange As Double, _
Optional ByVal p_TaskWorkbook As Workbook = Nothing _
)
Parameters
p_FieldName
The name of the field in project for which the parameter entry table will be created.
p_DistributionName
The name of the distribution type (e.g. RiskNormal).
p_MinChange
The minimum change amount, a fractional value between 0 and 1.
p_MaxChange
The maximum change amount, a fractional value between 0 and 1.
p_TaskWorkbook
Optional - If specified, the workbook in which the parameter entry table will be created. If omitted, a new parameter entry table will be created for each open workbook containing
Creates a probabilistic Gantt chart in an Excel Workbook
Syntax
Public Sub CreateProbabilisticGanttChart( _
Optional ByVal p_TaskWorkbook As Workbook = Nothing _
)
Parameters
p_TaskWorkbook
Optional - If specified, the workbook in which the Gannt chart will be created. If omitted, one chart will be created for each open workbook containing @RISK for Project information.
Creates a standard (deterministic) Gantt chart in an Excel Workbook.
Syntax
Public Sub CreateStandardGanttChart( _
Optional ByVal p_TaskWorkbook As Workbook = Nothing _
)
Parameters
p_TaskWorkbook
Optional - If specified, the workbook in which the Gannt chart will be created. If omitted, one chart will be created for each open workbook containing @RISK for Project information.
Returns a RiskSimulatedResult object, containing information about the simulation results of the specified input distribution.
Syntax
Public Function GetSimulatedInput( _
ByVal p_Reference As Variant, _
Optional ByVal p_Simulation As Variant = 1 _
) As RiskSimulatedResult
Parameters
p_Reference
Indicates which input to return information for. This can be specified in three different ways:
(String) If the reference is a string, it refers to the official name of the input, as determined either automatically by @RISK, or directly specified in an RiskName() property function.
(Excel Range Object) If an Excel.Range object is passed for the reference, the input located in that cell will be used. If more than one input reside in that cell, the first input will be
used.
(Long) If an long integer is passed for the reference, the input with that index in @RISK's list of inputs will be used.
p_Simulation
Indicates which simulation to return information for, in the case of a multiple simulation run.
This parameter is optional. If not specified, the results of the first simulation will be returned.
This can be either the numerical index of the simulation, where the first simulation is 1, the second 2, and so on, or it can be the name of a simulation, as defined by the user.
Example
[[New Example] (Visual Basic)]
'Demonstrate three different ways to get an @RISK's input's mean and std. deviation and display it.
'Assume the 19th input in @RISK's input list has a name of 'MyInput' and is located on Cell C36 of the active sheet.
Public Sub GetInputStatisticsByName()
GetSimulatedInput Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns a RiskSimulatedResult object, containing information about the simulation results of the specified output.
Syntax
Public Function GetSimulatedOutput( _
ByVal p_Reference As Variant, _
Optional ByVal p_Simulation As Variant = 1 _
) As RiskSimulatedResult
Parameters
p_Reference
Indicates which output to return information for. This can be specified in three different ways:
(String) If the reference is a string, it refers to the official name of the output, as determined either automatically by @RISK, or directly specified in the RiskOutput() function
(Excel Range Object) If an Excel.Range object is passed for the reference, the output located in that cell will be used.
(Long) If an long integer is passed for the reference, the output with that index in @RISK's list of outputs will be used.
p_Simulation
Indicates which simulation to return information for, in the case of a multiple simulation run.
This parameter is optional. If not specified, the results of the first simulation will be returned.
This can be either the numerical index of the simulation, where the first simulation is 1, the second 2, and so on, or it can be the name of a simulation, as defined by the user.
Example
[[New Example] (Visual Basic)]
'Demonstrate three different ways to get an @RISK's output's mean and std. deviation and display it.
'Assume the 11th output in @RISK's output list has a name of 'NPV (10%)' and is located on Cell C10 of the active sheet.
Public Sub GetOutputStatisticsByName()
Dim displayString As String
GetSimulatedOutput Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns the random number seed used to generate the current simulation results.
Property type
Read-only property
Syntax (Visual Basic)
Public Property RandomNumberSeed( _
Optional ByVal p_Simulation As Variant = 1 _
) As Variant
Parameters
p_Simulation
Indicates which simulation to return information for, in the case of a multiple simulation run.
This can be either the numerical index of the simulation, where the first simulation is 1, the second 2, and so on, or it can be the name of a simulation, as defined by the user.
Example
[[New Example] (Visual Basic)]
'Display information about the random numbers used in the current @RISK simulation results.
Public Sub DisplaySimulationRandomNumberInformation()
Dim generatorString As String
If Risk.Simulation.Results.Exist Then
Select Case Risk.Simulation.Results.RandomNumberGenerator
Case RiskMersenneTwister: generatorString = "Mersenne Twister"
Case RiskMRG32k3a: generatorString = "MRG32k3a"
Case RiskMWC: generatorString = "MWC"
Case RiskKISS: generatorString = "KISS"
Case RiskLFIB4: generatorString = "LFIB4"
RandomNumberSeed Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns correlation sensitivity information for the simulation output results.
Syntax
Public Function CalculateCorrelationSensitivities( _
ByRef p_Sensitivities() As RiskSensitivityData _
) As Long
Parameters
p_Sensitivities
An array of RISKSensitivityData stuctures that will be filled in by the method.
This array will come back sorted, with the highest correlation values first.
There will be one structure for each input that has a direct function relationship with the output. In other words, no input that is not a functional precedent of the output will appear in
this array. Even inputs with a correlation coefficient of zero with the output will be represented in the return array.
Return Type
Long - The number of elements in the returned array.
Remarks
This method can only be called on output simulation results.
Example
[[New Example] (Visual Basic)]
'Display correlation sensitivity information for the output 'MyOutput'.
Public Sub DisplayCorrelationSensitivities()
Dim displayString As String
Dim numInputs As Long
Dim sensitivityData() As RiskSensitivityData
Dim i As Long
CalculateCorrelationSensitivities Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns regression sensitivity information for the simulation output results.
Syntax
Public Function CalculateRegressionSensitivities( _
ByVal p_CoefficientFormat As RiskRegressionCoefficientFormat, _
ByRef p_Sensitivities() As RiskSensitivityData, _
Optional ByRef p_RValue As Double _
) As Long
Parameters
p_CoefficientFormat
Value Description
RiskRegressionEquationCoefficients Raw regression equation coefficients.
RiskRegressionStdBCoefficients The raw regression equation coefficients are 'standardized' by multiplying by the factor (Input Std. Deviation / Output Std.
Deviation).
RiskRegressionMappedValues The raw regression equation coefficients are multiplied by the Input Std. Deviation.
Indicates in what format the regression coefficients should be returned.
p_Sensitivities
An array of RISKSensitivityData stuctures that will be filled in by the method.
This array will come back sorted, with the highest coefficient values first.
There will be one structure for each input that has a direct function relationship with the output. In other words, no input that is not a functional precedent of the output will appear in
this array. Even inputs with a regression coefficient of zero with the output will be represented in the return array.
The type of coefficient returned is controled by the CoefficientFormat parameter.
p_RValue
Optionally returns the 'r'-Value of the regression fit.
CalculateRegressionSensitivities Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Returns scenario information for the given simulated output result.
Syntax
Public Function CalculateScenarios( _
ByVal p_TargetMinimum As Double, _
ByVal p_TargetMaximum As Double, _
ByVal p_TargetsArePercentiles As Boolean, _
ByRef p_ScenarioData() As RiskScenarioData _
) As Long
Parameters
p_TargetMinimum
The minimum target value. This is either an actual value or a percentile (between 0 and 1) depending on the TargetsArePercentiles parameter.
p_TargetMaximum
The maximum target value. This is either an actual value or a percentile (between 0 and 1) depending on the TargetsArePercentiles parameter.
p_TargetsArePercentiles
Indicates whether the values specified in TargetMinimum and TargetMaximum are percentiles or actual values.
p_ScenarioData
An array of RISKScenarioData stuctures that will be filled in by the method.
This array will come back sorted, with the highest significance values first.
There will be one structure for each input that has a direct function relationship with the output. In other words, no input that is not a functional precedent of the output will appear in
this array. Even inputs with a significance of zero for the specified target and output will be represented in the return array.
Return Type
Long - The number of scenario results in the returned array.
Remarks
This method can only be called on output simulation results.
CalculateScenarios Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Currently only the mean and percentiles are permitted.
p_Percentile
If the Statistic specified is a percentile, specifies which percentile. Must be between 0 and 1.
p_Sensitivities
An array of RiskStatisticSensitivityData Structure that will be filled in by the method.
This array will come back sorted, with the highest correlation values first.
There will be one structure for each input that has a direct function relationship with the output. In other words, no input that is not a functional precedent of the output will appear in
this array. Even inputs with a correlation coefficient of zero with the output will be represented in the return array.
Return Type
Long - The number of inputs in the returned array. Only inputs with a functional (precedence) relationship with the output will be included.
Example
[Visual Basic]
'Display the most signifant input in controlling the mean of the output in cell d6.
Public Sub GetMostSignficantInput()
Dim outputResult As RiskSimulatedResult
Dim numInputs As Long
Dim sensInfo() As RiskStatisticSensitivityData
Dim inputLocation As String
Set outputResult = Risk.Simulation.Results.GetSimulatedOutput(Range("Sheet1!$D$6"))
Returns an array of sample data for the given result.
Syntax
Public Function GetSampleData( _
ByRef p_Data() As Double, _
ByVal p_ValidSamplesOnly As Variant _
) As Long
Parameters
p_Data
The array which will be filled with sample data by the method.
p_ValidSamplesOnly
Indicates whether only valid samples (non-error, non-filtered values) will be returned. Setting this to TRUE will strip these values from the array. Setting the to FALSE will leave the
bad values in the array, where they will be marked with the special value RiskNaN.
Returns an Excel.Range object, indicating where the input or output was located.
Property type
Read-only property
Syntax (Visual Basic)
Public Property ExcelCell() As Range
Remarks
This cell location refers to the cell where the input or output was located at the time the simulation was run. If subsequently the input or output was moved, this location may no longer be
correct.
Example
[[New Example] (Visual Basic)]
'Displays basic information about the simulation results for output 'MyOutput'.
Public Sub DisplayResultIdentificationInformation()
Dim displayString
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
Returns the index of the output or input in the collection of simulation results.
Property type
Read-only property
Syntax (Visual Basic)
Public Property ItemIndex() As Long
Remarks
There are two lists, one for inputs and one for outputs. Thus there can be an input with index 1 and an output with index 1.
This index is reference by several analysis results, such as those returned by CalculateCorrelationSensitivities, CalculateRegressionSensitivities, and CalculationScenarios.
Example
[[New Example] (Visual Basic)]
'Displays basic information about the simulation results for output 'MyOutput'.
Public Sub DisplayResultIdentificationInformation()
Dim displayString
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
Returns the skewness (4th standardized central moment) of the simulation result.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Kurtosis() As Double
Remarks
There are two different definitions commonly used by statisticians for kurtosis, which differ from each other by 3. The one used by @RISK gives the normal distribution a kurtosis of 3 and
not 0.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the statistics of the simulation results for output 'MyOutput'.
Public Sub DisplayResultStatistics()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
Returns the maximum value sampled in the simulation result.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Maximum() As Double
Remarks
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the statistics of the simulation results for output 'MyOutput'.
Public Sub DisplayResultStatistics()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the statistics of the simulation results for output 'MyOutput'.
Public Sub DisplayResultStatistics()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
Returns the minimum value sampled in the simulation result.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Minimum() As Double
Remarks
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the statistics of the simulation results for output 'MyOutput'.
Public Sub DisplayResultStatistics()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
Returns the (approximate) mode of the simulation result.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Mode() As Double
Remarks
The mode of a set of continuous sample data is not easily calculated. The result returned here is only an approximation.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the statistics of the simulation results for output 'MyOutput'.
Public Sub DisplayResultStatistics()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
Returns the total number of samples in the simulation result.
Property type
Read-only property
Syntax (Visual Basic)
Public Property NumSamplesTotal() As Long
Remarks
This sample count includes all samples, even if they included errors or values that were filtered out. Use the NumSamplesUsed property for the number of sample that were used to
calculation the statistics, percentiles, and other results for this simulation result object.
Example
[[New Example] (Visual Basic)]
'Display the sample counts for the simulation output 'MyOutput'.
Public Sub DisplaySampleCounts()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
displayString = "Sample counts for output 'MyOutput':" & vbCrLf
Returns the total number of samples used to calculate the statistics, percentiles, and other results for this object.
Property type
Read-only property
Syntax (Visual Basic)
Public Property NumSamplesUsed() As Long
Remarks
The count excludes any samples that were filtered or that were error values. Use the NumSamplesTotal property to get the total number of samples, regardless if they were excluded from
the result calculations or not.
Example
[[New Example] (Visual Basic)]
'Display the sample counts for the simulation output 'MyOutput'.
Public Sub DisplaySampleCounts()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
displayString = "Sample counts for output 'MyOutput':" & vbCrLf
Returns a percentile (x-value) for the simulated result.
Property type
Read-only property
Syntax (Visual Basic)
Public Property PToX( _
ByVal p_PValue As Double _
) As Double
Parameters
p_PValue
The p-value (a number between 0 and 1) for which to returnt the corresponding x-value.
Remarks
PToX calculates the value of the result (the "x-value") such that the specified percentage of the samples are at that x-value or less.
The XToP method performs the opposite operation, and returns the percentage of samples that fall at or below the specified x-value.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the 10th, 50th, and 90th percentiles of the the simulated output 'MyOutput'.
Public Sub CalculatePercentiles()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
Returns the skewness (3rd standardized central moment) of the simulation result.
Property type
Read-only property
Syntax (Visual Basic)
Public Property Skewness() As Double
Remarks
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the statistics of the simulation results for output 'MyOutput'.
Public Sub DisplayResultStatistics()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
Returns the standard deviation of the simulation result.
Property type
Read-only property
Syntax (Visual Basic)
Public Property StdDeviation() As Double
Remarks
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the statistics of the simulation results for output 'MyOutput'.
Public Sub DisplayResultStatistics()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
Returns the fraction of samples that occur at or below the specified value.
Property type
Read-only property
Syntax (Visual Basic)
Public Property XToP( _
ByVal p_XValue As Double _
) As Double
Parameters
p_XValue
The x-value for which to return the corresponding p-value.
Remarks
XToP calculates the fraction of samples (the 'p-value') that fall below the specified 'x-value'.
The PToX method performs the opposite operation, and returns the x-value which has the specified fraction of values at or below it.
The special values RiskPositiveInfinity, RiskNegativeInfinity, and RiskNaN can be returned by @RISK statistics properties to indicate infinities or "Not a Number" results.
Example
[[New Example] (Visual Basic)]
'Display the fraction of values that occur at or below 0 for the simulation output 'MyOutput'.
Public Sub DisplayFractionOfNonPositiveSamples()
Dim displayString As String
With Risk.Simulation.Results.GetSimulatedOutput("MyOutput")
displayString = "Fraction of Samples At or Below Zero = " & .XToP(0)
End With
XToP Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Creates a new RiskAdvSensitivityAnalysis object, for use in automating @RISK's Advanced Sensitivity Analysis feature.
Syntax
Public Function NewAdvSensitivityAnalysis( _
Optional ByVal p_SourceWorkbook As Workbook = Nothing _
) As RiskAdvSensAnalysis
Parameters
p_SourceWorkbook
If supplied, the returned RiskAdvSensitivityAnalysis will be filled with analysis settings that were already stored in the specified workbook. If left blank, a set of default settings is used.
Example
[Visual Basic]
Public Sub RunAdvSensitivityAnalysis()
With Risk.Simulation.NewAdvSensitivityAnalysis()
Set .OutputCell = ActiveSheet.Range("B5")
.OutputStatistic = RiskStatisticMean
With .Inputs.Add(RiskSensAnalysisCellBasedInput, ActiveSheet.Range("A1"))
.VariationMethod = RiskVariationMinMaxRange
.VariationMinimum = 0
.VariationMaximum = 100
.BaseValue = 50
End With
.ReportPlacement = RiskNewWorkbook
.RunAnalysis
NewAdvSensitivityAnalysis Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Creates a new RiskGoalSeekAnalysis object, for use in automating @RISK's Goal Seek feature.
Syntax
Public Function NewGoalSeekAnalysis( _
Optional ByVal p_SourceWorkbook As Workbook = Nothing _
) As RiskGoalSeekAnalysis
Parameters
p_SourceWorkbook
If supplied, the returned RiskGoalSeekAnalysis will be filled with analysis settings that were already stored in the specified workbook. If left blank, a set of default settings is used.
Example
[Visual Basic]
'Make the mean of the output in cell B5 equal to the value 100, by changing the value in A1.
'The output mean must be within 1% of the target value.
Creates a new RiskStressAnalysis object, for use in automating @RISK's Stress Analysis feature.
Syntax
Public Function NewStressAnalysis( _
Optional ByVal p_SourceWorkbook As Workbook = Nothing _
) As RiskStressAnalysis
Parameters
p_SourceWorkbook
If supplied, the returned RiskStressAnalysis object will be filled with analysis settings that were already stored in the specified workbook. If left blank, a set of default settings is used.
Example
[Visual Basic]
'Run a stress analysis on the output in cell B5, while stressing the input
'in cell A1 in its upper 5 percentiles.
Public Sub RunStressAnalysis()
With Risk.Simulation.NewStressAnalysis()
Set .OutputCell = ActiveSheet.Range("B5")
With .Inputs.Add(ActiveSheet.Range("A1"))
.PercentileMin = 0.95
.PercentileMax = 1
End With
.RunAnalysis
End With
End Sub
NewStressAnalysis Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
ConvergenceTestingEnabled Controls whether @RISK will monitor output convergence during a simulation.
ConvergenceTestingPeriod Controls the number of iterations run between convergence monitor tests.
ConvergenceTolerance Controls the amount of change allowed in an output statistic being monitored, while still considering it to be converged.
LiveUpdate Controls whether open @RISK windows and graphs are updated while a simulation is in progress.
LiveUpdatePeriod Controls the frequency of the update of open @RISK windows and graphs during a simulation.
MacroAfterRecalculation Specifies the name of a macro to run after each iteration's calculation.
MacroAfterRecalculationEnabled Controls whether @RISK will run a macro after each iteration's recalculation.
MacroAfterSimulation Specifies the name of a macro to run after each simulation has completed.
MacroAfterSimulationEnabled Controls whether @RISK will run a macro after each simulation has completed.
MacroBeforeRecalculation Specifies the name of a macro to run before each iteration's calculation.
MacroBeforeRecalculationEnabled Controls whether @RISK will run a macro before each iteration's recalculation.
MacroBeforeSimulation Specifies the name of a macro to run before each simulation starts.
MacroBeforeSimulationEnabled Controls whether @RISK will run a macro before each simulation starts.
MinimizeExcel Controls whether Excel is minimized at the start of an @RISK simulation.
NumIterations Controls the number of iterations in a simulation.
NumSimulations Sets the number of simulations to run in a single 'batch'.
PauseOnOutputErrors Controls whether @RISK will pause in the middle of an @RISK simulation to display errors in an output.
RandomNumberGenerator Controls which random number generator @RISK uses to draw samples.
randomSeed Controls the random number seed used by @RISK when it is drawing samples during a simulation.
RandomSeedChangesForMultipleSimulations Controls how @RISK seeds simulations in a multiple simulation run.
ReportSelected Controls what reports are generated automatically at the end of an @RISK simulation.
ReportsToGenerate Controls what reports are generated automatically at the end of an @RISK simulation.
SamplingType Specifies whether @RISK should use stratified (Latin Hypercube) sampling or unstratified (Monte Carlo) sampling.
ShowExcelRecalculations Controls whether each Excel spreadsheet recalculation is displayed during an @RISK simulation.
SmartSensitivityAnalysisEnabled Controls whether smart sensitivity analysis is enabled.
StatisticFunctionUpdating Controls when @RISK statistic functions will be updated during a simulation.
StdRecalcBehavior Controls whether the values returned from @RISK functions when a simulation is not running are random or static.
StdRecalcWithoutRiskStatic Controls what values are returned from @RISK functions that do not contain a RiskStatic property function when a
simulation is not running.
StdRecalcWithoutRiskStaticPercentile Controls what percentile values are returned from @RISK functions that do not contain a RiskStatic property function
when a simulation is not running.
UseMultipleCPUs Controls whether @RISK will use multiple CPUs to run an @RISK simulation.
Loads the simulation settings stored (if any) in the specified Excel workbook.
Syntax
Public Function LoadFromWorkbook( _
ByVal p_Workbook As Workbook _
) As Boolean
Parameters
p_Workbook
The workbook from which to load stored @RISK simulation settings.
Return Type
Boolean - TRUE if settings were found and loaded. FALSE if default settings were applied.
Remarks
When you open an Excel workbook that contains @RISK simulation settings (either via Excel's interface or via VBA code) and @RISK simulation settings are already present, you will
receive a query asking you whether you want to use the new settings stored in the workbook.
If you want to suppress this message in code, you can set Risk.DisplayAlerts = FALSE, in which case those settings will not be loaded. To load those settings in code, you can use this
method.
If the specified workbook does not contain any @RISK settings, the return code of the function will be FALSE and the default @RISK simulation settings (as controlled partially by the
Risk.ApplicationSettings object) will be used instead. If settings do exist in the workbook, the return value of this function is TRUE.
Example
[[New Example] (Visual Basic)]
'Open the workbook at C:\MyWorkbook.xls, making sure to use the @RISK simulation settings it contains.
Public Sub OpenWorkbookWithSimulationSettings()
Dim wb As Excel.Workbook
LoadFromWorkbook Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Saves the current @RISK simulation settings to the specified workbook.
Syntax
Public Sub SaveToWorkbook( _
ByVal p_Workbook As Workbook _
)
Parameters
p_Workbook
The workbook to which the settings should be saved.
Remarks
When the user saves an Excel workbook with @RISK open, it automatically writes @RISK information into it. This information includes the simulation settings, fit definitions,
and simulation results if appropriate. However, if you save a workbook via code using the Workbook.Save or Workbook.SaveAs methods, this information is not automatically written into
the workbook and you may use this method to do so.
This method only writes the @RISK simulation settings to the workbook. If you want to write all the relevant @RISK information to a workbook, instead call the
Risk.WriteWorkbookInformation method.
Example
[[New Example] (Visual Basic)]
'Saves the current @RISK simulation settings to the active Excel workbook.
Retrieves the list of user-defined simulation names.
Syntax
Public Function SimulationNamesGetArray( _
ByRef p_SimulationNames() As String _
) As Integer
Parameters
p_SimulationNames
A 1-based array of strings. If no simulation names have been defined, the returned array will be empty.
Return Type
Integer - the number of names.
Remarks
The number of names here is not necessarily the same as the actual number of simulations that will be run (as defined in the NumSimulations property). If this array is bigger than the
number of simulations run, the extra names will be ignored. If this array is smaller than the number of simulations run, the remaining simulations will revert the a default naming scheme
(Sim #5, Sim #6, etc.)
There can be at most 100 named simulations.
Example
[[New Example] (Visual Basic)]
'Display the simulation names defined by the user.
Public Sub DisplaySimulationNames()
Dim numNames As Integer
Dim simNames() As String
Dim displayString As String
Dim i As Integer
SimulationNamesGetArray Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
A 1-based array of strings. If no simulation names should be defined, pass an empty array. You can specify a maximum of 100 simulation names.
Remarks
The number of names here is not necessarily the same as the actual number of simulations that will be run (as defined in the NumSimulations property). If this array is bigger than the
number of simulations run, the extra names will be ignored. If this array is smaller than the number of simulations run, the remaining simulations will revert the a default naming scheme
(Sim #5, Sim #6, etc.)
There can be at most 100 named simulations.
Example
[[New Example] (Visual Basic)]
'Run a simulation with 3-named simulations.
Public Sub RunNamedSimulations()
Dim simNames() As String
'Tell @RISK we will be running 3 simulations:
Risk.Simulation.Settings.NumSimulations = 3
'Set up the simulation names for these 3 simulations:
ReDim simNames(1 To 3)
SimulationNamesSetArray Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Controls if @RISK keeps information about samples drawn from input distributions.
Property type
Read-write property
Syntax (Visual Basic)
Public Property CollectDistributionSamples() As RiskCollectDistributionSamples
Remarks
In order to perform sensitivity and scenario analyses, @RISK needs to keep sample information for the input distributions in your model. However, if your model has a large number of
inputs, this may use a large number of resources. If you are not doing these type of analyses, you can completely disable the collection of input samples my setting this property to
RiskCollectNone. If you have a specific subset of important inputs that you want to include in your analysis but don't need to keep samples for all inputs, you can mark the special inputs
with a RiskCollect() property function, and set this property to RiskCollectMarked.
Example
[[New Example] (Visual Basic)]
'Make @RISK collect distribution samples only for distributions marked with a RiskCollect() property function.
Controls the confidence level of the confidence monitoring tests on output statistics.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ConvergenceConfidenceLevel() As Double
Remarks
This property is only relevent if the ConvergenceTestingEnabled property is True.
This is a default property. A specific output may have a RiskConvergence() property function that overrides this value.
This property combined with the ConvergenceTolerance property control how sensitive the convergence monitoring is. For example, if the ConvergenceTolerance = 0.03 and
ConvergenceConfidenceLevel = 0.95 and the testing is being performed on the mean, that is equivalent of saying we want to be 95 percent confident that the simulation mean is within 3
percent of the true value.
Example
[[New Example] (Visual Basic)]
'Set up convergence monitoring options:
Public Sub SetupConvergenceMonitoring()
With Risk.Simulation.Settings
.ConvergenceTestingEnabled = True
.ConvergenceTestingPeriod = 100
.ConvergenceTestAllOutputs = True
.ConvergenceTolerance = 0.03
.ConvergenceConfidenceLevel = 0.95
.ConvergencePerformMeanTest = True
.ConvergencePerformStdDeviationTest = True
ConvergenceConfidenceLevel Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Controls which outputs @RISK will perform convergence monitoring on.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ConvergenceTestAllOutputs() As Boolean
Remarks
This property is only relevent if the ConvergenceTestingEnabled property is True.
If this property is TRUE, all outputs in the model will be monitored for convergence. If this property is FALSE, only the ouputs marked with a RiskConvergence() property function iwll be
monitored.
Example
[[New Example] (Visual Basic)]
'Set up convergence monitoring options:
Public Sub SetupConvergenceMonitoring()
With Risk.Simulation.Settings
.ConvergenceTestingEnabled = True
.ConvergenceTestingPeriod = 100
.ConvergenceTestAllOutputs = True
.ConvergenceTolerance = 0.03
.ConvergenceConfidenceLevel = 0.95
.ConvergencePerformMeanTest = True
.ConvergencePerformStdDeviationTest = True
.ConvergencePerformPercentileTest = True
.ConvergencePercentileToTest = 0.9
ConvergenceTestAllOutputs Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Controls the amount of change allowed in an output statistic being monitored, while still considering it to be converged.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ConvergenceTolerance() As Double
Remarks
This property is only relevent if the ConvergenceTestingEnabled property is True.
This property combined with the ConvergenceConfidenceLevel property control how sensitive the convergence monitoring is. For example, if the ConvergenceTolerance = 0.03 and
ConvergenceConfidenceLevel = 0.95 and the testing is being performed on the mean, that is equivalent of saying we want to be 95 percent confident that the simulation mean is within 3
percent of the true value.
Example
[[New Example] (Visual Basic)]
'Set up convergence monitoring options:
Public Sub SetupConvergenceMonitoring()
With Risk.Simulation.Settings
.ConvergenceTestingEnabled = True
.ConvergenceTestingPeriod = 100
.ConvergenceTestAllOutputs = True
.ConvergenceTolerance = 0.03
.ConvergenceConfidenceLevel = 0.95
.ConvergencePerformMeanTest = True
.ConvergencePerformStdDeviationTest = True
.ConvergencePerformPercentileTest = True
.ConvergencePercentileToTest = 0.9
ConvergenceTolerance Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Specifies the name of a macro to run after each iteration's calculation.
Property type
Read-write property
Syntax (Visual Basic)
Public Property MacroAfterRecalculation() As String
Remarks
This property only has effect if the MacroAfterRecalculationEnabled property is True.
The specified macro must be a Public Sub which takes no arguments.
To fully qualify the name, prefix the macro name with the workbook name followed by an exclamation point (see the example below). If the exclamation point is missing, the macro is
assumed to be in whatever workbook is active in Excel at the time the simulation starts.
Example
[[New Example] (Visual Basic)]
'Set up the macros to run during an @RISK simulation.
Specifies the name of a macro to run after each simulation has completed.
Property type
Read-write property
Syntax (Visual Basic)
Public Property MacroAfterSimulation() As String
Remarks
This property only has effect if the MacroAfterSimulationEnabled property is True.
The specified macro must be a Public Sub which takes no arguments.
To fully qualify the name, prefix the macro name with the workbook name followed by an exclamation point (see the example below). If the exclamation point is missing, the macro is
assumed to be in whatever workbook is active in Excel at the time the simulation starts.
Example
[[New Example] (Visual Basic)]
'Set up the macros to run during an @RISK simulation.
Specifies the name of a macro to run before each iteration's calculation.
Property type
Read-write property
Syntax (Visual Basic)
Public Property MacroBeforeRecalculation() As String
Remarks
This property only has effect if the MacroBeforeRecalculationEnabled property is True.
The specified macro must be a Public Sub which takes no arguments.
To fully qualify the name, prefix the macro name with the workbook name followed by an exclamation point (see the example below). If the exclamation point is missing, the macro is
assumed to be in whatever workbook is active in Excel at the time the simulation starts.
Example
[[New Example] (Visual Basic)]
'Set up the macros to run during an @RISK simulation.
Specifies the name of a macro to run before each simulation starts.
Property type
Read-write property
Syntax (Visual Basic)
Public Property MacroBeforeSimulation() As String
Remarks
This property only has effect if the MacroBeforeSimulationEnabled property is True.
The specified macro must be a Public Sub which takes no arguments.
To fully qualify the name, prefix the macro name with the workbook name followed by an exclamation point (see the example below). If the exclamation point is missing, the macro is
assumed to be in whatever workbook is active in Excel at the time the simulation starts.
Example
[[New Example] (Visual Basic)]
'Set up the macros to run during an @RISK simulation.
Controls the number of iterations in a simulation.
Property type
Read-write property
Syntax (Visual Basic)
Public Property NumIterations() As Long
Remarks
Use the special value RiskAutoNumIterations to have @RISK use convergence monitoring to determine how many iterations to run. Note: setting NumIterations = RiskAutoNumIterations
will automatically set NumSimulations = 1.
Example
[[New Example] (Visual Basic)]
'Set up a 3 simulation / 250 iteration run and start it:
Sets the number of simulations to run in a single 'batch'.
Property type
Read-write property
Syntax (Visual Basic)
Public Property NumSimulations() As Integer
Remarks
If NumIterations = RiskAutoNumIterations, NumSimulations must be 1.
You can name each simulation using the SimulationNamesSetArray method.
Use the RandomSeedChangesForMultipleSimulations property to control if the random numbers generated in each simulation should change or remain the same.
Example
[[New Example] (Visual Basic)]
'Set up a 3 simulation / 250 iteration run and start it:
Controls the random number seed used by @RISK when it is drawing samples during a simulation.
Property type
Read-write property
Syntax (Visual Basic)
Public Property randomSeed() As Long
Remarks
The seed must be a number between 1 and 2147483647.
This property can be set to the special value RiskAutomaticSeed which will generate a new seed based on your computer's clock when a new simulation is started.
The random number generator is set using the RandomNumberGeneratorProperty.
The RandomSeedChangesForMultipleSimulations controls how the seed changes if you are performing a multiple simulation run.
Example
[[New Example] (Visual Basic)]
'Sets @RISK's simulation sampling options to their most common configuration:
Public Sub ConfigureSimulationSamplingOptions()
With Risk.Simulation.Settings
.SamplingType = RiskLatinHypercube
.RandomNumberGenerator = RiskMersenneTwister
.RandomSeed = RiskAutomaticSeed
.RandomSeedChangesForMultipleSimulations = False
.CollectDistributionSamples = RiskCollectAll
End With
End Sub
randomSeed Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Controls how @RISK seeds simulations in a multiple simulation run.
Property type
Read-write property
Syntax (Visual Basic)
Public Property RandomSeedChangesForMultipleSimulations() As Boolean
Remarks
If this property is False, each simulation in the multiple simulation run will have the same random number stream.
If this property is True, each simulation will be seeded differently. However, if you set a fixed random number seed, the entire run as a whole will still be reproducible.
Example
[[New Example] (Visual Basic)]
'Sets @RISK's simulation sampling options to their most common configuration:
Controls what reports are generated automatically at the end of an @RISK simulation.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ReportSelected( _
ByVal p_WhichReport As RiskReportSelection _
) As Boolean
Parameters
p_WhichReport
Value Description
RiskSimulationReportQuick A "Quick" Report, one page per output, with a summary of the most important information for each output.
RiskSimulationReportInputResultsSummary A summary report of all the simulated inputs. This matches the information in the Input tab of the @RISK Results
Summary window.
RiskSimulationReportOutputResultsSummary A summary report of all the simulated outputs. This matches the information in the Output tab of the @RISK Results
Summary window.
RiskSimulationReportDetailedStatistics A set of detailed statistical results for all inputs and outputs. This matches the information in the @RISK Detailed
Statistics window.
RiskSimulationReportData The complete set of simulation data for all inputs and outputs. This matches the information in the @RISK Data
window.
RiskSimulationReportSensitivity The sensitivity results for all outputs. This matches the information in the @RISK Sensitivities window.
RiskSimulationReportScenarios The scenarios report for all outputs. This matches the information in the @RISK Scenarios window.
ReportSelected Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
RiskSimulationReportTemplateSheets A static copy of all open template sheet. Template sheets must start with the prefix "RiskTemplate_".
RiskModelReportInputs A report summarizing all the currently defined inputs. This matches the information in the Inputs tab of the @RISK
Model window.
RiskModelReportOutputs A report summarizing all the currently defined outputs. This matches the information in the Outputs tab of
the @RISK Model window.
RiskModelReportCorrelations A report summarizing all the currently defined correlations. This matches the information in the Correlations tab of
the @RISK Model window.
Remarks
This property controls which reports will be generated automatically at the end of an @RISK simulation if the AutomaticallyGenerateReports property is True.
You can also set this information in a 'bit-packed' format using the ReportsToGenerate property.
Example
[[New Example] (Visual Basic)]
'Set up automatic reports to include both the input and output summary reports:
Controls what reports are generated automatically at the end of an @RISK simulation.
Property type
Read-write property
Syntax (Visual Basic)
Public Property ReportsToGenerate() As RiskReportSelection
Remarks
This property controls which reports will be generated automatically at the end of an @RISK simulation if the AutomaticallyGenerateReports property is True.
This property returns a "bit-packed" version of this information. That is, the value is the sum of the constant values of each selected report. You can also set this information for individual
reports using the ReportSelected property.
Example
[[New Example] (Visual Basic)]
'Set up automatic reports to include both the input and output summary reports:
Controls whether the values returned from @RISK functions when a simulation is not running are random or static.
Property type
Read-write property
Syntax (Visual Basic)
Public Property StdRecalcBehavior() As RiskStandardRecalcBehavior
Remarks
This property indicates whether random or static values should be returned from @RISK functions when a simulation is not running. Setting this property equal to RiskRandomValues will
cause the Excel to generate a single random sample each time Excel is recalculated (either automatically or when you press the F9 key.) Setting this property to RiskStaticValues values
will return the current static value defined for the function, or if there isn't one, a value based on the StdRecalcWithoutRiskStatic and StdRecalcWithoutRiskStaticPercentile properties.
Example
[[New Example] (Visual Basic)]
'Set the standard Excel recalculation to return either the value specified in a RiskStatic property
'function, if there is one, or the 75 percentile of the distributions lacking a RiskStatic.
Controls what values are returned from @RISK functions that do not contain a RiskStatic property function when a simulation is not running.
Property type
Read-write property
Syntax (Visual Basic)
Public Property StdRecalcWithoutRiskStatic() As RiskStaticValueType
Remarks
This property indicates what values @RISK should return from distributions when a simulation is not running. This property is only relevent when the StdRecalcBehavoir is set to
RiskStaticValues, and it only applies to those distributions functions that do not contain a RiskStatic property function.
If this property is set to RiskPercentileValue, you must also supply which percentile to use in the StdRecalcWithoutStaticPercentile property.
Example
[[New Example] (Visual Basic)]
'Set the standard Excel recalculation to return either the value specified in a RiskStatic property
'function, if there is one, or the 75 percentile of the distributions lacking a RiskStatic.
Controls what percentile values are returned from @RISK functions that do not contain a RiskStatic property function when a simulation is not running.
Property type
Read-write property
Syntax (Visual Basic)
Public Property StdRecalcWithoutRiskStaticPercentile() As Double
Remarks
This property indicates what percentile values @RISK should return from distributions when a simulation is not running. This property is only relevent when the StdRecalcBehavoir is set
to RiskStaticValues, StdRecalcWithoutRiskStatic is set to RiskPercentileValue, and it only applies to those distributions functions that do not contain a RiskStatic property function.
The percentile values must be between 0 and 1.
Example
[[New Example] (Visual Basic)]
'Set the standard Excel recalculation to return either the value specified in a RiskStatic property
'function, if there is one, or the 75 percentile of the distributions lacking a RiskStatic.
The cell must be an @RISK output. If a cell that is not an @RISK output is selected, it will automatically become an @RISK output when the analysis is run.
Example
[Visual Basic]
'Run a stress analysis on the output in cell B5, while stressing the input
'in cell A1 in its upper 5 percentiles.
Public Sub RunStressAnalysis()
With Risk.Simulation.NewStressAnalysis()
Set .OutputCell = ActiveSheet.Range("B5")
With .Inputs.Add(ActiveSheet.Range("A1"))
.PercentileMin = 0.95
.PercentileMax = 1
End With
.RunAnalysis
End With
End Sub
OutputCell Property
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Specifies if multiple inputs are stressed simultaneously in a single simulation.
Property type
Read-write property
Syntax (Visual Basic)
Public Property StressMultipleInputsSimulataneously() As Boolean
Remarks
If this property is TRUE, a single simulation will be run that stresses all the stressed inputs simultaneously. If FALSE, each input will be stressed individually in it's own simulation.
Optional ByRef p_DistributionFunctionPosition As Integer = 1 _
)
Parameters
p_Cell
Specifies a cell reference for the input reference. This must be a single cell.
p_DistributionFunctionPosition
Optionally specifies an @RISK functional position for the input. This is only needed if there is more than one @RISK distribution in the same cell. In that case, the value 1 indicates
the first @RISK distribution, 2 the second, and so on.
Remarks
When an input if created with Add Method, you can specify a single input cell, and function position. If that is the only cell reference you want in the input, you need do nothing else.
However, you may want to specify a compound input with more than one cell reference in a single input. In that case, this method must be used to add that additional items.
Example
[Visual Basic]
'Add a compound input with three cells (A1, A2, and A3) all which are constrained to sample
'within the top 5%.
Public Sub AddCompoundStressInput(ByVal p_Analysis As RiskStressAnalysis)
With p_Analysis.Inputs.Add()
.AddInputReference ActiveSheet.Range("A1")
.AddInputReference ActiveSheet.Range("A2")
.AddInputReference ActiveSheet.Range("A3")
.StressMethod = RiskStressPercentileRange
AddInputReference Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
Retrieves information about a single input reference.
Syntax
Public Function GetInputReferenceInfo( _
ByVal p_Index As Integer, _
Optional ByRef p_Cell As Range, _
Optional ByRef p_DistributionFunctionPosition As Integer _
) As Range
Parameters
p_Index
Indicates for which input reference information is being sought.
p_Cell
Returns the single cell where the input reference is located.
p_DistributionFunctionPosition
The functional position of the input. This is only needed if there is more than one @RISK distribution in the same cell. In that case, the value 1 indicates the first @RISK distribution,
Optional ByVal p_InputReferenceCell As Range = Nothing, _
Optional ByRef p_DistributionFunctionPosition As Integer = 1 _
) As RiskStressInput
Parameters
p_InputReferenceCell
Optionally specifies a cell reference for the input. This must be a single cell. (Multiple cell references many be added to the same stress input by calling the AddInputReference
Method multiple times for an input.)
p_DistributionFunctionPosition
Optionally specifies an @RISK functional position for the input. This is only needed if there is more than one @RISK distribution in the same cell. In that case, the value 1 indicates
the first @RISK distribution, 2 the second, and so on.
Example
[Visual Basic]
'Add a stress input at cell A1 that is restricted to the lowest 5th percentile.
Public Sub AddSensitivityInput(ByVal p_Analysis As RiskStressAnalysis)
With p_Analysis.Inputs.Add(ActiveSheet("A1"))
.StressMethod = RiskStressPercentileRange
.PercentileMin = 0
.PercentileMax = 0.05
End With
End Sub
See Also
Add Method
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
An enumeration which specified possible methods of fitting distribution to data.
Members
Member Description
RiskEstimatedParameters 'Fits' are performed using mathematical estimation techniques (for example, using the method of maximum likelihood
esitmation, or least-squares fitting, etc.)
RiskPredefinedDistributions 'Fits' are performed to a predefined set of distributions, which can then be compared to determine the best fitting option.
This is also sometimes called hypothesis comparison.
RiskKISS_SWB KISS+SWB has period >2^7700 and is highly recommended. Subtract-with-borrow (SWB) has the same local behaviour
as lagged Fibonacci using +,-,xor- -- the borrow merely provides a much longer period. SWB fails the birthday spacings
test, as do all lagged Fibonacci and other generators that merely combine two previous values by means of =,- or xor.
Those failures are for a particular case: m=512 birthdays in a year of n=2^24 days. There are choices of m and n for
which lags >1000 will also fail the test.
RiskRAN3I This is the random number generator used in @RISK 3.x and @Risk 4.x. It is from Numerical Recipes, and is based on
a portable “subtractive”random number generator of Knuth.
Remarks
(MWC, KISS, LFIB4, SWB, AND KISS+SWB) are all from George Marsaglia at Florida State University. See http://www.lns.cornell.edu/spr/1999-01/msg0014148.html for his comments.
An enumeration of possible regression coefficient formats.
Members
Member Description
RiskRegressionEquationCoefficients Raw regression equation coefficients.
RiskRegressionStdBCoefficients The raw regression equation coefficients are 'standardized' by multiplying by the factor (Input Std. Deviation / Output Std.
Deviation).
RiskRegressionMappedValues The raw regression equation coefficients are multiplied by the Input Std. Deviation.
RiskSimulationReportQuick A "Quick" Report, one page per output, with a summary of the most important information for each output.
RiskSimulationReportInputResultsSummary A summary report of all the simulated inputs. This matches the information in the Input tab of the @RISK Results
Summary window.
RiskSimulationReportOutputResultsSummary A summary report of all the simulated outputs. This matches the information in the Output tab of the @RISK Results
Summary window.
RiskSimulationReportDetailedStatistics A set of detailed statistical results for all inputs and outputs. This matches the information in the @RISK Detailed
Statistics window.
RiskSimulationReportData The complete set of simulation data for all inputs and outputs. This matches the information in the @RISK Data window.
RiskSimulationReportSensitivity The sensitivity results for all outputs. This matches the information in the @RISK Sensitivities window.
RiskSimulationReportScenarios The scenarios report for all outputs. This matches the information in the @RISK Scenarios window.
RiskSimulationReportTemplateSheets A static copy of all open template sheet. Template sheets must start with the prefix "RiskTemplate_".
RiskModelReportInputs A report summarizing all the currently defined inputs. This matches the information in the Inputs tab of the @RISK
Model window.
RiskModelReportOutputs A report summarizing all the currently defined outputs. This matches the information in the Outputs tab of the @RISK
Model window.
RiskModelReportCorrelations A report summarizing all the currently defined correlations. This matches the information in the Correlations tab of the
@RISK Model window.
See Also
RiskReportSelection Enumeration
Palisade @RISK 6.0 for Excel Object Library Send comments on this topic.
An enumeration of possible sensitivity analysis input types.
Members
Member Description
RiskSensAnalysisCellBasedInput The entire cell (or cells) will be changed during the sensitivity analysis.
RiskSensAnalysisDistributionBasedInput Only the @RISK distribution function in the specified cell (or cells) will be changed during the sensitivity analysis
An enumeration of possible static values to be used when an RiskStaticValue is not specified for a function.
Members
Member Description
RiskCorrectedExpectedValue The expected value of the distribution is used, except that in the case of a discrete distribution, the results is modified to
match one of the possible results. (This latter adjustment is useful to prevent non-simulation calculation errors in the
spreadsheet.)
RiskTrueExpectedValue The true (non-rounded) expected value.
RiskModeValue The mode.
RiskPercentileValue A percentile (specified in another property).
An enumeration of possible ways the change preview dialog will be displayed when the @RISK user swaps in functions.
Members
Member Description
RiskPreviewAll The preview dialog will always be displayed, showing all formula changes.
RiskPreviewModifiedFormulasAndStaticValues Only formulas and/or static values that were modified after the swap out occured will be shown in the change preview
dialog.
RiskPreviewModifiedFormulas Only formulas that were modified after the swap out occured will be shown in the change preview dialog.
RiskPreviewNone The change preview dialog will never be shown.
Public Property Availability() As RiskLibraryAvailability
Remarks
The @RISK Library feature is not available in the Standard Edition of @RISK.
The user may turn off the @RISK Library feature manually with the LibraryEnabled property of the Risk.ApplicationSettings object.
Since the set up of the librarys' databases may take some time, the @RISK Library loads asynchronously. If the value of this property is RiskLibraryInitializationInProgress, that indicates
that the Library is still in the process of starting up.
Example
[[New Example] (Visual Basic)]
'Show the @RISK Library window if it is available.
Public Sub ShowAtRiskLibraryIfAvailable()
If Risk.Library.Availability = RiskLibraryAvailable Then