Balancing Matrices with Externally Imposed Preconditions

A researcher who needs to balance a matrix often has data that are not part of the matrix itself, such as the value of – or part of the value of – particular cells, or the range within which the values must fall. The precondition function allows the use of these data to constrain the value of cells or groups of cells.

The function is invoked by the last parameter in the ras, psras, and gvras commands. This parameter specifies a file (such as VA.PRE) that contains a list of the cells that are to be constrained, the types of constraint to be applied, and the values to which they are to be constrained. These values can be expressed directly as a number or as any expression that the G7 software can interpret, such as a series name from any bank or Vam file.

Precondition Commands

There are two types of preconditions. In the first type, a known value is removed from a cell and from the corresponding row and column sums; the matrix is balanced; and finally the value is restored to the cell, row sum, and column sum. In the second type, after each iteration a value or condition is imposed until the matrix can be balanced without changing the value or violating the condition.

  1. Precondition commands that apply to single cells

    eq <rownum> <colnum> <value|expression>

    This command forces the value of the specified cell to equal the value or expression.

    For example:

    eq 7 12 127.5
    

    forces the value of the 12th cell in the 7th row to equal 127.5. A second example is:

    eq 11 8 0.5*c.VA2.3
    

    forces the value of the 8th cell in the 11th row to equal half the value of the cell in matrix VA in Vam file c. This is done by (a) setting the specified cell to 0, (b) removing the value from both the row sum and the column sum, (c) balancing the matrix, and (d) restoring the value to the row and column sums and setting the cell equal to the value.

    pt <rownum> <colnum> <value|expression>

    This command preserves that part of the value of the specified cell to equal the value or expression. For example:

    pt 7 12 51.3
    

    This is done by (a) removing the value from the specified cell, the row sum, and the column sum, (b) balancing the matrix, and (c) restoring the value to the cell, the row sum, and the column sum.

    max <rownum> <colnum> <value|expression>

    This command specifies the maximum value allowed in the specified cell.

    min <rownum> <colnum> <value|expression>

    This command specifies the minimum value allowed in the specified cell.

  2. Precondition commands that apply to groups of cells

    sc <firstrownum> <firstcolnum> <lastrownum> <lastcolnum> <value|expression>

    This command—which applies to part of a row or part of a column or a block of cells—scales the values in the specified cells to the value or expression provided. For example:

    sc 3 1 3 5 c.GV3
    

    The values in the 1st through the 5th columns of the 3rd row are scaled to the value in the 3rd row of the vector GV in Vam file c. A second example is:

    sc 4 2 6 2 d.VA1
    

    The values in the 4th through the 6th columns of the 2nd column are scaled to the value in the 1st row of the vector VA in Vam file d. A third example is:

    sc 2 2 4 6 1000
    

    In the block that includes the 2nd through the 6th columns of the 2nd through the 4th rows, the values are scaled to 1000.

    scmax <firstrownum> <firstcolnum> <lastrownum> <lastcolnum> <value|expression>

    This command scales a partial row, or a partial column, or a block of cells if the sum of their values is greater than the value or expression specified.

    scmin <firstrownum> <firstcolnum> <lastrownum> <lastcolnum> <value|expression>

    This command scales a partial row, or a partial column, or a block of cells if the sum of their values is less than the value or expression specified.