Evaluating Expressions Involving Index-IN-Set


AnalyseGE can handle expressions containing index-in-set such as

IF(c in margcom, coef1(c)) ;

These expressions were introduced in TAB files during 2010 in the GEMPACK Release which followed Release 10.0-002 (April 2010).

Expression To Evaluate When Inside Index-IN-Set

If you select an expression which is inside one or more Index-in-sets, exactly which expression AnalyseGE should evaluate is not immediately obvious. Some examples will make this clear. [Note that, irrespective of Index-In-Set, exactly what AnalyseGE evaluates is shown in the Memo on the AnalyseGE form and is also shown in the Exxx header in the results in the ViewHAR form.]

Example 1

Formula (all,c,com) coef1(c) = IF[c in margcom, coef2(c)/coef3(c)] ;

Suppose the selection is "coef2(c)/coef3(c)". Then the formula evaluated will be:

(all,c,margcom) coef2(c)/coef3(c) ;

Note that the (all,c,com) in the Formula becomes (all,c,margcom) because of the "IF(c in margcom".

Example 2

Formula (all,c,com)(all,i,ind)

IF[c in com2, IF(c,margcom, IF(i in ind2, coef1x(c,i)))].

If you select coef1x(c,i) then the expression to be evaluated will be:

(all,c,margcom)(all,i,ind2) IF[c IN com, IF(c,com2,coef1x(c,i)) ;

[If com2 is declared as a SUBSET of com in the TAB file, the "IF[c IN com" will be omitted.]

Results may be Zero instead of -999.111

An example will make this clear.

Example 3

Suppose that set COM = (c1-c5) has subsets COM2 = (c1,c3,c5) and COM3 = (c2,c3). Consider

Formula (all,c,COM2) Coef1(c) = IF{c IN COM3, coef2(c)} ;

Suppose that you select "coef2(c)" and ask to evaluate it.

When the above Formula is carried out, coef2(c) will only be evaluated when c is in both COM2[because of (allc,COM2)] and COM3 [because of "IF{c IN COM3"]. So, for other values of c (for example c=c2 which is in COM3 but not in COM2), you might expect AnalyseGE to show the result as -999.111. This is because -999.111 is the result it often gives when a condition is not satisfied.

However, when you select "coef2(c)" from the above Formula and ask AnalyseGE to evaluate it, the expression AnalyseGE evaluates is:

(all,c,COM3) IF(c IN COM2, coef2(c)) ;

Hence the results shown are zero if c=c2 and coef2("c3") is c=c3.

[It would be possible for AnalyseGE to report -999.111 instead of zero in the above example but only by using a very complicated formula which would be tricky for us to get right in complicated cases. So we have opted to show the result as zero. We think that won't cause users serious problems.]



URL of this topic: www.copsmodels.com/webhelp/analysege/hc_evalindex.htm

Link to full GEMPACK Manual

Link to GEMPACK homepage