Sunny_22 发表于 2021-5-13 16:54 
请问空间面板回归LM检验和LR检验的STATA代码是什么呀
//////LM检验///////
clear all
set matsize 5000
* D为矩阵名称
use GW
spcs2xt var1-var30, matrix(aaa)time(14)
spatwmat using aaaxt,name(w)
* 导入数据
use a3.dta, clear
* 定义地区变量
encode city,gen(ci)
* 定义时间变量
xtset ci year
reg lnrub lnpu lneu lnsu lnlu lncon lngover lnfix_cap lntech
spatdiag,weights(w)
////////LR检验//////
spatwmat using GW.dta, name(GW) standardize
xsmle lnrub lnpu lneu lnsu lnlu lncon lngover lnfix_cap lntech,wmat(GW) model(sdm) fe type(both) nsim(500) nolog effects
est store sdm
xsmle lnrub lnpu lneu lnsu lnlu lncon lngover lnfix_cap lntech , wmat(GW) model(sar) fe type(both) nsim(500) nolog effects
est store sar
xsmle lnrub lnpu lneu lnsu lnlu lncon lngover lnfix_cap lntech , emat(GW) model(sem) fe type(both) nsim(500) nolog effects
est store sem
lrtest sdm sar
lrtest sdm sem