空间计量--空间联立方程模型Stata操作及应用
一、命令语法格式
对于空间联立方程可以使用这样的一个命令,spregcs,另外由于这是一个外部命令,因此需要进行下载安装,查看外部命令的下载、安装与使用以及ADO/PLUS文件夹分享
spregcs语法格式为:
*空间联立方程模型help spregcsspregcs: Spatial Cross Sections Econometric Regression Models: (SAR - SEM - SDM - SAC - mSTAR - GWR - GS2SLS - GS2SLSAR - GS3SLS - GS3SLSAR - IVTOBIT - SARARGS - SARARIV - SARARML - SPGMM - OLS - LAG - DURBIN)clear allsysuse spregcs.dta, clearspregcs y x1 x2 , model(ols) run(ols)spregcs y x1 x2 , model(ols) run(ols) dn lmsp wmfile(SPWcs)spregcs y x1 x2 , wmfile(SPWcs) model(sar) mfx(lin)spregcs y x1 x2 , wmfile(SPWcs) model(sar) mfx(lin) stand tests
因为空间联立后面选项比较多,分为不同模型选项,因此选择如下选项为大家讲解
* (20) Generalized Spatial 3SLS - (G32SLS)* Y1 = Y2 X1 X2* Y2 = Y1 X3 X4* (20-1) Generalized Spatial 3SLS - AR(1) (GS3SLS)spregcs y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3sls) eq(1) mfx(lin) order(1)* (20-2) Generalized Spatial 3SLS - AR(2) (GS3SLS)spregcs y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3sls) eq(1) mfx(lin) order(2)* (20-3) Generalized Spatial 3SLS - AR(3) (GS3SLS)spregcs y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3sls) eq(1) mfx(lin) order(3)* (20-4) Generalized Spatial 3SLS - AR(4) (GS3SLS)spregcs y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3sls) eq(1) mfx(lin) order(4)
选项含义为:
y1为联立方程中第一个方程的被解释变量
x1和x2为解释变量
var2中,y2为方程中第二个方程的被解释变量,x3,x4为解释变量
order表示选择的滞后阶数, model表示选择估计的方法为GS3SLS或GS3 SLSAR(广义空间自回归)
二、空间联立操作应用
以该命令自带的数据为例,进行操作。
*6、查看第2个方程估计结果
spregcs y1 x1 x2 , var2(y2 x3 x4) wmfile(SPWcs) model(gs3slsar) eq(2) mfx(lin) order(1)
完整代码为:
. *-------------------------------------------------------------------------------------. *计量经济学服务中心空间计量. *-------------------------------------------------------------------------------------. . *下面采用 sprees自带数据进行空间联立方程模型的估计. . *1、定义工作路径. cd C:\ado\plus\sC:\ado\plus\s. . *2、清除. clear all. . *3、导入数据. sysuse spregcs.dta, clear. . *4、编辑查看数据. ed. descContains data from ./spregcs.dta obs: 49