楼主: zxm045
16383 24

[回归分析求助] 空间杜宾模型检验 [推广有奖]

21
Sensual 发表于 2020-2-24 10:58:54
Sensual 发表于 2020-2-24 10:49
需要 想要一下stat做LR检验的代码 感谢感谢
不用啦 看到了你发的帖子啦 感谢!

22
2020000001008 发表于 2021-12-7 08:47:24
***LR 检验          //用来检验SDM模型能否退化为SEM、SAR模型

xsmle y x1 x2 x3,fe model(sdm)wmat(w)type(both)nolog effects
est store sdm
xsmle y x1 x2 x3,fe model(sar)wmat(w)type(both)nolog effects
est store sar
xsmle y x1 x2 x3,fe model(sem)emat(w)type(both)nolog effects
est store sem
lrtest sdm sar   //H0:空间杜宾模型可以简化为空间滞后模型
lrtest sdm sem  //H0:空间杜宾模型可以简化为空间误差模型


***WALD检验    //也是用来检验模型的适配性
clear all
cd"C:\Program Files (x86)\Stata14\ado"//定义路径
use shuju                             //调用数据
spatwmat using D.dta,name(w) standardize //调用数据矩阵D,并将其还行标准化
encode province,gen(pro)
xtset pro year
gen lny=ln(y)
gen lnx1=ln(x1)
gen lnx2=ln(x2)
gen lnx3=ln(x3)
xsmle lny lnx1 lnx2 lnx3,fe model(sdm) wmat(w)type(both)nolog noeffects

test [Wx]x1 = [Wx]x2 = [Wx]x3=0
testnl ([Wx]x1 = -[Spatial]rho*[Main]x1)([Wx]x2 = -[Spatial]rho*[Main]x2)([Wx]x3= -[Spatial]rho*[Main]x3)

23
2020000001008 发表于 2021-12-7 09:48:00
Wald 检验
clear all
use data
spatwmat using W.dta,name(W) standardize
xtset id year
xsmle y x* a*, fe model(sdm) wmat(W) type(both) nolog noeffects
·Wald Test for SAR
test [Wx]x1 = [Wx]x2 = [Wx]x3 = [Wx]a1= [Wx]a2= [Wx]a3= [Wx]a4=0
·Wald Test for SEM
testnl ([Wx]x1 = -[Spatial]rho*[Main]x1)([Wx]x2 = -[Spatial]rho*[Main]x2)([Wx]x3= -
[Spatial]rho*[Main]x3) ([Wx]a1 = -[Spatial]rho*[Main]a1)([Wx]a2= -[Spatial]rho*[Main]a2) ([Wx]a3 =
-[Spatial]rho*[Main]a3)([Wx]a4= -[Spatial]rho*[Main]a4)

LR 检验
xsmle y x* a*, fe model(sdm) wmat(W) type(both) nolog noeffects
est store sdm
xsmle y x* a*, fe model(sar) wmat(W) type(both) nolog noeffects
est store sar
xsmle y x* a*, fe model(sem) emat(W) type(both) nolog noeffects
est store sem
lrtest sdm sar //H0:空间杜宾模型可以简化为空间滞后模型(SAR)
lrtest sdm sem //H0:空间杜宾模型可以简化为空间误差模型(SEM)

24
东走西顾的兔 发表于 2022-1-2 16:38:09
jiguishen1 发表于 2019-5-5 11:19
谢谢,还想继续请教您几个问题。
1.我通过 lr检验 这三个效应,进行个体和双固定的检验会失败,提示 lrt ...
你好,请问您的第一个问题解决了吗,代码如何实现呢

25
wxzh1997 发表于 2022-4-22 10:12:13
beiluo08 发表于 2019-4-29 17:23
xsmle y x1 x2 x3, wmat(W) model(sdm) fe type(both) robust hausman nolog
***Wald Test for SAR
test  ...
请问里面的Wx是什么呀?W是矩阵对吗?X是什么?

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-11 15:52