The SPATIALREG Procedure

Example 31.2 Models with Spatial ID Matching

Data Description and Objective

(View the complete code for this example.)

Two simulated data sets, SIMDATA and SIMW, are used to illustrate models with spatial ID matching in PROC SPATIALREG.

The SIMDATA data set contains 50 observations and five variables. The variable SID identifies each spatial unit in the data. Three explanatory variables are x1, x2, and x3. The dependent variable is y. The SIMW data set defines the spatial contiguity for all 50 spatial units. The first column, SID, in the SIMW data set identifies each spatial unit. The remaining entries in the SIMW data set are binary and define whether two spatial units are neighbors. A value of 1 indicates that two spatial units are neighbors, and 0 indicates otherwise.

Summary statistics for all variables except SID in the SIMDATA data set are computed by the following statements and presented in Output 31.2.1:

proc means data=simdata;
   var x1 x2 x3 y;
run;

Output 31.2.1: Summary Statistics

The MEANS Procedure

VariableNMeanStd DevMinimumMaximum
x1
x2
x3
y
50
50
50
50
-0.0076329
-0.0829941
-0.0894387
1.1569199
1.0989504
0.9671181
0.9975304
1.5687060
-2.4523193
-2.5725767
-2.4470049
-1.9399423
1.6539456
2.4034547
2.6720533
4.7136835


Because the SIMDATA and SIMW data sets are ordered differently in terms of the values of SID, the SPATIALID statement is needed to match observations in SIMDATA and SIMW. The following statements fit a SAR model to the data by using three regressors, x1, x2, and x3:

proc spatialreg data=simdata Wmat=simw;
  model y=x1-x3 / type=SAR;
  spatialid SID;
run;

The parameter estimates for this model are shown in Output 31.2.2.

Output 31.2.2: Parameter Estimates of SAR Model

The SPATIALREG Procedure
 
Model: MODEL 1
Dependent Variable: y

Parameter Estimates
ParameterDFEstimateStandard
Error
t ValueApprox
Pr > |t|
Intercept11.7806500.09870318.04<.0001
x110.5733290.04739512.10<.0001
x210.7070480.05718112.37<.0001
x31-0.9028430.053314-16.93<.0001
_rho1-0.4737130.063008-7.52<.0001
_sigma210.1315090.0263504.99<.0001


To fit an SDM model that includes exogenous interaction effects of x1, x2, and x3, submit the following statements:

proc spatialreg data=simdata Wmat=simw;
  model y=x1-x3/ type=SAR;
  spatialeffects x1-x3;
  spatialid SID;
run;

The parameter estimates for this model are shown in Output 31.2.3.

Output 31.2.3: Parameter Estimates of SDM Model

The SPATIALREG Procedure
 
Model: MODEL 1
Dependent Variable: y

Parameter Estimates
ParameterDFEstimateStandard
Error
t ValueApprox
Pr > |t|
Intercept11.9325750.1988829.72<.0001
x110.5485050.04980611.01<.0001
x210.6860120.05626612.19<.0001
x31-0.8901620.053516-16.63<.0001
W_x110.1723000.1540181.120.2633
W_x210.0237440.1985570.120.9048
W_x31-0.3248060.228032-1.420.1543
_rho1-0.6397550.164652-3.890.0001
_sigma210.1205270.0247294.87<.0001


If you want to fit another type of model, you need to change the TYPE= option. As an example, if you want to fit an SEM model instead of a SAR model to the data, you can use the following statements:

proc spatialreg data=simdata Wmat=simw;
  model y=x1-x3 / type=SEM;
  spatialid SID;
run;

The parameter estimates for this model are shown in Output 31.2.4.

Output 31.2.4: Parameter Estimates of SEM Model

The SPATIALREG Procedure
 
Model: MODEL 1
Dependent Variable: y

Parameter Estimates
ParameterDFEstimateStandard
Error
t ValueApprox
Pr > |t|
Intercept11.1662890.02951439.52<.0001
x110.4879750.0490869.94<.0001
x210.6344420.06177610.27<.0001
x31-0.8312500.054780-15.17<.0001
_lambda1-0.9648260.132514-7.28<.0001
_sigma210.1474340.0313184.71<.0001


Last updated: December 20, 2021