CB.DefineAssumND

This subroutine defines a new assumption or changes an existing assumption in the selected cell without using a dialog.

If a simulation runs before this subroutine is used, the simulation must be reset before the assumption is defined.

Note:

Before calling this subroutine, select a single cell.

Table 52. CB.DefineAssumND Parameters

Parameter

VBA Data Type

Value

Description

DistType

Integer

Integer value or named constant. See Table 53.

Specifies a distribution type for the assumption. The number of parameters varies with the distribution type. See the table on the next page for types and associated parameters.

Parm1, Parm2, Parm3 (All are optional)

Variant

See Table 53.

Parameter values for the distribution type specified with the DistType parameter

LowCutOff (Optional)

Variant

Numeric

Sets the lower truncation value. The default is –Infinity. This parameter is ignored for custom distributions.

HighCutOff (Optional)

Variant

Numeric

Sets the upper truncation value. The default is +Infinity. This parameter is ignored for custom distributions.

NameOf (Optional)

Variant

Title surrounded by quotes ("")

Names the assumption. If you do not’t specify a name, Crystal Ball uses the first of either: the cell’s range name, text from the cell preceding (to the left of) that cell, text from the cell one row before (above) that cell, or the cell’s coordinates.

Dynamic (Optional)

Variant

True or False

Specifies whether Crystal Ball calculates cell parameters once at the beginning of the simulation or with each trial

Parm4 (Optional)

Variant

See Table 53.

The minimum value for the 4-parameter beta distribution

Note:

The optional Dynamic parameter is deprecated in this release. It remains in the code for compatibility with 2000.5 (5.5) versions of the Crystal Ball Developer Kit but will be obsolete in later versions because cell references are always dynamic in later versions of Crystal Ball. Beginning with version 11.1.1.0.00, the lognormal distribution has three parameters instead of two. If this call is used in a model that was created in an earlier version of Crystal Ball, the third parameter has a value of 0.

The following table lists the values for Parm1, Parm2, Parm3, and Parm4 for each DistType constant. For more information about these parameter values, see the description of each distribution type in Appendix A of the current Oracle Crystal Ball User's Guide. The current Oracle Crystal Ball Statistical Guide lists defaults for each parameter value.

Table 53. CB.DefineAssumND Parameter Values and Descriptions

DistType Parameter Named Constant Value (C = continuous, D = discrete)

DistType Parameter Index Value

Parm1 Description

Parm2 Description

Parm3 Description

Parm4 Description (Optional)

cbDfaNormal (C)

0

mean value

standard deviation value

n/a

n/a

cbDfaTriangular (C)

1

minimum value

likeliest value

maximum value

n/a

cbDfaPoisson (D)

2

rate value (between 0 and 1000)

n/a

n/a

n/a

cbDfaBinomial (D)

3

probability (between 0 and 1)

trials (a whole number greater than 0 and less than 1000)

n/a

n/a

cbDfaLogNormal (C)

4

mean value

standard deviation value

location

n/a

cbDfaUniform (C)

5

minimum value

maximum value

n/a

n/a

cbDfaExponential (C)

6

rate (greater than 0)

n/a

n/a

n/a

cbDfaGeometric (D)

7

probability (between 0 and 1)

n/a

n/a

n/a

cbDfaWeibull (C)

8

location

scale (greater than 0)

shape (greater than 0.05)

n/a

cbDfaBeta (C)

9

alpha (greater than 0.3, alpha + beta must be less than 1000)

beta (greater than 0.3, alpha + beta must be less than 1000)

maximum value

minimum value

cbDfaHypergeometric (D)

10

probability (between 0 and 1)

trials (whole number less than population)

population (whole number greater than 0 and less than 1000)

n/a

cbDfaCustom (See Defining Custom Distributions) (C/D)

11

cumulative (True) or noncumulative (False). False is the default.

sequential sampling (True) or nonsequential sampling (False); see the section on SIPs in the Oracle Crystal Ball User's Guide

n/a

n/a

cbDfaGamma (C)

12

location

scale (greater than 0)

shape (greater than 0.05 and less than 1000)

n/a

cbDfaLogistic (C)

13

mean value

scale (greater than 0)

n/a

n/a

cbDfaPareto (C)

14

location (greater than 0)

shape (greater than 0.05)

n/a

n/a

cbDfaExtremeValue (C)

15

likeliest

scale (greater than 0)

max (True) or min (False)

n/a

cbDfaNegBinomial (D)

16

probability (between 0 and 1)

shape (whole number greater than 0 and less than 1000)

n/a

n/a

cbDfaHypergeometricSuccess (D)

17

success

trials (whole number less than population)

population (whole number greater than 0 and less than 1000)

n/a

cbDfaMinExtreme (C)

18

likeliest

scale (greater than 0)

n/a

n/a

cbDfaMaxExtreme (C)

19

likeliest

scale (greater than 0)

n/a

n/a

cbDfaStudentsT (C)

20

midpoint

scale (greater than 0)

degrees of freedom (integer between 1 and 30, inclusive)

n/a

cbDfaYesNo (D)

21

probability

n/a

n/a

n/a

cbDfaDiscreteUniform (D)

22

minimum (integer)

maximum (integer)

n/a

n/a

cbDfaBetaPert (C)

23

minimum

likeliest

maximum

n/a

Note:

cbDfaHypergeometric is deprecated. It is included for Crystal Ball 2000.5 (5.5) compatibility and is replaced by cbDfaHypergeometricSuccess in later versions of Crystal Ball. cbDfaExtremeValue is deprecated. It is included for Crystal Ball 2000.5 (5.5) compatibility and is replaced by cbDfaMinExtreme and cbDfaMaxExtreme in later versions of Crystal Ball.

To define an assumption parameter with a dynamic cell reference, specify the cell reference as a string. (See the Oracle Crystal Ball User's Guide for more information on distribution types and parameters.)

The active cell must contain a numerical value or be blank. If it contains anything other than a numerical value (such as an expression, a cell reference, or text), CB.MacroResult returns cbErrBadAssumption.

The parameters must agree with the specified distribution. If there is a problem with a parameter, CB.MacroResult returns cbErrBadAssumption.

Note:

Calling this function is not the same thing as entering an external assumption function such as CB.Normal into a worksheet cell. External assumptions are actual functions that return values using normal Microsoft Excel syntax, but you cannot correlate them with other assumptions; nor do they appear in any reports or sensitivity analyses. Calling this function, CB.DefineAssumND, is equivalent to selecting Define, then Define Assumption.