Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: issue with bootstrap


From   "Stas Kolenikov" <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: issue with bootstrap
Date   Tue, 25 Nov 2008 12:33:52 -0600

That's an interesting one conceptually: should the last estimation
command be -bootstrap- or -regress-? Some of the post-estimation
commands following -regress- should allow for regression diagnostics,
while others, for the bootstrap diagnostics. Here's what Stata says:

. set trace on

. estat boot, bca
   ---------------------------------------------------------------------------
begin estat ---
01 - version 9
01 - if `"`e(cmd)'"' == "" {
   = if `"bootstrap"' == "" {
01   error 301
01   }
01 - if `"`e(estat_cmd)'"' != "" {
   = if `"regress_estat"' != "" {
01 - `e(estat_cmd)' `0'
   = regress_estat boot, bca
     -----------------------------------------------------------------
begin regress_estat ---
02   - version 9
02   - if "`e(cmd)'" != "regress" {
     = if "bootstrap" != "regress" {
02   - error 301
last estimates not found
02     }
     -------------------------------------------------------------------
end regress_estat ---
01   return add
01   exit
01   }
   -----------------------------------------------------------------------------
end estat ---
r(301);

-bca- option falls between the cracks. It does not seem to be a proper
post-estimation thing, as there is no formal bootstrap post-estimation
command in the sense of what -estat- could call. So I am puzzled as to
why it works, at all :))

Here's what you can do:

pro def myreg, eclass
  reg `0'
  eret local estat_cmd
end

bootstrap ... : myreg ...

Since that -estat_cmd- was cleared, it gives way to -estat boot, bca- to work.

On 11/25/08, Lachenbruch, Peter <Peter.Lachenbruch@oregonstate.edu> wrote:
> I was doing a bootstrap and wanted to get estat estimates and got "last
>  estimates not found"  Here are the commands and output
>
>  . bootstrap _b e(r2) e(rmse),bca reps(500) :reg tvas age anyapheresis
>  anyaza anyca anycyclosp anyhcq anyiv_cytoxan  anyivig anymtx
>  anypo_cytoxan anypred anyulc calcinosis ck252 cmasxt2 contracture
>  duractdz dysphagia dysphonia dzactvas extramuscleact finchaq funcclass
>  gender onsetseverity
>  (running regress on estimation sample)
>
>  Jackknife replications (84)
>  <snip]
>  Bootstrap replications (500)
>  <snip>
>  Linear regression                          Number of obs      =
>  84
>                                            Replications       =
>  500
>                                            R-squared          =
>  0.8502
>                                            Adj R-squared      =
>  0.7856
>                                            Root MSE           =
>  3.8019
>
>       command:  regress tvas age anyapheresis anyaza anyca anycyclosp
>  anyhcq anyiv_cytoxan anyivig anymtx anypo_cytoxan anypred anyulc
>  calcinosis ck252 cmasxt2 contracture duractdz dysphagia dysphonia
>  dzactvas extramuscleact finchaq funcclass gender onsetseverity
>   [_eq2]_bs_1:  e(r2)
>   [_eq2]_bs_2:  e(rmse)
>
>  ------------------------------------------------------------------------
>  ----
>              |   Observed   Bootstrap                      Normal-based
>         tvas |      Coef.   Std. Err.      z    P>|z|   [95% Conf.
>  Interval]
>  -------------+----------------------------------------------------------
>  ----
>  _eq1         |
>          age |  -.0417141   .1664602    -0.25   0.802    -.36797
>  .2845418
>  <snip >
>  onsetsever~y |  -.4387078   .7729467    -0.57   0.570  -1.953655
>  1.07624
>        _cons |   15.74078   7.812418     2.01   0.044   .4287244
>  31.05284
>  -------------+----------------------------------------------------------
>  ---
>  _eq2         |
>        _bs_1 |   .8501516    .053571    15.87   0.000   .7451544
>  .9551488
>        _bs_2 |   3.801854   .5107574     7.44   0.000   2.800788
>  4.80292
>  ------------------------------------------------------------------------
>  ----
>
>  . estat boot , bca percentile
>  last estimates not found
>
>  This seems to follow the help file, but I'm mystified.
>
>  Tony
>
>  Peter A. Lachenbruch
>  Department of Public Health
>  Oregon State University
>  Corvallis, OR 97330
>  Phone: 541-737-3832
>  FAX: 541-737-4001
>
>
>
>
>  *
>  *   For searches and help try:
>  *   http://www.stata.com/help.cgi?search
>  *   http://www.stata.com/support/statalist/faq
>  *   http://www.ats.ucla.edu/stat/stata/
>


-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index