加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

stata:SAR\SEM模型步骤与命令

(2017-02-20 14:22:31)
标签:

空间计量

分类: empiricalmethod
. import excel "C:\Users\张燕\Desktop\working paper\“荷兰病”空间效应\荷兰病\论文写作\stata
> 用表20170218.xlsx", sheet("Sheet1") firstrow       %表格当中不出现地区名,用数字表示,年份也用数字表示,表格排列方式:area year Y x1 x2···,30个地区21年数据排成30*21的矩阵(每个地区21年数据,依次排成30个地区)

. save "C:\Users\张燕\Desktop\DD.dta"   %原始数据储存成stata格式
file C:\Users\张燕\Desktop\DD.dta saved

. use "C:\Users\张燕\Desktop\W.dta", clear  %输入0-1权重矩阵

. spmat dta W s*, normalize(row)  %权重矩阵行标准化

use "C:\Users\张燕\Desktop\DD.dta", clear %重新载入stata格式的变量数据
 xtset area year   %定义面板数据
  xsmle LM RA RD1 RD2 LPOP LM1, wmat(W) model(sar) fe type(both) nsim(500)  %空间模型回归
   xsmle LM RA RD1 RD2 LPOP LM1, emat(W) model(sem) fe type(both)
   xsmle CM RA RD1 RD2 Y CM1, wmat(W) model(sar) fe type(both) nsim(500)
   xsmle CM RA RD1 RD2 Y CM1, emat(W) model(sem) fe type(both) nsim(500)
   
. xsmle I RA RD1 RD2 LFR I1, wmat(W) model(sar) fe type(both) nsim(500)

. xsmle I RA RD1 RD2 LFR I1, emat(W) model(sem) fe type(both) nsim(500)
xsmle I RA RD1 RD2 LFR I1, wmat(W) model(sdm) fe type(both) nsim(500) nolog

%sar模型hausman检验%
xsmle LM RA RD1 RD2 LPOP LM1, wmat(W) model(sar) fe type(both) nsim(500)%sar模型固定效应
estimates store sar_fe%存取估计结果
xsmle LM RA RD1 RD2 LPOP LM1, wmat(W) model(sar) re type(both) nsim(500)%sar模型随机效应
estimates store sar_re
hausman sar_fe sar_re%hausman检验,P值小于0.05,表明模型选择固定效应

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有