Home > Department of Geography and Environment > Who's who > profiles > Eric Neumayer > spmon - Stata ado-file: create spatial effect variable for monadic data

spmon - Stata ado-file: create spatial effect variable for monadic data

Eric Neumayer, LSE, Department of Geography and Environment

Thomas Plümper, Vienna University of Economics, Department of Socioeconomics

Syntax:

spmon lagvar [if] [in], weightvar(varname) i(varname) k(varname) [options]

options description:

time(varname)   contains the numeric time variable

reverse_W revert the direction of weight variable

norowst spatial effect variable not row-standardized

sename(name) name to be given to created spatial effect variable

labelname(name) name of label given to spatial effect variable

filename(name) name of file to which spatial effect variable saved

Description:

spmon generates a spatial effect variable for analysis of spatial dependence in monadic data, i.e. where the estimation dataset consists of individual units (as in the vast majority of datasets used in the social sciences), rather than of dyads (pairs of units). It can create spatial effect variables for spatial lag, spatial-x and spatial error models. See Neumayer and Plümper (2010) for a discussion of the difference between monadic and dyadic data. See Plümper and Neumayer (2010, 2016) for a discussion of model specification in the analysis of spatial dependence.

Background information:

For the generation of spatial effect variables for monadic data, one needs two separate datasets: a dyadic one used for the creation of the spatial effect variable, another one that is the actual monadic estimation dataset, into which the spatial lag variable created from the other dataset needs to be merged. A dyadic dataset consists of observations in which two units form a pair (the dyad). This dataset must contain at least four variables. One variable must identify the unit i, while a second variable identifies the unit k. Third, a variable to be spatially lagged (e.g., the dependent variable of unit k in spatial lag models). This variable must be the same for all dyads of a specific unit k with various combinations of unit i (for any given time period). Fourth, a weighting or connectivity variable that connects unit i with units k. This variable will typically be different for each dyad of a specific unit i with various combinations of units k. It may or may not be directed. If it is directed, then the dyad ik is different from the the dyad ki and the reverse_W option can be invoked. If the spatial effect variable is to be time-variant, then one additionally needs a fifth variable that identifies time.

Arguments:

lagvar is the variable to be spatially lagged. It is the dependent variable of unit k in spatial lag models, a selected independent variable of unit k in spatial-x models and a saved regression residual in spatial error models. It must be the same for all dyads of a specific unit k with all combinations of unit i (for any given time period).

weightvar(varname) is the weighting or connectivity variable. It connects unit i with unit k.

i(varname) is the identifying variable of unit i. It can be a numeric or string variable.

k(varname) is the identifying variable of unit k. It can be a numeric or string variable.

Options:

timevar is an optional argument. If users wish to generate a time-varying spatial effect variable, then the numeric time variable must be stated here.

reverse_W requests that the direction of the connectivity variable is to be reversed. This only matters if the weighting variable W is a directed variable. In the default option, W represents connectivity from unit i to other units k. reverse_W requests that the direction of the weighting matrix is to be reversed, such that a virtually transformed W instead represents connectivity from other units k to unit i.

norowst requests that the generated spatial effect variable is not row-standardized. See Plümper and Neumayer (2010, 2016) for an explanation and discussion of row-standardization. Row-standardization is the default option.

sename(name) names the generated spatial effect variable. In the default option, if the weighting matrix is row-standardized, then the generated spatial effect variable is called SE_var_monadic_rowst. If the weighting matrix is not row-standardized, then the spatial effect variable is called SE_var_monadic_norowst. Any previously existing variable with the same name will be replaced.

labelname(name) names the label of the generated spatial effect variable. The default label given is "Undirected dyad contagion spatial effect variable". 

filename(name) requests that a dataset containing the generated spatial effect variable is saved in the current working directory under the defined name. In the default option, if the weighting matrix is row-standardized, then a file is saved in the current working directory called SE_file_monadic_rowst. If the weighting matrix is not row-standardized, then the saved file is called SE_file_monadic_norowst. Any previously existing file with the same name will be replaced.

Examples:

spmon y, w(contiguity) i(country_i) k(country_k) sename(se_monadic)
        filename(se_monadic_file)

 spmon y, w(exports) i(country_i) k(country_k) time(year) revert_W norowst

spmon y, w(exports) i(country_i) k(country_k) time(year) norowst

Example data-, do- and log-files:

(Data) (Do-file) (Log-file

Installation:

Type "ssc install spmon" in Stata and follow instructions or download the ado- and help-file below into the relevant folder:

spmon.ado 

spmon.hlp

Questions and Errors:

Send any questions and report any errors to e.neumayer@lse.ac.uk.

References:

Neumayer, Eric and Plümper, Thomas. 2010. Spatial Effects in Dyadic Data, International Organization, 64 (1) pp. 145-165 (pdf)

Plümper, Thomas and Eric Neumayer. 2010. Model Specification in the Analysis of Spatial Dependence, European Journal of Political Research 49 (3), pp. 418-442  (pdf)

Neumayer, Eric and Thomas Plümper. 2016. W. Political Science Research and Methods, 4 (1), pp. 175-193 (pdf)

Share:Facebook|Twitter|LinkedIn|