The SPATIALREG Procedure
Example 31.1 Columbus Crime Data
- Data Description and Objective
- Spatial Autoregressive (SAR) Model
- Spatial Durbin Model (SDM)
- Spatial Error Model (SEM)
- Spatial Durbin Error Model (SDEM)
- Spatial Moving Average (SMA) Model
- Spatial Durbin Moving Average (SDMA) Model
- Spatial Autoregressive Confused (SAC) Model
- Spatial Durbin Autoregressive Confused (SDAC) Model
- Spatial Autoregressive Moving Average (SARMA) Model
- Spatial Durbin Autoregressive Moving Average (SDARMA) Model
- Linear Regression Model
- Spatial Lag of X Model
Data Description and Objective
(View the complete code for this example.)
The data set CRIMEOH contains data from Columbus, Ohio, about the number of crimes (including residential burglaries and vehicle thefts) and possible determinants of crime. This data set is taken from Anselin (1988) and can be found in the SAS/ETS Sample Library.
The variable CRIME represents the number of crimes in 49 neighborhoods of Columbus, Ohio. Additional variables in the data set that you want to evaluate as determinants of crimes include INCOME (household income by $1000) and HVALUE (housing value by $1000). Summary statistics for these variables are computed by the following statements and presented in Output 31.1.1:
proc means data=crimeoh; var crime income hvalue; run;
Output 31.1.1: Summary Statistics
The spatial relationships among the 49 neighborhoods are summarized using the first-order neighbor contiguity matrix, contained in the CRIMEWMAT data set. This data set is also taken from Anselin (1988) and can be found in the SAS/ETS Sample Library.
Spatial Autoregressive (SAR) Model
The following statements fit a SAR model to the data by using the regressors INCOME and HVALUE:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SAR; run;
In this example, the TYPE=SAR option in the MODEL statement specifies a SAR model. The NONORMALIZE option indicates that the spatial weights data set CRIMEWMAT should be used "as is" rather than be row-standardized. The parameter estimates for this model are shown in Output 31.1.2. According to the results, the spatial autoregressive coefficient is positive and significant at the 0.05 level. This indicates that there is a positive spatial dependence in the data.
Output 31.1.2: Parameter Estimates of SAR Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 45.077070 | 7.870590 | 5.73 | <.0001 |
| income | 1 | -1.031531 | 0.328403 | -3.14 | 0.0017 |
| hvalue | 1 | -0.265924 | 0.088218 | -3.01 | 0.0026 |
| _rho | 1 | 0.431020 | 0.123594 | 3.49 | 0.0005 |
| _sigma2 | 1 | 95.487066 | 19.506312 | 4.90 | <.0001 |
Spatial Durbin Model (SDM)
To fit an SDM model, you specify the SPATIALEFFECTS statement together with the TYPE=SAR option. In this example, the spatial lags of the regressors INCOME and HVALUE are considered in the SDM model.
The following statements fit an SDM model to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SAR; spatialeffects income hvalue; run;
The parameter estimates are given in Output 31.1.3. As in the SAR model, the spatial autoregressive coefficient in the SDM model is positive and significant at the 0.05 level, indicating a positive spatial dependence in the data.
Output 31.1.3: Parameter Estimates of SDM Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 42.803457 | 13.924487 | 3.07 | 0.0021 |
| income | 1 | -0.914206 | 0.336439 | -2.72 | 0.0066 |
| hvalue | 1 | -0.293745 | 0.088857 | -3.31 | 0.0009 |
| W_income | 1 | -0.519640 | 0.594772 | -0.87 | 0.3823 |
| W_hvalue | 1 | 0.245716 | 0.176854 | 1.39 | 0.1647 |
| _rho | 1 | 0.426492 | 0.167492 | 2.55 | 0.0109 |
| _sigma2 | 1 | 91.779519 | 18.909222 | 4.85 | <.0001 |
In order to avoid potential collinearity with the intercept term in the MODEL statement, the SPATIALEFFECTS statement always excludes the intercept term. This means that only the explicitly specified variables in the SPATIALEFFECTS statement are used to construct spatial lag of covariate effects.
Spatial Error Model (SEM)
To fit an SEM model, use the TYPE=SEM option.
The following statements fit an SEM model to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SEM; run;
The parameter estimates are shown in Output 31.1.4. According to this output, the p-value for the spatial autoregressive parameter is 0.0002. The results indicate that there is a significant positive dependence in the error term.
Output 31.1.4: Parameter Estimates of SEM Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 59.891907 | 5.884103 | 10.18 | <.0001 |
| income | 1 | -0.941301 | 0.370267 | -2.54 | 0.0110 |
| hvalue | 1 | -0.302253 | 0.090552 | -3.34 | 0.0008 |
| _lambda | 1 | 0.561781 | 0.152413 | 3.69 | 0.0002 |
| _sigma2 | 1 | 95.572081 | 20.037403 | 4.77 | <.0001 |
Spatial Durbin Error Model (SDEM)
To fit an SDEM model, use the SPATIALEFFECTS statement together with the TYPE=SEM option. In this example, the spatial lags of the regressors INCOME and HVALUE are considered in the SDEM model.
The following statements fit an SDEM model to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SEM; spatialeffects income hvalue; run;
The parameter estimates are shown in Output 31.1.5.
Output 31.1.5: Parameter Estimates of SDEM Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 73.540584 | 8.860968 | 8.30 | <.0001 |
| income | 1 | -1.051699 | 0.322436 | -3.26 | 0.0011 |
| hvalue | 1 | -0.275607 | 0.091154 | -3.02 | 0.0025 |
| W_income | 1 | -1.156553 | 0.592915 | -1.95 | 0.0511 |
| W_hvalue | 1 | 0.111754 | 0.202366 | 0.55 | 0.5808 |
| _lambda | 1 | 0.425397 | 0.173831 | 2.45 | 0.0144 |
| _sigma2 | 1 | 92.533614 | 19.090022 | 4.85 | <.0001 |
Spatial Moving Average (SMA) Model
To fit an SMA model, use the TYPE=SMA option.
The following statements fit an SMA model to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SMA; run;
The parameter estimates are shown in Output 31.1.6.
Output 31.1.6: Parameter Estimates of SMA Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 59.252971 | 5.934861 | 9.98 | <.0001 |
| income | 1 | -0.921806 | 0.363482 | -2.54 | 0.0112 |
| hvalue | 1 | -0.287393 | 0.086880 | -3.31 | 0.0009 |
| _lambda | 1 | -0.799089 | 0.277861 | -2.88 | 0.0040 |
| _sigma2 | 1 | 117.731990 | 26.373322 | 4.46 | <.0001 |
Spatial Durbin Moving Average (SDMA) Model
To fit an SDMA model, use the SPATIALEFFECTS statement together with the TYPE=SMA option. In this example, the spatial lags of the regressors INCOME and HVALUE are considered in the SDMA model.
The following statements fit an SDMA model to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SMA; spatialeffects income hvalue; run;
Partial output is shown in Output 31.1.7.
Output 31.1.7: Parameter Estimates of SDMA Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 73.944211 | 9.083977 | 8.14 | <.0001 |
| income | 1 | -1.065635 | 0.312045 | -3.42 | 0.0006 |
| hvalue | 1 | -0.266840 | 0.092400 | -2.89 | 0.0039 |
| W_income | 1 | -1.074757 | 0.584955 | -1.84 | 0.0662 |
| W_hvalue | 1 | 0.067568 | 0.209867 | 0.32 | 0.7475 |
| _lambda | 1 | -0.642124 | 0.296638 | -2.16 | 0.0304 |
| _sigma2 | 1 | 103.502516 | 22.487027 | 4.60 | <.0001 |
Spatial Autoregressive Confused (SAC) Model
To fit an SAC model, use the TYPE=SAC option.
The following statements fit the SAC model to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SAC; run;
The parameter estimates are shown in Output 31.1.8.
Output 31.1.8: Parameter Estimates of SAC Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 47.778937 | 9.278438 | 5.15 | <.0001 |
| income | 1 | -1.025840 | 0.334006 | -3.07 | 0.0021 |
| hvalue | 1 | -0.281636 | 0.093366 | -3.02 | 0.0026 |
| _rho | 1 | 0.368143 | 0.181118 | 2.03 | 0.0421 |
| _lambda | 1 | 0.166526 | 0.298115 | 0.56 | 0.5764 |
| _sigma2 | 1 | 95.597117 | 19.474269 | 4.91 | <.0001 |
Spatial Durbin Autoregressive Confused (SDAC) Model
To fit an SDAC model, use the SPATIALEFFECTS statement together with the TYPE=SAC option. In this example, the spatial lags of the regressors INCOME and HVALUE are considered in the SDAC model.
The following statements fit an SDAC model to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SAC; spatialeffects income hvalue; run;
The parameter estimates are shown in Output 31.1.9.
Output 31.1.9: Parameter Estimates of SDAC Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 50.827256 | 31.089621 | 1.63 | 0.1021 |
| income | 1 | -0.950352 | 0.353961 | -2.68 | 0.0073 |
| hvalue | 1 | -0.286559 | 0.091261 | -3.14 | 0.0017 |
| W_income | 1 | -0.690471 | 0.839980 | -0.82 | 0.4111 |
| W_hvalue | 1 | 0.208936 | 0.222585 | 0.94 | 0.3479 |
| _rho | 1 | 0.316760 | 0.414771 | 0.76 | 0.4450 |
| _lambda | 1 | 0.152884 | 0.475512 | 0.32 | 0.7478 |
| _sigma2 | 1 | 93.133958 | 19.187743 | 4.85 | <.0001 |
Spatial Autoregressive Moving Average (SARMA) Model
To fit a SARMA model, use the TYPE=SARMA option.
The following statements fit a SARMA model to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SARMA; run;
The parameter estimates are shown in Output 31.1.10.
Output 31.1.10: Parameter Estimates of SARMA Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 48.973247 | 9.602039 | 5.10 | <.0001 |
| income | 1 | -1.016359 | 0.337215 | -3.01 | 0.0026 |
| hvalue | 1 | -0.287458 | 0.093079 | -3.09 | 0.0020 |
| _rho | 1 | 0.336281 | 0.204317 | 1.65 | 0.0998 |
| _lambda | 1 | -0.271945 | 0.426840 | -0.64 | 0.5241 |
| _sigma2 | 1 | 97.992936 | 21.253768 | 4.61 | <.0001 |
Spatial Durbin Autoregressive Moving Average (SDARMA) Model
To fit an SDARMA model, use the SPATIALEFFECTS statement together with the TYPE=SARMA option. In this example, the spatial lags of the regressors INCOME and HVALUE are considered in the SDARMA model.
The following statements fit an SDARMA model without an intercept term to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=SARMA noint; spatialeffects income hvalue; run;
The parameter estimates are shown in Output 31.1.11.
Output 31.1.11: Parameter Estimates of SDARMA Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| income | 1 | -0.792292 | 0.379696 | -2.09 | 0.0369 |
| hvalue | 1 | -0.328521 | 0.095588 | -3.44 | 0.0006 |
| W_income | 1 | 0.587122 | 0.457090 | 1.28 | 0.1990 |
| W_hvalue | 1 | 0.438500 | 0.136144 | 3.22 | 0.0013 |
| _rho | 1 | 0.957745 | 0.041913 | 22.85 | <.0001 |
| _lambda | 1 | 0.691307 | 0.260974 | 2.65 | 0.0081 |
| _sigma2 | 1 | 86.990404 | 19.034142 | 4.57 | <.0001 |
Linear Regression Model
To fit a linear model, use the TYPE=LINEAR option.
The following statements fit a linear model to the CRIMEOH data:
proc spatialreg data=crimeoh; model crime=income hvalue / type=LINEAR; run;
Partial output is shown in Output 31.1.12.
Output 31.1.12: Parameter Estimates of Linear Model
Spatial Lag of X Model
To fit an SLX model, use the SPATIALEFFECTS statement together with the TYPE=LINEAR option. In this example, the spatial lags of the regressors INCOME and HVALUE are considered in the linear model.
The following statements fit an SLX model to the CRIMEOH data:
proc spatialreg data=crimeoh Wmat=crimeWmat NONORMALIZE; model crime=income hvalue / type=LINEAR; spatialeffects income hvalue; run;
The parameter estimates are shown in Output 31.1.13.
Output 31.1.13: Parameter Estimates of SLX Model
| Parameter Estimates | |||||
|---|---|---|---|---|---|
| Parameter | DF | Estimate | Standard Error | t Value | Approx Pr > |t| |
| Intercept | 1 | 75.028184 | 6.279950 | 11.95 | <.0001 |
| income | 1 | -1.109020 | 0.354232 | -3.13 | 0.0017 |
| hvalue | 1 | -0.289734 | 0.096058 | -3.02 | 0.0026 |
| W_income | 1 | -1.370866 | 0.531889 | -2.58 | 0.0100 |
| W_hvalue | 1 | 0.191785 | 0.189841 | 1.01 | 0.3124 |
| _sigma2 | 1 | 107.292373 | 21.676329 | 4.95 | <.0001 |