赞
踩
空间自回归(空间滞后)模型形式:
y
i
t
=
ρ
∑
j
=
1
N
w
i
j
y
j
t
+
x
i
t
′
β
+
μ
i
+
ε
i
t
,
i
=
1
,
2
,
⋯
,
N
,
t
=
1
,
2
,
⋯
,
T
y_{i t}=\rho \sum_{j=1}^{N} w_{i j} y_{j t}+\boldsymbol{x}_{i t}^{\prime} \boldsymbol{\beta}+\mu_{i}+\varepsilon_{i t}, \quad i=1,2, \cdots, N, t=1,2, \cdots, T
yit=ρj=1∑Nwijyjt+xit′β+μi+εit,i=1,2,⋯,N,t=1,2,⋯,T
其中
y
y
y是因变量,
x
x
x是自变量,
w
w
w是空间权重矩阵元素,
ρ
\rho
ρ是空间自回归系数,
μ
\mu
μ是个体固定效应,
ε
\varepsilon
ε是随机扰动项,
i
i
i是截面个体,
t
t
t
时间。可以用Stata中xsmle命令进行估计。数据集是线上数据,由于是国外网站,下载特别慢,出现卡顿建议关掉重试,多试几次就可以了。下载后建议保存。
*use http://www.econometrics.it/stata/data/xsmle/product.dta, clear
*spmat use usaww using http://www.econometrics.it/stata/data/xsmle/usaww.spmat
use product.dta, clear
xtdescribe
des
spmat use usaww using usaww.spmat
gen lngsp = log(gsp)
gen lnpcap = log(pcap)
gen lnpc = log(pc)
gen lnemp = log(emp)
结果如下:
Contains data from product.dta Observations: 816 Variables: 10 13 Nov 2021 18:07 -------------------------------------------------------------------------------------- Variable Storage Display Value name type format label Variable label -------------------------------------------------------------------------------------- state long %14.0g pid year int %8.0g pcap float %9.0g hwy float %9.0g water float %9.0g util float %9.0g pc float %9.0g gsp long %12.0g emp float %9.0g unemp float %9.0g -------------------------------------------------------------------------------------- Sorted by: state year
使用如下命令进行SAR估计
*SAR+FE
xsmle lngsp lnpcap lnpc lnemp unemp, wmat(usaww) model(sar) fe hausman nolog effects
结果如下,其中fe表示固定效应,可以换成re随机效应,hausman用以检验fe和re。effects表示显示空间直接、间接和总效应
SAR with spatial fixed-effects Number of obs = 816 Group variable: state Number of groups = 48 Time variable: year Panel length = 17 R-sq: within = 0.9433 between = 0.9557 overall = 0.9547 Mean of fixed-effects = 1.7573 Log-likelihood = 1900.8344 ------------------------------------------------------------------------------ lngsp | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Main | lnpcap | -.0465815 .0254001 -1.83 0.067 -.0963647 .0032017 lnpc | .1874323 .0233795 8.02 0.000 .1416094 .2332553 lnemp | .6250903 .028505 21.93 0.000 .5692215 .680959 unemp | -.0044816 .0008666 -5.17 0.000 -.00618 -.0027832 -------------+---------------------------------------------------------------- Spatial | rho | .2746886 .0210851 13.03 0.000 .2333625 .3160147 -------------+---------------------------------------------------------------- Variance | sigma2_e | .0011114 .0000551 20.16 0.000 .0010033 .0012194 -------------+---------------------------------------------------------------- LR_Direct | lnpcap | -.0465542 .0265982 -1.75 0.080 -.0986858 .0055774 lnpc | .1900105 .0229369 8.28 0.000 .145055 .234966 lnemp | .6398299 .027523 23.25 0.000 .5858859 .6937739 unemp | -.0045656 .0008838 -5.17 0.000 -.0062978 -.0028334 -------------+---------------------------------------------------------------- LR_Indirect | lnpcap | -.0163173 .0095843 -1.70 0.089 -.0351022 .0024677 lnpc | .0663106 .0085757 7.73 0.000 .0495026 .0831186 lnemp | .2237421 .0196861 11.37 0.000 .185158 .2623262 unemp | -.0015995 .0003466 -4.61 0.000 -.0022789 -.0009201 -------------+---------------------------------------------------------------- LR_Total | lnpcap | -.0628714 .0360627 -1.74 0.081 -.1335531 .0078102 lnpc | .2563211 .0297273 8.62 0.000 .1980567 .3145856 lnemp | .863572 .0356999 24.19 0.000 .7936015 .9335425 unemp | -.006165 .0012052 -5.12 0.000 -.0085272 -.0038029 ------------------------------------------------------------------------------ Ho: difference in coeffs not systematic chi2(5) = 3.22 Prob>=chi2 = 0.6659 ------------------------------------------------------------------------------
空间误差模型形式为
y
i
t
=
x
i
t
β
+
μ
i
+
μ
i
t
μ
i
t
=
λ
∑
j
=
1
N
w
i
j
μ
j
t
+
ε
i
t
下面是估计命令,
xsmle lngsp lnpcap lnpc lnemp unemp, emat(usaww) model(sem) fe hausman nolog
估计结果
R-sq: within = 0.9401 between = 0.9907 overall = 0.9896 Mean of fixed-effects = 2.8470 Log-likelihood = 1900.8344 ------------------------------------------------------------------------------ lngsp | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Main | lnpcap | .0051441 .0250122 0.21 0.837 -.0438789 .0541671 lnpc | .2053021 .0237393 8.65 0.000 .158774 .2518303 lnemp | .7822543 .0278151 28.12 0.000 .7277378 .8367708 unemp | -.0022317 .0010861 -2.05 0.040 -.0043603 -.000103 -------------+---------------------------------------------------------------- Spatial | lambda | .5574017 .0329539 16.91 0.000 .4928132 .6219902 -------------+---------------------------------------------------------------- Variance | sigma2_e | .0009765 .0000498 19.60 0.000 .0008789 .0010741 ------------------------------------------------------------------------------ Ho: difference in coeffs not systematic chi2(5) = 10.99 Prob>=chi2 = 0.0516
面板空间自相关模型(SAC)形式
y
i
t
=
ρ
W
y
i
t
+
β
X
i
t
+
v
i
t
v
i
t
=
λ
E
v
i
t
+
u
i
t
y_{it} = \rho Wy_{it} + \beta X_{it} + v_{it}\\ v_{it} = \lambda Ev_{it} + u_{it}
yit=ρWyit+βXit+vitvit=λEvit+uit
估计命令为
xsmle lngsp lnpcap lnpc lnemp unemp, wmat(usaww) emat(usaww) model(sac) fe nolog
其中wmat(usaww)是因变量对应空间权重矩阵, emat(usaww)是扰动项对应的空间权重矩阵。估计结果
SAC with spatial fixed-effects Number of obs = 816 Group variable: state Number of groups = 48 Time variable: year Panel length = 17 R-sq: within = 0.9423 between = 0.9854 overall = 0.9844 Mean of fixed-effects = 2.4143 Log-likelihood = 1900.8344 ------------------------------------------------------------------------------ lngsp | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Main | lnpcap | -.0103492 .025797 -0.40 0.688 -.0609104 .0402119 lnpc | .1905778 .0241401 7.89 0.000 .1432642 .2378915 lnemp | .7552378 .0301064 25.09 0.000 .6962302 .8142453 unemp | -.0030613 .0010688 -2.86 0.004 -.0051561 -.0009665 -------------+---------------------------------------------------------------- Spatial | rho | .0885753 .0298792 2.96 0.003 .0300131 .1471375 lambda | .455313 .0502814 9.06 0.000 .3567632 .5538628 -------------+---------------------------------------------------------------- Variance | sigma2_e | .0010589 .000051 20.77 0.000 .000959 .0011588 ------------------------------------------------------------------------------
SDM模型形式为
y
=
α
+
ρ
W
y
+
X
β
+
W
X
‾
γ
+
ε
\boldsymbol{y}=\boldsymbol{\alpha}+\rho \boldsymbol{W} \boldsymbol{y}+\boldsymbol{X} \boldsymbol{\beta}+\boldsymbol{W} \overline{\boldsymbol{X}} \boldsymbol{\gamma}+\boldsymbol{\varepsilon}
y=α+ρWy+Xβ+WXγ+ε
根据时间、空间和时空固定的不同,又可以对命令进行调整。下面三条命令都是固定效应,还可以尝试用随机效应,尽管不常用。估计命令
* 空间固定
xsmle lngsp lnpcap lnpc lnemp, wmat(usaww) model(sdm) type(ind) fe nolog
* 时间固定
xsmle lngsp lnpcap lnpc lnemp, wmat(usaww) model(sdm) type(time) fe nolog
* 时空固定
xsmle lngsp lnpcap lnpc lnemp, wmat(usaww) model(sdm) type(both) fe nolog
下面只显示最后一条的估计结果
SDM with spatial and time fixed-effects Number of obs = 816 Group variable: state Number of groups = 48 Time variable: year Panel length = 17 R-sq: within = 0.9429 between = 0.9886 overall = 0.9875 Mean of fixed-effects = 2.4199 Log-likelihood = 1900.8344 ------------------------------------------------------------------------------ lngsp | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Main | lnpcap | -.0279948 .0244525 -1.14 0.252 -.0759209 .0199313 lnpc | .1606445 .0256644 6.26 0.000 .1103432 .2109457 lnemp | .7718209 .0266684 28.94 0.000 .7195518 .82409 -------------+---------------------------------------------------------------- Wx | lnpcap | -.1163453 .0420475 -2.77 0.006 -.1987568 -.0339337 lnpc | .0139823 .0461253 0.30 0.762 -.0764216 .1043862 lnemp | -.2501777 .0513908 -4.87 0.000 -.3509018 -.1494536 -------------+---------------------------------------------------------------- Spatial | rho | .3809206 .0394352 9.66 0.000 .3036291 .4582121 -------------+---------------------------------------------------------------- Variance | sigma2_e | .0009275 .0000466 19.90 0.000 .0008362 .0010189 ------------------------------------------------------------------------------
广义的空间面板模型形式非常复杂
Y
t
=
δ
W
Y
t
+
τ
Y
t
−
1
+
η
W
Y
t
−
1
+
β
1
X
t
+
β
2
W
X
t
+
β
3
X
t
−
1
+
β
4
W
X
t
−
1
+
Z
t
θ
+
v
t
v
t
=
γ
ν
t
−
1
+
ρ
W
ν
t
−
1
+
μ
+
λ
t
ℓ
N
+
ε
t
,
μ
=
κ
W
μ
+
ξ
其中动态的滞后性体现在时间上、空间上或时空上。既体现在因变量上又体现在自变量上,最后还体现在扰动项的时空上。根据不同参数的取值,又可以转化为以上的不同模型。下面给出不含扰动项动态性和空间滞后性的特例。命令如下:
*DSPM
* dlag(1)时间滞后
xsmle lngsp lnpcap lnpc lnemp unemp, wmat(usaww) model(sdm) fe dlag(1) nolog r
* dlag(2)空间滞后
xsmle lngsp lnpcap lnpc lnemp unemp, wmat(usaww) model(sdm) fe dlag(2) nolog r
* dlag(3)时空滞后
xsmle lngsp lnpcap lnpc lnemp unemp, wmat(usaww) model(sdm) fe dlag(3) nolog r
下面仅汇报第三条结果
Dynamic SDM with spatial fixed-effects Number of obs = 768 Group variable: state Number of groups = 48 Time variable: year Panel length = 16 R-sq: within = 0.9662 between = 0.9985 overall = 0.9979 Mean of fixed-effects = 0.4269 Log-likelihood = 1930.9498 ------------------------------------------------------------------------------ lngsp | Coefficient Std. err. z P>|z| [95% conf. interval] -------------+---------------------------------------------------------------- Main | lngsp | L1. | .889765 .0221781 40.12 0.000 .8462968 .9332332 | Wlngsp | L1. | -.770734 .0321557 -23.97 0.000 -.833758 -.7077099 | lnpcap | -.0518792 .0159358 -3.26 0.001 -.0831128 -.0206455 lnpc | -.0666301 .0160119 -4.16 0.000 -.0980127 -.0352474 lnemp | .168119 .0242772 6.92 0.000 .1205366 .2157014 unemp | -.0065448 .0007519 -8.70 0.000 -.0080184 -.0050712 -------------+---------------------------------------------------------------- Wx | lnpcap | .0210242 .028116 0.75 0.455 -.0340822 .0761305 lnpc | .1397731 .024275 5.76 0.000 .0921949 .1873512 lnemp | -.0539297 .038193 -1.41 0.158 -.1287865 .0209271 unemp | .0040633 .000989 4.11 0.000 .002125 .0060017 -------------+---------------------------------------------------------------- Spatial | rho | .7213969 .023442 30.77 0.000 .6754513 .7673424 -------------+---------------------------------------------------------------- Variance | sigma2_e | .000332 .0000167 19.93 0.000 .0002993 .0003646 ------------------------------------------------------------------------------
更多option使用help(xsmle)。还有一些空间计量模型使用Matlab更方便,这里不再介绍。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。