楼主: lijinning
11126 31

[回归分析求助] bootstrap命令遇阻了,求正解啊 [推广有奖]

  • 2关注
  • 1粉丝

硕士生

41%

还不是VIP/贵宾

-

威望
0
论坛币
481 个
通用积分
3.1820
学术水平
4 点
热心指数
5 点
信用等级
5 点
经验
971 点
帖子
75
精华
0
在线时间
209 小时
注册时间
2016-3-16
最后登录
2020-11-26

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
我用bootstrap这个命令卡到这里进行不下去了,求牛人赐教啊,万谢
bootstrap  r(ind_eff) r(dir_eff), reps(1000):sgmediation cir, mv(rentw) iv(con) cv($x1)
(running sgmediation on estimation sample)
'r(ind_eff)' evaluated to missing in full sample
r(322);


二维码

扫码加我 拉你入群

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

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


回帖推荐

黃河泉 发表于3楼  查看完整内容

我试过是可以的,

黃河泉 发表于4楼  查看完整内容

结果为
沙发
zzcwan 发表于 2018-12-23 11:14:20 |只看作者 |坛友微信交流群
请问,你解决这个问题了吗?

使用道具

藤椅
黃河泉 在职认证  发表于 2018-12-23 11:31:56 |只看作者 |坛友微信交流群
zzcwan 发表于 2018-12-23 11:14
请问,你解决这个问题了吗?
我试过是可以的,
  1. use https://stats.idre.ucla.edu/stat/data/hsbdemo, clear

  2. sgmediation science, mv(read) iv(math)

  3. // Bootstrap with case resampling
  4. bootstrap r(ind_eff) r(dir_eff), reps(100): sgmediation science, iv(math) mv(read)

  5. // Bootstrap with residual resampling
  6. // search resboot_mediation and install
  7. resboot_mediation, dv(science) mv(read) iv(math) reps(100)
复制代码

使用道具

