全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
7342 8
2019-11-16
各位大神,我想做政策和时间冲击下DID模型的安慰剂检验,我的代码如下:
forvalue i=1/1000{
  sysuse auto, clear
  g obs_id=_n
  gen random_digit= runiform()
  sort random-digit
  g random-id=_n
  preserve
      keep random_id interaction
      rename interaction random_interaction
      rename random_id id
      label var id
      save random_interaction, replace
  restore
      drop random_digit random_id interaction
      rename obs_id id
      label var id
      save rawdata, replace
      use rawdata,clear
      merge 1:1 id using random_interaction, nogen
      xtreg combinationnum random_interaction unemploymentrate gdpgrowthrate inflationrate population distcap comlang contig resourcerent wto gdppercapita
      g _b_random_interaction= _b[random_interaction]
      g _se_random_interaction= _se[random_interaction]
      keep _b_random_interaction _se_random_interaction
      duplicates drop _b_random_interaction, force
      save placebo`i', replace
   }
use placebo`i', clear
forvalue i=2/1000{
   append using placebo`i'
}
gen tvalue= _b_random_interaction/ _se_random_interaction
kdensity tvalue, xtitle("t值") ytitle("分布") saving(placebo_test)
forvalue i=1/1000{
    erase placebo`i'.dta
}
然后stata出现variable digit not found
r(111);
file placebo.dta not found
r(601);
错误,这是我从别人那参考的代码,求大神指点哪里写错了?
我的因变量是combinationnum, 自变量是bri post interaction交互项,剩下的都是控制变量,固定时间效应。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2020-10-19 00:48:40
Ann-1212 发表于 2019-11-16 08:05
各位大神,我想做政策和时间冲击下DID模型的安慰剂检验,我的代码如下:
forvalue i=1/1000{
  sysuse au ...
你好,上述问题你解决了吗?<br>

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2021-9-22 22:49:43
老哥,别人的变量叫digit,你当然跑不出来了啊
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2021-9-24 16:08:32
周生辰 发表于 2020-10-19 00:48
你好,上述问题你解决了吗?
我复刻别人论文也是这样,怎么解决啊
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2021-9-24 16:13:08
人大经英 发表于 2021-9-22 22:49
老哥,别人的变量叫digit,你当然跑不出来了啊
老哥,知道怎么做吗
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2021-9-24 22:11:41
7940_1620973978 发表于 2021-9-24 16:13
老哥,知道怎么做吗
你得把你的具体问题说出来呀,啥都没有我怎么说
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群