Indicator variables
An indicator variable is a variable whose value is 0 or 1. It may be identified with an input data item, or it may be a variable defined in the abbreviated code. It is used to make a choice in a computation. For example, assume ICU is a variable which is either 0 or 1. The following code can be used:
|
|
Alternatively one can code it using an indicator variable:
|
|
This is preferred when MU variables are computed.
In Guide V, Chapter 12, appears this example involving observations of
two types, CP and effect. The latter is modeled by the Emax model.
Observations of both types are recorded in the DV data item. A data
item called TYPE with values 1 and 2 is used to distinguish
between them. This data item may be used to compute the appropriate
prediction in the $ERROR block, as follows:
|
|
The IF-ELSE clause above can be coded as
|
|
This technique can easily be extended to the case of more indicators:
|
|