Difference between revisions of "Evaluation modes"

m
Line 1: Line 1:
 
  <!-- For Lumina use, do not change -->
 
  <!-- For Lumina use, do not change -->
 
   
 
   
 +
Each variable or expression, x, in Analytica has a '''Mid value''', also known as its ''deterministic ''value. If x or any of its predecessors are defined by a probability distribution, it uses the Mid of the distribution (usually its median.) It is fast to evaluate the Mid value because it avoids the Monte Carlo 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 Median(F(x, y)) is not necessarily the same as F(Median(x), Median(y)).
  
A valid variable or expression, x, in Analytica has a '''Mid value''', also known as its ''deterministic ''value. If x or any of the variables that are predecessor of x contain a probability distribution, it uses the Mid of the distribution, usually its median.&nbsp;Thus, the Mid value evaluates the model rapidly, ignoring any uncertainties. A multivariate distribution returns an array of Mid values.&nbsp;Mid(x) value is often close to Median(x), but it is not guaranteed, because Median(F(x, y)) is not necessarily the same as F(Median(x), Median(y)).&nbsp;<br>
+
A variable or expression also has a '''Prob value''' if it is defined as a probability distribution, or if any of its predecessor variables are defined as probability distributions. The Prob value is a actually a random sample from the probability distribution for the variable, based on random samples from its predecessors. Each sample is indexed by the system index '''Run '''-- numbered from 1 to '''Samplesize'''. '''Samplesize '''is the number of samples set in the '''Uncertainty''' dialog box (available from '''Result''' menu).  
  
A variable or expression also has a '''Prob value''' if it&nbsp;contains a probability distribution, or has one or more predecessor variables containing probability distributions. The Prob value is a random sample from the probability distribution for the variable. The sample is indexed by the system index '''Run '''-- numbered from 1 to '''Samplesize'''. '''Samplesize '''is the number of samples set in the '''Uncertainty''' dialog box (available from '''Result''' menu).  
+
By default, when you first ask for a Result -- Table or Graph -- it computes and shows the Mid value. You can control the evaluation mode by selecting an '''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 Cum Prob, 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.  
 
 
You control the evaluation mode when viewing a Result -- Table or Graph -- by selecting the '''Uncertainty view''': If you select '''Mid''', it will evaluate the variable (and any of its predecessors if necessary) in Mid mode, and display the Mid value of the result. If you select another Uncertainty view ('''Mean''', '''Stats''', '''Bands''', '''PDF '''or Prob Mass, '''CDF '''or Cum Prob, 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 give you a warning message, and shows the Mid result.  
 
  
 
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 18:23, 24 July 2011


Each variable or expression, x, in Analytica has a Mid value, also known as its deterministic value. If x or any of its predecessors are defined by a probability distribution, it uses the Mid of the distribution (usually its median.) It is fast to evaluate the Mid value because it avoids the Monte Carlo 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 Median(F(x, y)) is not necessarily the same as F(Median(x), Median(y)).

A variable or expression also has a Prob value if it is defined as a probability distribution, or if any of its predecessor variables are defined as probability distributions. The Prob value is a actually a random sample from the probability distribution for the variable, based on random samples from its predecessors. Each sample is indexed by the system index Run -- numbered from 1 to Samplesize. Samplesize is the number of samples set in the Uncertainty dialog box (available from Result menu).

By default, when you first ask for a Result -- Table or Graph -- it computes and shows the Mid value. You can control the evaluation mode by selecting an 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 Cum Prob, 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.

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.

Comments


You are not allowed to post comments.