板凳
黃河泉 在职认证  发表于 2018-12-23 11:32:25 |只看作者 |坛友微信交流群
zzcwan 发表于 2018-12-23 11:14
请问,你解决这个问题了吗?
结果为
  1. . use https://stats.idre.ucla.edu/stat/data/hsbdemo, clear
  2. (highschool and beyond (200 cases))

  3. .
  4. . sgmediation science, mv(read) iv(math)

  5. Model with dv regressed on iv (path c)

  6.       Source |       SS           df       MS      Number of obs   =       200
  7. -------------+----------------------------------   F(1, 198)       =    130.81
  8.        Model |  7760.55791         1  7760.55791   Prob > F        =    0.0000
  9.     Residual |  11746.9421       198  59.3279904   R-squared       =    0.3978
  10. -------------+----------------------------------   Adj R-squared   =    0.3948
  11.        Total |     19507.5       199  98.0276382   Root MSE        =    7.7025

  12. ------------------------------------------------------------------------------
  13.      science |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
  14. -------------+----------------------------------------------------------------
  15.         math |     .66658   .0582822    11.44   0.000     .5516466    .7815135
  16.        _cons |   16.75789   3.116229     5.38   0.000     10.61264    22.90315
  17. ------------------------------------------------------------------------------

  18. Model with mediator regressed on iv (path a)

  19.       Source |       SS           df       MS      Number of obs   =       200
  20. -------------+----------------------------------   F(1, 198)       =    154.70
  21.        Model |  9175.57065         1  9175.57065   Prob > F        =    0.0000
  22.     Residual |  11743.8493       198  59.3123704   R-squared       =    0.4386
  23. -------------+----------------------------------   Adj R-squared   =    0.4358
  24.        Total |    20919.42       199  105.122714   Root MSE        =    7.7015

  25. ------------------------------------------------------------------------------
  26.         read |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
  27. -------------+----------------------------------------------------------------
  28.         math |    .724807   .0582745    12.44   0.000     .6098887    .8397253
  29.        _cons |   14.07254   3.115819     4.52   0.000     7.928087    20.21699
  30. ------------------------------------------------------------------------------

  31. Model with dv regressed on mediator and iv (paths b and c')

  32.       Source |       SS           df       MS      Number of obs   =       200
  33. -------------+----------------------------------   F(2, 197)       =     90.27
  34.        Model |  9328.73944         2  4664.36972   Prob > F        =    0.0000
  35.     Residual |  10178.7606       197  51.6688353   R-squared       =    0.4782
  36. -------------+----------------------------------   Adj R-squared   =    0.4729
  37.        Total |     19507.5       199  98.0276382   Root MSE        =    7.1881

  38. ------------------------------------------------------------------------------
  39.      science |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
  40. -------------+----------------------------------------------------------------
  41.         read |   .3654205   .0663299     5.51   0.000     .2346128    .4962283
  42.         math |   .4017207   .0725922     5.53   0.000     .2585632    .5448782
  43.        _cons |    11.6155   3.054262     3.80   0.000     5.592255    17.63875
  44. ------------------------------------------------------------------------------

  45. Sobel-Goodman Mediation Tests

  46.                      Coef         Std Err     Z           P>|Z|
  47. Sobel               .26485934    .05258136   5.037      4.726e-07
  48. Goodman-1 (Aroian)  .26485934    .05272324   5.024      5.072e-07
  49. Goodman-2           .26485934    .05243909   5.051      4.400e-07

  50.                     Coef      Std Err    Z          P>|Z|
  51. a coefficient   =  .724807   .058274   12.4378          0
  52. b coefficient   =  .365421    .06633   5.50914    3.6e-08
  53. Indirect effect =  .264859   .052581   5.03713    4.7e-07
  54.   Direct effect =  .401721   .072592   5.53394    3.1e-08
  55.    Total effect =   .66658   .058282   11.4371          0

  56. Proportion of total effect that is mediated:  .39734065
  57. Ratio of indirect to direct effect:           .65931219
  58. Ratio of total to direct effect:              1.6593122

  59. .
  60. . // Bootstrap with case resampling
  61. . bootstrap r(ind_eff) r(dir_eff), reps(100): sgmediation science, iv(math) mv(read)
  62. (running sgmediation on estimation sample)

  63. Bootstrap replications (100)
  64. ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
  65. ..................................................    50
  66. ..................................................   100

  67. Bootstrap results                               Number of obs     =        200
  68.                                                 Replications      =        100

  69.       command:  sgmediation science, iv(math) mv(read)
  70.         _bs_1:  r(ind_eff)
  71.         _bs_2:  r(dir_eff)

  72. ------------------------------------------------------------------------------
  73.              |   Observed   Bootstrap                         Normal-based
  74.              |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
  75. -------------+----------------------------------------------------------------
  76.        _bs_1 |   .2648593   .0548092     4.83   0.000     .1574353    .3722834
  77.        _bs_2 |   .4017207   .0773451     5.19   0.000     .2501271    .5533143
  78. ------------------------------------------------------------------------------

  79. .
  80. . // Bootstrap with residual resampling
  81. . // search resboot_mediation and install
  82. . resboot_mediation, dv(science) mv(read) iv(math) reps(100)

  83.       Source |       SS           df       MS      Number of obs   =       200
  84. -------------+----------------------------------   F(1, 198)       =    154.70
  85.        Model |  9175.57065         1  9175.57065   Prob > F        =    0.0000
  86.     Residual |  11743.8493       198  59.3123704   R-squared       =    0.4386
  87. -------------+----------------------------------   Adj R-squared   =    0.4358
  88.        Total |    20919.42       199  105.122714   Root MSE        =    7.7015

  89. ------------------------------------------------------------------------------
  90.         read |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
  91. -------------+----------------------------------------------------------------
  92.         math |    .724807   .0582745    12.44   0.000     .6098887    .8397253
  93.        _cons |   14.07254   3.115819     4.52   0.000     7.928087    20.21699
  94. ------------------------------------------------------------------------------

  95.       Source |       SS           df       MS      Number of obs   =       200
  96. -------------+----------------------------------   F(2, 197)       =     90.27
  97.        Model |  9328.73944         2  4664.36972   Prob > F        =    0.0000
  98.     Residual |  10178.7606       197  51.6688353   R-squared       =    0.4782
  99. -------------+----------------------------------   Adj R-squared   =    0.4729
  100.        Total |     19507.5       199  98.0276382   Root MSE        =    7.1881

  101. ------------------------------------------------------------------------------
  102.      science |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
  103. -------------+----------------------------------------------------------------
  104.         read |   .3654205   .0663299     5.51   0.000     .2346128    .4962283
  105.         math |   .4017207   .0725922     5.53   0.000     .2585632    .5448782
  106.        _cons |    11.6155   3.054262     3.80   0.000     5.592255    17.63875
  107. ------------------------------------------------------------------------------

  108. Nonparametric resampled residual bootstrap of mediation with 100 replications

  109.                                 Bootstrap
  110.           Coef         Bias      Std Err    [95% Conf Interval]
  111. ind eff  .264859     -.004476   .049476     .16706    .361213 (P)
  112.                                            .161851    .288976 (BC)
  113. dir eff  .401721      .018876   .078578    .229207    .596203 (P)
  114.                                            .215327    .444609 (BC)
  115. tot eff   .66658        .0144   .059022    .565236    .811957 (P)
  116.                                            .556105    .698295 (BC)
  117. (P)   percentile confidence interval
  118. (BC)  bias-corrected confidence interval
复制代码

使用道具

报纸
zzcwan 发表于 2018-12-23 13:32:43 |只看作者 |坛友微信交流群
黃河泉 发表于 2018-12-23 11:32
结果为
. use "C:\Users\JGY3\Desktop\1222.dta"

. sgmediation te , mv( z1 ) iv(d)

Model with dv regressed on iv

      Source |       SS       df       MS              Number of obs =    3865
-------------+------------------------------           F(  1,  3863) =   54.74
       Model |  1.32174584     1  1.32174584           Prob > F      =  0.0000
    Residual |  93.2731271  3863  .024145257           R-squared     =  0.0140
-------------+------------------------------           Adj R-squared =  0.0137
       Total |  94.5948729  3864  .024481075           Root MSE      =  .15539

------------------------------------------------------------------------------
          te |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           d |    .088703   .0119889     7.40   0.000     .0651977    .1122082
       _cons |    .504131   .0025584   197.05   0.000     .4991152    .5091469
------------------------------------------------------------------------------

Model with mediator regressed on iv

      Source |       SS       df       MS              Number of obs =    3865
-------------+------------------------------           F(  1,  3863) =   17.66
       Model |  18.3255342     1  18.3255342           Prob > F      =  0.0000
    Residual |  4008.00698  3863   1.0375374           R-squared     =  0.0046
-------------+------------------------------           Adj R-squared =  0.0043
       Total |  4026.33252  3864  1.04201152           Root MSE      =  1.0186

------------------------------------------------------------------------------
          z1 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           d |   .3302877   .0785898     4.20   0.000     .1762063    .4843691
       _cons |   2.118576   .0167706   126.33   0.000     2.085696    2.151456
------------------------------------------------------------------------------

Model with dv regressed on mediator and iv

      Source |       SS       df       MS              Number of obs =    3865
-------------+------------------------------           F(  2,  3862) =   45.41
       Model |  2.17332266     2  1.08666133           Prob > F      =  0.0000
    Residual |  92.4215503  3862  .023931007           R-squared     =  0.0230
-------------+------------------------------           Adj R-squared =  0.0225
       Total |  94.5948729  3864  .024481075           Root MSE      =   .1547

------------------------------------------------------------------------------
          te |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          z1 |   .0145763   .0024435     5.97   0.000     .0097856     .019367
           d |   .0838886   .0119629     7.01   0.000     .0604344    .1073427
       _cons |     .47325   .0057694    82.03   0.000     .4619386    .4845614
------------------------------------------------------------------------------

Sobel-Goodman Mediation Tests

             Coef         Std Err     Z           P>|Z|
Sobel       .00481438    .0014013   3.436      .00059112
Goodman-1   .00481438    .0014144   3.404      .00066445
Goodman-2   .00481438    .00138808   3.468      .00052361

Pecent of total effect that is mediated:   5.43 %
Ratio of indirect to direct effect:        0.0574

. Bootstrap with case resampling
bootstrap already defined
(error occurred while loading Bootstrap.ado)
r(110);

. bootstrap r(ind_eff) r(dir_eff), reps(100): sgmediation te , mv( z1 ) iv(d) cv( x8 x6 z2 z3 z4 z5 z6 z7 z9 z8 z10 z11 )
(running sgmediation on estimation sample)
'r(ind_eff)' evaluated to missing in full sample
r(322);

.

.
黄老师,还是这样的结果~我的自变量是虚拟变量

使用道具

地板
zzcwan 发表于 2018-12-23 21:16:51 |只看作者 |坛友微信交流群
黃河泉 发表于 2018-12-23 11:31
我试过是可以的,
谢谢黄老师,按照您的命令,换了14版本,结果出来了~

使用道具

7
lijinning 发表于 2019-1-2 11:42:28 |只看作者 |坛友微信交流群
黃河泉 发表于 2018-12-23 11:31
我试过是可以的,
那请问如何加入条件命令呢,比如满足一个条件时中介效应是否存在?非常感谢您的关注!

使用道具

8
黃河泉 在职认证  发表于 2019-1-2 15:41:31 |只看作者 |坛友微信交流群
lijinning 发表于 2019-1-2 11:42
那请问如何加入条件命令呢,比如满足一个条件时中介效应是否存在?非常感谢您的关注!
不清楚!

使用道具

9
lijinning 发表于 2019-1-3 08:25:20 |只看作者 |坛友微信交流群
黃河泉 发表于 2019-1-2 15:41
不清楚!
谢谢回复!

使用道具

10
心晴小姑娘 发表于 2019-2-19 14:27:47 |只看作者 |坛友微信交流群
黃河泉 发表于 2018-12-23 11:32
结果为
老师请问您固定效应的中介效应如何检验呢

使用道具

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

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-23 22:42