Difference between revisions of "Evaluation modes"

m
Line 3: Line 3:
 
[[Category:Doc_Status_D]] <!-- For Lumina use, do not change -->
 
[[Category:Doc_Status_D]] <!-- For Lumina use, do not change -->
 
   
 
   
The '''Value''' of an expression or variable is the result of evaluating the expression or definition of the variable. There are two types of values:   
+
There are two modes, "Mid" and "Prob", to evaluate the Definition of a variable or other expression. They result in two types of value:   
* The '''Mid value''' is  '''deterministic'''. It uses the [[median]] of any probability distribution that appears in the expression or definition, or any definition of a variable on which it depends.   
+
* The '''Mid value''' is  deterministic, ignoring any uncertainties. It uses the [[median]] of any probability distribution in a Definition, and the "Mid value" of any variable or function on which it depends.  The [[Mid]] value is often close to [[Median]], but it is not guaranteed, to be equal because <code>Median(F(x, y))</code> is not always the same as <code>F(Median(x), Median(y))</code>.
  
* The''' Prob value''' is a probabilistic value represented as a random sample of values from the probability distribution. It generates a random sample from any probability distribution that appears in the expression or definition, or any definition of a variable on which it depends. It uses a [[Monte Carlo]] or other [[sampling method]]. Each sample is indexed by the system index [[Run]] -- numbered from 1 to [[SampleSize]]. '''Samplesize '''is the number of samples set in the [[Uncertainty Setup dialog]] (available from the [[Result menu]]).
+
* The '''Prob value''' (probabilistic value) is represented as a random sample of values from the probability distribution. In "Prob mode" it evaluates any probability distribution in a definition -- e.g. <code>Normal(10, 5)</code> -- as a random sample using a [[Monte Carlo]] or other selected [[sampling method]]. Each sample is an array indexed by the system index [[Run]] -- numbered from 1 to [[SampleSize]]. It uses the "Prob value" of any variable or function on which it depends.  
It is fast to evaluate the Mid value because it avoids the Monte Carlo or other simulation with multiple samples used to represent uncertainties. A multivariate distribution returns an array of Mid values. The [[Mid]] value is often close to [[Median]], but it is not guaranteed, because <code>Median(F(x, y))</code> is not necessarily the same as <code>F(Median(x), Median(y))</code>.  
 
  
By default, when you first ask for a Result -- a Table or Graph -- it computes and shows the Mid value.  You can control the evaluation mode by selecting an [[Uncertainty view of a result|Uncertainty view]] from the pulldown menu in the top left of the [[Result window]]:  [[Mid]] displays the Mid value (computing it if necessary). If you select any other Uncertainty view ('''Mean''', '''Stats''', '''Bands''', '''PDF '''or Prob Mass, '''CDF '''or CumProb, or '''Sample'''), it tries to evaluate the variable, and its predecessors, in Prob mode. If it can, it displays the resulting uncertain quantity using the uncertainty view you selected. If neither the variable nor its predecessors contain a probability distribution, it has no Prob value -- it shows a warning message, and shows the Mid result.  
+
By default, when you first ask for a Result -- a Table or Graph -- it computes and shows the Mid value.  This is much faster for a large model, since it only computes a single value for each distribution rather than a sample of numbers.
 +
 
 +
You can compute and display the "Prob value" by selecting an [[Uncertainty view of a result|Uncertainty view]] from the pulldown menu in the top left of the [[Result window]]:  '''Mean''', '''Stats''', '''Bands''', '''PDF '''or Prob Mass, '''CDF '''or CumProb, or '''Sample'''. If the variable has no "Prob value" because neither the variable nor any of its inputs contain a probability distribution, it shows a warning message, and shows the Mid result. You can also select "Mid"  from the [[Uncertainty view of a result|Uncertainty view]]  to go back to see the [[Mid]] value (computing it if necessary). 
 +
 
 +
