xsmle y x1 x2 x3, wmat(W) model(sdm) fe type(both) robust hausman nolog
***Wald Test for SAR
test [Wx]x1=[Wx]x2=[Wx]x3=0
***Wald Test for SEM
testnl ([Wx]x1=-[Spatial]rho*[Main]x1) ([Wx]x2=-[Spatial]rho*[Main]x2) ([Wx]x3=-[Spatial]rho*[Main]x3)
***LR Test for SAR or SEM
qui xsmle y x1 x2 x3, wmat(W) model(sdm) fe type(both) nolog
est sto sdm
qui xsmle y x1 x2 x3, wmat(W) model(sar) fe type(both) nolog
est sto sar
qui xsmle y x1 x2 x3, emat(W) model(sem) fe type(both) nolog
est sto sem
lrtest sdm sar
lrtest sdm sem