Evaluating Expressions Depending on Condition - Example If you evaluate an expression inside a condition, a special value is shown when the condition is false. By default this special value is (approximately) -999.1111. You can alter this special value via the Options menu on the AnalyseGE form. The example below will make this clear. Example. Consider the following statements in a TAB file. These show a typical aggregation, aggregating household expenditure data from 6 sectors c1-c6 to 3 aggregated sectors aggc1-aggc3. The Com2AggCom values mean that commodities c1 and c2 are aggregated to aggc1, that commodity c3 is aggregated to aggc2 and that commodities c4-c6 are aggregated to aggc3. Set Com (c1-c6) ; Set AggCom (aggc1-aggc3) ; Coefficient (integer) (all,c,com) com2aggcom(c) ; Formula com2aggcom("c1") = 1 ; Formula com2aggcom("c2") = 1 ; Formula com2aggcom("c3") = 2 ; Formula com2aggcom("c4") = 3 ; Formula com2aggcom("c5") = 3 ; Formula com2aggcom("c6") = 3 ; Coefficient (all,c,com) DVHouse(c) # Household consumption # ; Read DVHouse from file Iodata header "CF1" ; Coefficient (all,aggc,AggCom) AggDVHouse(aggc) # Aggregated DVHouse # ; Formula (all,aggc,AggCom) AggDVHouse(aggc) = SUM(c,com: com2aggcom(c) = $POS(aggc), DVHouse(c) ) ; Suppose that you select expression DVHouse(c) inside the conditional SUM in the last formula. Then you will be shown an AGGCOMxCOM array inside the ViewHAR window. The expression displayed will be (All,aggc,AGGCOM)(All,c,COM: Com2AggCom(c) = $POS(aggc) ) DVHouse(c) ; Suppose that the DVHouse(c) values are: 123.4 (c1), 234.6 (c2), 205.1 (c3), 640.2 (c4), 105.1 (c5) and 180.1 (c6). Then the matrix shown in the ViewHAR window will be as follows:
When aggc=aggc1, the only values of c in COM satisfying the condition Com2AggCom(c) = $POS(aggc) are c1 and c2. The xxx values shown under c3-c6 are the special value which indicates that the condition in question is false. By default, xxx is (approximately) -999.1111. [The value used actually shows as -999.111084 to 6 decimal places.] As you can see, the value used affects the row and column totals (for example, yyy above). Ideally you want a value which cannot be the value of one of the cells when the condition is satisfied (or, at least, is unlikely to be the value when the condition is satisfied). You can choose the value to be used via the item Specify Value if Condition is False under the Options menu on the AnalyseGE form. One choice is -0.00000001. This has the virtue of being shown in red in the ViewHAR form (since it is a negative number) and of hardly affecting the row and column totals. You can check the expression actually evaluated by AnalyseGE in a couple of ways. URL of this topic: www.copsmodels.com/webhelp/analysege/hc_evalcond.htm Link to full GEMPACK Manual Link to GEMPACK homepage |