Title

aggind -- aggregate indicators among units within a specified radius

Syntax

aggind id_unit varlist using filename, metr() rad() [sum crcl]

required options
metr() metric of proximity

rad() radius of aggregation

additional options
sum aggregate indicators as sum (default: average)

crcl exclude the origin from the aggregation

Description

For every regional unit in the data aggind aggregates metric indicators among neighbouring regional units that are located within a specified radius.
The operation requires a distance matrix, addressed with filename. Distance matrix has to be in .dta format.

Distance matrix contains the information about the proximity of the regional units to each other. The three columns of the distance matrix contain the id of the origin unit,
the id of the target unit, and the distance between the two units. To obtain meaningful results it is important that the distance matrix is

a) complete, meaning that it contains all pairs of regional units,

b) the distance between one unit and itself is specified as zero,

c) variables are in the following order: id of the origin unit, id of the target unit, distance.

The distance can be physical distance, travelling time etc. Non-spatial proximity definitions can also be used.

IDs in the master dataset (id_unit) and id_origin as well as id_target in the distance matrix dataset have to follow the same classification system
though identical naming is not required.

Id_unit is allowed to repeat in the master data, for example if individual-level data is used where cases are clustered within regional units.

To run the command the options metr() and rad() have to be specified;

metr() specifies the mode of how the proximity between the units is measured. There is a selection between metr(dist) and metr(kn):

metr(dist) uses continuous distances to aggregate indicators within a distance radius,

metr(kn) identifies the k-nearest neighbours and aggregates the indicators among specified k-nearest units.

rad() specifies the radius within which indicators are aggregated:

If metr(dist) is used the radius has to be specified in the metric of the distance variable in the distance matrix,

If metr(kn) is used rad() has to contain the number of the k-nearest units of interest.

The command aggregates indicators as average among neighbouring units. Option sum will additionally add aggregated
sums of the indicators among neighbouring units.

Option crcl will additionally add indicators aggregated as average among neigbouring units with the deduction of the starting unit.

After the run the data will be sorted by id_unit.

Example

aggind id_unit VAR1 using matrix.dta, metr(dist) rad(6500)

master data + distance matrix --> output data

id_unit VAR1 VAR2 id_origin id_target distance id_unit VAR1 VAR2 VAR1_6500_mean

1 3 4 1 1 0 1 3 4 4.67
2 4 2 1 2 5000 2 4 2 3.5
3 7 1 1 3 6500 3 7 1 3.33

2 1 5000
2 2 0
2 3 7500

3 1 6500
3 2 7500
3 3 0

Note

The simple aggregating average proportions neglects different sizes or weights of the units. For this reason work with absolute numbers or use weighted values.

Author

Andreas Hartung 2017, Department of Sociology, University of Tuebingen