COUNTREG Procedure

Spatial Lag of X Model

The spatial lag of X (SLX) model is illustrated by using the general framework for a zero-inflated model. According to the section Zero-Inflated Count Regression Overview, the data model for y Subscript i can be formulated as

y Subscript i Baseline tilde StartLayout Enlarged left-brace 1st Row 1st Column 0 2nd Column phi Subscript i Baseline 2nd Row 1st Column g left-parenthesis y Subscript i Baseline right-parenthesis 2nd Column 1 minus phi Subscript i EndLayout

and the general model for parameters can be written in matrix form as

StartLayout 1st Row 1st Column bold-italic lamda 2nd Column equals 3rd Column exp left-parenthesis bold upper X bold-italic beta right-parenthesis 2nd Row 1st Column bold-italic phi 2nd Column equals 3rd Column upper F left-parenthesis bold upper Z bold-italic gamma right-parenthesis 3rd Row 1st Column bold-italic nu 2nd Column equals 3rd Column minus exp left-parenthesis bold upper G bold-italic delta right-parenthesis EndLayout

where bold-italic phi equals left-parenthesis phi 1 comma ellipsis comma phi Subscript n Baseline right-parenthesis prime, bold-italic lamda equals left-parenthesis lamda 1 comma ellipsis comma lamda Subscript n Baseline right-parenthesis prime, and bold-italic nu equals left-parenthesis nu 1 comma ellipsis comma nu Subscript n Baseline right-parenthesis prime. In addition, bold upper Z 1, bold upper X 1, and bold upper G 1 are design matrices, in which the ith row is bold z prime Subscript i, bold x prime Subscript i, and bold g prime Subscript i for i equals 1 comma 2 comma ellipsis comma n, respectively.

In the spatial context, data are often collected over a predetermined set of spatial units, bold s 1 comma bold s 2 comma ellipsis comma bold s Subscript n Baseline. In this case, both the dependent variable and the explanatory variables are spatially referenced. For example, y Subscript i Baseline equals y left-parenthesis bold s Subscript i Baseline right-parenthesis denotes the dependent variable that is observed at location bold s Subscript i. For the SLX model, the data model for y Subscript i remains the same. However, the parameter model becomes

StartLayout 1st Row 1st Column bold-italic lamda 2nd Column equals 3rd Column exp left-parenthesis bold upper X 1 bold-italic beta 1 plus bold upper W bold upper X 2 bold-italic beta 2 right-parenthesis equals exp left-parenthesis bold upper X bold-italic beta right-parenthesis 2nd Row 1st Column bold-italic phi 2nd Column equals 3rd Column upper F left-parenthesis bold upper Z 1 bold-italic gamma 1 plus bold upper W bold upper Z 2 bold-italic gamma 2 right-parenthesis equals upper F left-parenthesis bold upper Z bold-italic gamma right-parenthesis 3rd Row 1st Column bold-italic nu 2nd Column equals 3rd Column minus exp left-parenthesis bold upper G 1 bold-italic delta 1 plus bold upper W bold upper G 2 bold-italic delta 2 right-parenthesis equals minus exp left-parenthesis bold upper G bold-italic delta right-parenthesis EndLayout

where bold upper W is the spatial weights matrix, bold upper X equals left-bracket bold upper X 1 bold upper W bold upper X 2 right-bracket, bold upper Z equals left-bracket bold upper Z 1 bold upper W bold upper Z 2 right-bracket, and bold upper G equals left-bracket bold upper G 1 bold upper W bold upper G 2 right-bracket. Moreover, bold-italic beta becomes a column vector by stacking bold-italic beta 1 on top of bold-italic beta 2, and similarly for bold-italic gamma and bold-italic delta. For the sake of flexibility, bold upper X 2 does not have to be the same as bold upper X 1. Similar arguments apply to the DISPMODEL and ZEROMODEL statements. From the modeling perspective, the SLX model can be useful when spatial effects (as represented by the bold upper W bold upper X 2, bold upper W bold upper Z 2, and bold upper W bold upper G 2 terms) are important. The intercept term is always excluded from the design matrix bold upper X 2, bold upper Z 2, or bold upper G 2.

A spatial weights matrix bold upper W is a square matrix, which often has nonnegative entries and its dimension is the total number of unique spatial units. Moreover, the diagonal elements of bold upper W are zeros because a spatial unit is not considered to be its own neighbor. Furthermore, the spatial weight w Subscript i j between locations bold s Subscript i and bold s Subscript j describes how much influence the spatial unit bold s Subscript j has on bold s Subscript i. In practice, bold upper W is often row-normalized; thus bold upper W x 1 can be interpreted as the spatially weighted average of x 1.

In the SLX model, missing spatial weights are not allowed unless the NORMALIZE option is specified, in which case missing spatial weights are replaced by zeros. In addition, missing values are not allowed for the variables (including both dependent and explanatory variables) in the primary data set (which is specified in the DATA= option in the PROC COUNTREG statement).

The SPATIALEFFECTS, SPATIALZEROEFFECTS, and SPATIALDISPEFFECTS statements are used to include spatial effects in design matrices bold upper X 2, bold upper Z 2, and bold upper G 2, respectively. Observations in the primary data set (specified in the DATA= option in the PROC COUNTREG statement) can be presented in different orders of spatial units than they are presented in the spatial weights data set (specified in the WMAT= option in the PROC COUNTREG statement). In this case, the SPATIALID statement enables you to use a spatial ID variable to associate the observations in the primary data set with those in the spatial weights data set. The SLX model is not supported for a panel data model.

Last updated: June 19, 2025