The Resector CommandΒΆ

The purpose of these tools is to provide a convenient way to aggregate and disaggregate data from various sectoral levels. The routine begins by reading a file that contains concordances between various sectoral aggregation schemes. The column heading on the first line must specify the number of sectors in that aggregation scheme. This number of sectors is also the “handle” that is used to refer to that column in the resector routines.

Please see the demo section of the Inforum web site for examples of the resector capabilities.

rs create <filename> [<Number_of_Columns> <Maximum_Number_of_Sectors>]

The create function opens the key file and reads in up to 20 columns of aggregation information (6 is the default). An optional argument can be supplied to limit the reading to more or less columns than the default. In principle, the routines handle aggregation or disaggregation between any two of the schemes read from the file. With six aggregation schemes, this results in 36 possible combinations of aggregation.

The beginning of a sample file is displayed below:

575  495  360  432   85  BEA82
  1    1    1    1    1  10100   Dairy farm products
  2    2    2    2    1  10200   poultry and eggs
  3    3    3    3    1  10301   Meat animals
  4    4    3    3    1  10302   Miscellaneous livestock-horses,bees,ho
  5    5    4    4    1  20100   Cotton
  6    6    5    5    1  20201   Food grains: wheat,rye,rice,buckwheat
  7    7    5    6    1  20202   Feed grains: corn,oats,barley,hay,sorg
  8    8    5    6    1  20203   Grass seeds
  9    9    6    7    1  20300   Tobacco
 10   10    7    8    1  20401   Fruits
 11   11    7    8    1  20402   Tree nuts
 12   12    7    9    1  20501   Vegetables
 13   13    7   10    1  20502   Sugar crops
rs formagg <Number_From> <Number_To>]

This is the first function that should be called after creation. It performs the most important initialization tasks. It sets up all of the information that is needed to aggregate from the scheme indicated as <Number_From> to the scheme indicated as <Number_To>. It sets up concordance lists and “split lists” that will be used by other functions listed below. In some programs, you may need to issue this command several times, especially if you need to use some of the “cross-aggregation” techniques described below.

One of the functions of initialization is to set up lists of correspondences between sectors, as well as lists of splits, where one sector from one scheme corresponds to one or more sectors from the other scheme. Since this initialization is time and memory consuming, an explicit function called formagg performs this task, and this function is called for only needed aggregation relationships. formagg takes as its arguments the maximum sector numbers of the source and destination schemes. Until formagg has been called with a certain aggregation pair, no other functions using that pair are allowed.

rs aggvector <Number_From> <Number_To> <Input_Vector> <Output_Vector> <Split_Vector>]
This function is designed to aggregate or split a vector from one aggregation scheme to a vector of another aggregation scheme. <Number_From> should be the number of sectors of the source vector, and <Number_To> should be the number of sectors of the destination vector, as shown in the heading in the key file that was read from the create routine. <Split_Vector> must be of the same aggregation level as the destination vector. It is used by the routine where there is a one-to-many relationship going from source to destination sectors. If you purely are aggregating, the <Split_Vector> will not be used and its values may be set to arbitrary levels.
rs ctrlvec <Number From> <Number_To> <Detailed Vector> <Aggregate_Vector>
This function controls a detailed vector to a more aggregate vector.
rs rdctrlvec <Number_From> <Number_To> <Detailed Vector> <Aggregate_Vector>
This function controls a detailed vector to a more aggregate vector, using right-direction scaling.
rs crossaggvector <Number_From> <Number_To> <Number_In_Between> <Input_Vector> <Output_Vector> <Split_Vector>
Sometimes conversion of a sectoral scheme is more complicated than merely a combination of aggregations and splits. For example, there may exist a many-to-many relationship, where a <SplitVector> of either sectoring level would not provide enough information on how the flows should be allocated. The name “cross-aggregation” indicates the method of translation used by this function, whereby the source vector is split to the level of a more detailed intermediary vector, which then can be aggregated directly to the destination vector. It must be possible to aggregate the intermediate sectoring level both to the source and to the destination levels for this function to work.
In the argument list, <Number_From> is the number of sectors of the source vector, <Number_To> is the number of sectors of the destination vector, and <Number_In_Between> is the number of sectors of the intermediary vector. <Input_Vector> is the source vector and <Output_Vector> is the destination vector. In this function, <Split_Vector> is a vector of length <<Number_In_Between>> that is used to split the source vector.
rs aggmatrows <Number_From> <Number_To> <Input_Matrix> <Output_Matrix>> <Split_Vector>
rs aggmatrows <Number_From> <Number_To> <Input Packed Matrix> <Output Matrix> <Split_Vector>
This function is similar to aggvector but aggregates the <Input_Matrix> by row to obtain the <Output_Matrix>. The routine also will accept a packed matrix as the input, though the <Output_Matrix> must be a full matrix.
rs aggmatrix <Number_Row_From> <Number_Row_To> <Number_Column_From> <Number_Column_To> <Input Matrix> <Output Matrix>
This function aggregates a matrix both by rows and columns. Earlier editions of the routine required both the source and destination matrix to be square, and the same aggregation mapping was applied to both dimensions. The current routine operates on rectangular matrices, and different aggregation mappings may be applied to the rows and columns.
rs ctrlmatrows <Number_From> <Number_To> <Input_Matrix> <Output_Matrix>
rs ctrlmatrows <Number_From> <Number_To> <Input Packed Matrix> <Output Packed Matrix>
This function controls a more detailed matrix to an aggregate matrix.
rs ctrlmat <Number_From> <Number_To> <Input_Matrix> <Output_Matrix>
rs ctrlmat <Number_From> <Number_To> <Input Packed Matrix> <Output Packed Matrix>
This function controls all cells within a block of the more detailed matrix to a single cell of the less detailed matrix. The function handles all of the different cases: single cell to single cell, row vector to single cell, column vector to single cell, and sub-block to single cell. The function is useful for updating a more detailed matrix such as a benchmark IO table to a more aggregate (and more current) matrix.
rs crossaggmatrows <Number_From> <Number_To> <Number In Between> <Input_Matrix> <Output_Matrix> <Split_Vector>
This function works much like crossaggvector but aggregates rows of a matrix.

Previous topic

Groups of Sector Numbers

Next topic

Linear Interpolation of Vectors and Matrices

This Page