DetermTable: Deterministic tables

Revision as of 09:01, 14 December 2015 by Bbecane (talk | contribs)

A DetermTable provides an input view like that of an edit table (see To edit a table), allowing you to specify values or expressions in each cell for all index combinations; however, unlike a table, the evaluation of a determtable conditionally returns only selected values from the table. It is called a determtable because it acts as a deterministic function of one or more discrete-valued variables. You can conceptualize a determtable as a multi-dimensional generalization of a select-case statement found in many programming languages, or as a value that varies with the path down a decision tree.

The following shows the edit view of a determ table, in which you can enter a different miles per gallon for each car type. Car_type has been changed from being an index in previous examples to a decision node here, defined as a Choice, with the Hybrid selected.

Chapter12 5.png

When Miles_per_gallon is evaluated, its result contains only the miles per gallon for the selected car type.

Chapter12 6.png

In comparison, the result of evaluating a straight table would include all values for all car types. DetermTable inputs The dimensions of a determtable may be a combination of normal indexes and discrete variables. Each discrete variable used must have a domain that explicitly contains all possible values, and it is these values that are used for the dimension in the determtable edit view. The selection occurs over the discrete variables, so that DetermTable() behaves differently from Table() only when at least one of the dimensions is a discrete variable. The definition of each discrete variable specifies which value from its domain is selected.

When you define a discrete variable to serve as an input to DetermTable(), it is convenient to use a choice menu (see Creating a choice menu) with the index for the Choice() function set to <codeSelf. You must then set the domain attribute to either Explicit Values, Copy from index, or Expression. The Explicit Values option allows you to exist all possible values directly. A Copy from index domain pulls the list of possible values from a separate index object that already contains the list of possible values. Expression is used when you want to compute the possible values based on other variables in your model. When using Expression for a DetermTable, the result must be a list or a call to the Discrete() function with the possible values.

Creating a DetermTable: To define a variable as a determtable:

  1. Decide on the inputs — the discrete conditioning variables.
  2. Press the expr menu above the definition field and select Other....
    Chapter12 7.png
    Analytica opens the Object Finder dialog.
  3. Select Array from the Library popup menu and select Determtable from the function list.
    Chapter12 8.png
  4. Click the Indexes button to open the Indexes dialog, which lets you choose discrete conditioning variable(s).
    Chapter12 9.png
  5. Click OK to accept the indexes and open an Edit Table window.
  6. Enter the outcomes corresponding to each outcome of your discrete inputs.

See Also

Comments


You are not allowed to post comments.