Scaling is used to force the elements of a set of numbers to add to a given control total. Desirable properties for any scaling algorithm are that:

- the components of the set to be scaled should preserve their original rank ordering,
- all elements of the set should be scaled in the same direction, and
- the elements should be changed in proportion to their absolute value, which represents their weight or relative importance.

Furthermore, these characteristics should hold when the elements of the set to be scaled contain both positive and negative numbers and when the control total for the sum of the elements is zero.

The three following methods of scaling are used in various *G7* commands:

Ordinary Scaling

Ordinary scaling uses a multiplicative scale factor

*s*that is the control total*c*divided by the sum of the elements in the set, as follows:so that the scaled value of each element of the set equals:

When all of the elements of the set and the control total are greater than zero, or when all of the elements of the set and the control total are less than zero, then all of the desirable properties hold true.

However, when the set contains both positive and negative numbers, the positive and negative elements will move in opposite directions with the above procedure and so the second desirable property listed above will not hold. For example, if the control total is greater than the sum of the elements in the set, the scale factor is greater than one. Thus, the scaled values of all elements greater than zero will be larger than their original values, but the scaled values of all negative elements in the set will be less that their original values. Similarly, if the control total is less than the sum of the elements in the set, the scale factor is less than one; positive original values will be made smaller while negative original values will be made larger.

Even worse, when all of the elements are positive and the control total is negative (or vice versa), the rank order of the elements is reversed. In this case, property (a) fails to hold.

This ordinary method of scaling is used in the

*ctrl*command and the standard RAS routine.Proportional Scaling

Proportional scaling uses a set of additive scaling terms,

*a*, as follows:where is the difference between the desired total and the actual sum – or the total amount to be allocated – and is the share to be allocated to the ith element of the set. Thus, the scaled value of each element of the set equals:

Note that unlike the ordinary scaling factor (which is the same for each member of the set), the proportional scale term is different for each element.

The proportional scaling algorithm will scale any set of real numbers to any real control total, but the desirable characteristics for a scaling algorithm do not hold for all possible values of the control total. If , both positive and negative elements in the set retain their sign and their rank order is unchanged. If the control total lies outside this range, the following tabulation gives the results of proportional scaling for various conditions:

- If , the negative elements in the set become positive and their rank order is changed.
- If , the negative elements in the set become zero and their rank order is changed.
- If , the positive elements in the set become zero and their rank order is changed.
- If , the positive elements in the set become negative and their rank order in changed.

Note that the proportional scaling algorithm will show an error message if one of these conditions is true.

This method of scaling is used in the

*scale*command, the*ctrl*command, the ordinary RAS routine, and the gross value RAS routine.Right-Direction Scaling

Right-direction scaling is a second method of scaling that preserves the relative ordering of the elements and scales them all in the same direction. Assume that A is the sum of all positive elements of the vector X, B is the sum of all negative elements, and C is the control total.

The problem is formulated to find the number

*S*for which the following equation is true:This can be rewritten as a quadratic equation in

*S*:To solve for

*S*, we use the general quadratic formula to obtain:Note that positive and negative elements of the set are scaled by different values; the positive elements are multiplied by

*S*, and negative element are divided by*S*.This method of scaling may be used in the

*scale*command and in the ordinary RAS command.