MAKE example: cancelling off-diagonal elements an example of conditional formulae Sometimes we wish to remove off-diagonal elements of the MAKE (multiproduction) matrix. In certain cases we can remove some of these off-diagonal elements rather easily. For example, suppose initially Beverages production of Food = 97, and Food production of Beverages = 70. We could subtract 70 from Bev production of Food .. it becomes 27 subtract 70 from Food production of Bev .. it becomes 0 add 70 to Food production of Food add 70 to Bev production of Bev The effect is to remove one off-diagonal element from the MAKE without altering MAKE row and column totals. Coefficient (all,c,COM)(all,i,IND) MAKE(c,i) # production of com c by ind i #; Read MAKE from file INFILE header MAKE; Set SEC = COM intersect IND; Coefficient ! cancel out matching off-diagonal MAKE elements ! (all,c,COM)(all,i,IND) MAKEADJ(c,i) # MAKE adjustment #; Formula (all,c,COM)(all,i,IND) MAKEADJ(c,i) = 0; (all,c,SEC)(all,i,SEC: ((c<>i) and (MAKE(c,i)>0) and (MAKE(i,c)>MAKE(c,i)))) MAKEADJ(c,i) = MAKE(c,i); ! = smaller of any pair ! Write MAKEADJ to file OUTFILE header MADJ; Formula ! reduce larger of pair by size of smaller ! (all,c,SEC)(all,i,SEC:MAKEADJ(c,i)>0) MAKE(i,c) = MAKE(i,c) - MAKEADJ(c,i); ! transfer adjustment to own production ! (all,c,SEC) MAKE(c,c) = MAKE(c,c) + sum{i,IND, MAKEADJ(c,i)}; (all,i,SEC) MAKE(i,i) = MAKE(i,i) + sum{c,COM, MAKEADJ(c,i)}; ! remove smaller of pair ! (all,c,COM)(all,i,IND: MAKEADJ(c,i)>0) MAKE(c,i) = 0; Write MAKE to file OUTFILE header MAK2 longname adjusted MAKE; URL of this topic: www.copsmodels.com/webhelp/tabmate/hc_makeexample.htm Link to full GEMPACK Manual Link to GEMPACK homepage |