楼主: yffhm
13704 31

[面板数据求助] bootstrap结果分析 [推广有奖]

11
yffhm 学生认证  发表于 2014-3-27 19:09:04
jjjj6666 发表于 2014-3-26 20:10
directly sample from the data using "bsample"
谢谢  能否详细说明一下 按照个体对残差分组的命令和从分组后的样本中如何抽取观察值 实在是没琢磨明白  太感谢了!

12
jjjj6666 发表于 2014-3-27 23:17:31
you can use (using reg as an example and the x y are in data) bsample by writing a program

drop _all
use data
reg y x
predict xb
mat F=e(F)
predict r, r

cap prog drop bootsRegF
prog def bootsRegF, rclass

  preserve
  bsample
  gen new_y = xb+r
  * if treating x as fixed
  reg new_y x
  *reg y x
  return sca F = e(F)
  restore
end

simulate F=r(F), reps(250) : bootsRegF
bstat, stat(F)

13
yffhm 学生认证  发表于 2014-4-1 17:04:36
jjjj6666 发表于 2014-3-27 23:17
you can use (using reg as an example and the x y are in data) bsample by writing a program

drop _ ...
你好 很感谢 利用您给出的命令 采用reg方法非常成功能得出P值  如果是用 xtabond2 的命令  试了一下 上面有些命令貌似就会出问题 尤其是到了simulate 这一步的时候 该怎么解决呢?

14
jjjj6666 发表于 2014-4-1 19:43:14
can you post your codes so other people can see where the problem may be?

15
yffhm 学生认证  发表于 2014-4-1 20:26:26
jjjj6666 发表于 2014-4-1 19:43
can you post your codes so other people can see where the problem may be?
命令.jpg
基本上跟你给出的命令是一样的 ,只是使用xtabond2 的命令 但是进行到simulate F=r(F), reps(250) : bootsXtregF  显示bootsXtregF command not found  
上图me_var=var-均值(按ID取均值)

16
jjjj6666 发表于 2014-4-1 23:06:00
the function bootsXtregF seems defined.

What happen if you just use the command

bootsXtregF

17
yffhm 学生认证  发表于 2014-4-2 16:13:02
jjjj6666 发表于 2014-4-1 23:06
the function bootsXtregF seems defined.

What happen if you just use the command
1.jpg
上述是采用bootsXtabond2F命令的结果
2.jpg
上述是采用bootsXtregF的结果  采用summarize命令,发现观察值是0个  不知道怎么回事,希望您能帮忙解释下这两种现象!谢谢

18
jjjj6666 发表于 2014-4-3 08:45:32
it looks like the bootstrap sample is not correct.

you have panel data, so you cannot sample the observation directly, instead sample by panel, can you try if this work:

cap prog drop bootsXtregF
prog def bootsXtregF, rclass       

    preserve
    bsample, cluster(id) id(newid)
    tsset newid year
    gen new_lev = xb+ehat
    xtabond2 ???????  * your xtabond2 command here
    return sca F=e(F)
    restore
end

simulate F=r(F), reps(10) : bootsXtregF
bstat, stat(F)

19
yffhm 学生认证  发表于 2014-4-4 19:45:15
jjjj6666 发表于 2014-4-3 08:45
it looks like the bootstrap sample is not correct.

you have panel data, so you cannot sample the ...
命令.jpg
恩,我的是面板数据,这是我按照你给出的命令重新运行的程序,下面附上结果:
1.jpg
显示观察值个数为0   不知道怎么回事儿呢?

20
jjjj6666 发表于 2014-4-4 22:25:35
you commented cout "xtreg" in the program bootsXtregF, xtreg was not run in the bootstrap, that may be the problem.

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-31 21:09