Lets say that I am trying to compare -reg3- estimates over two different subsamples, using bootstrap. My bootstrap program is like this:
My program seems correct, on one run it calculates what it is supposed to calculate. However, when I bootstrap my programme, Stata return this, meaning that my statistic Diff is identically 0 in all bootstrap samples.
What is wrong here?
(This issue originated in the thread
https://www.statalist.org/forums/for...nts-after-reg3
I could not figure it out there, hence I am repeating it here with hopefully more informative title of the post)
Code:
sysuse auto, clear cap prog drop myboot prog define myboot, rclass reg3 ( price mpg) ( weight length) sca Pricempg = [price]mpg reg3 ( price mpg) ( weight length) if foreign==1 return sca Diff = Pricempg - [price]mpg end bootstrap Diff=r(Diff), reps(100) : myboot
Code:
. bootstrap Diff=r(Diff), reps(100) : myboot
(running myboot on estimation sample)
Bootstrap replications (100)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
.................................................. 50
.................................................. 100
Bootstrap results Number of obs = 22
Replications = 100
command: myboot
Diff: r(Diff)
------------------------------------------------------------------------------
| Observed Bootstrap Normal-based
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Diff | 20.35371 . . . . .
------------------------------------------------------------------------------
.
(This issue originated in the thread
https://www.statalist.org/forums/for...nts-after-reg3
I could not figure it out there, hence I am repeating it here with hopefully more informative title of the post)

Comment