The accuracy with which the "Prob value" represents the underlying probability distribution increases with [[SampleSize]]. It usually makes sense to start with a small number -- e.g. the default 100. You can increase it later when you have verified the model is correct, in the [[Uncertainty Setup dialog]] (available from the [[Result menu]]).  
  
 
[[Statistical functions]] -- such as [[Mean]], [[Sdeviation]], [[Correlation]] -- expect their main parameter(s) to be uncertain and evaluate them, and their predecessors, in Prob mode, even if they appear in an expression being evaluated in Mid mode. A statistical function estimates its value from a Prob value (or two Prob values, in the case of [[Correlation]], and related functions). If you define  
 
[[Statistical functions]] -- such as [[Mean]], [[Sdeviation]], [[Correlation]] -- expect their main parameter(s) to be uncertain and evaluate them, and their predecessors, in Prob mode, even if they appear in an expression being evaluated in Mid mode. A statistical function estimates its value from a Prob value (or two Prob values, in the case of [[Correlation]], and related functions). If you define  

Revision as of 21:41, 31 July 2017


There are two modes, "Mid" and "Prob", to evaluate the Definition of a variable or other expression. They result in two types of value:

  • The Mid value is deterministic, ignoring any uncertainties. It uses the median of any probability distribution in a Definition, and the "Mid value" of any variable or function on which it depends. The Mid value is often close to Median, but it is not guaranteed, to be equal because Median(F(x, y)) is not always the same as F(Median(x), Median(y)).
  • The Prob value (probabilistic value) is represented as a random sample of values from the probability distribution. In "Prob mode" it evaluates any probability distribution in a definition -- e.g. Normal(10, 5) -- as a random sample using a Monte Carlo or other selected sampling method. Each sample is an array indexed by the system index Run -- numbered from 1 to SampleSize. It uses the "Prob value" of any variable or function on which it depends.

By default, when you first ask for a Result -- a Table or Graph -- it computes and shows the Mid value. This is much faster for a large model, since it only computes a single value for each distribution rather than a sample of numbers.

You can compute and display the "Prob value" by selecting an Uncertainty view from the pulldown menu in the top left of the Result window: Mean, Stats, Bands, PDF or Prob Mass, CDF or CumProb, or Sample. If the variable has no "Prob value" because neither the variable nor any of its inputs contain a probability distribution, it shows a warning message, and shows the Mid result. You can also select "Mid" from the Uncertainty view to go back to see the Mid value (computing it if necessary).

The accuracy with which the "Prob value" represents the underlying probability distribution increases with SampleSize. It usually makes sense to start with a small number -- e.g. the default 100. You can increase it later when you have verified the model is correct, in the Uncertainty Setup dialog (available from the Result menu).

Statistical functions -- such as Mean, Sdeviation, Correlation -- expect their main parameter(s) to be uncertain and evaluate them, and their predecessors, in Prob mode, even if they appear in an expression being evaluated in Mid mode. A statistical function estimates its value from a Prob value (or two Prob values, in the case of Correlation, and related functions). If you define

X := Mean(Y)
Y := Normal(2, 1)

If you evaluate «x» in Mid mode, the statistical function Mean(y) will evaluate «y» in Prob mode. So, the Mid value of «x» will be an estimate of the mean of «y», based on a Monte Carlo sample which is the Prob value of Y. So, evaluating any variable containing a statistical function will cause a Prob mode evaluation of any variable appearing in its parameter(s), and any predecessors of those variables. The result of a statistical function is a Mid value, not a probability distribution. In the example above, X has a Mid value, equal to the mean of Y, but no Prob value.

Conversely, the function Mid(X) always evaluates its parameter «X» in Mid mode, even when Mid(X) is evaluated in Prob mode. For example

X := Mid(Y)
Y := Uniform(10, 20)

In this case, evaluating X, causes Y to be evaluated in Mid mode, returning the median of y (15).

A is a function that returns a median value when evaluated in Mid-mode, and a sample array indexed by the Run Index when evaluated in Sample-mode.

See Also

Comments


You are not allowed to post comments.