Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: STATA: multivariate probit w/ bootstrap


From   "Stas Kolenikov" <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: STATA: multivariate probit w/ bootstrap
Date   Thu, 1 May 2008 09:08:16 -0500

Fixing the seed looks like a very reasonable thing for those
procedures, and it explains the same bootstrap results, too. You can
contact the authors, or you can take a look at the  If that is the
case, the workaround is complicated, but possible.

First, you need to create the vector of the BOOTSTRAP seeds. I will
have them as a set of locals; styling can go around with values in a
variable or in a matrix:

local R = # of desired bootstrap replicates
local bcseed
forvalues r=1/`R' {
   local t = floor(1e6*uniform())
   local bcseed `bcseed' `t'
}

Then you would need to set your bootstrap manually:

postfile topost <a lo-o-o-ng list of coefficients to be saved, plus
likelihood ratios, or whatever else you want to collect> using
bstrap_mvprobit
tokenize `bcseed'
preserve
forvalues r=1/`R' {
   set seed ``r''
   bsample <whatever parameters for the bsample you might need... may be none>
   mvprobit () () ()
   post topost (_b[option1_1:option1]) ()  ... ()
   restore, preserve
}
postclose topost

I am not 100% sure the -post- statement will work as is; I remember it
wanting numbers rather than expressions, although my memories might
have been a few versions old. If so, you would need to convert all the
coefficients to locals, and then -post topost (`b1_1') (`b1_2') ... ()
-. It MIGHT thus be easier to set up as the matrix accumulation
problem, too, so that instead of the -post- mechanics, you would have:

mat BS_MVProbit = J(1, #parameters, .)
tokenize `bcseed'
preserve
forvalues r=1/`R' {
   set seed ``r''
   bsample <whatever parameters for the bsample you might need... may be none>
   mvprobit () () ()
   mat BS_MVProbit = BS_MVProbit \ e(b)
   restore, preserve
}

so in the end of the cycle you will have the matrix with the
bootstrapped coefficients. You can then -svmat- that to a data set.
Whether there's any way to trick Stata into understanding that you
really have done the bootstrap, and hence the bootstrap postestimation
commands can be used, I've no idea.

On 4/30/08, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --- "Daniel R. Petrolia" <Petrolia@agecon.msstate.edu> wrote:
>  >   I am trying to bootstrap using either 'mvprobit' or 'triprobit',
>  > but have been unsuccessful with both.  Using 'mvprobit', the
>  > bootstrap "works" (i.e., there are no errors reported), but it is
>  > reporting and saving identical coefficients for each bootstrapped
>  > sample (which implies that it is running mvprobit over the same
>  > sample).  When I use 'triprobit', the bootstrap returns the error
>  > message "too few variables specified", although it does indeed run
>  > the bootstrap for the requested number of reps; however, it reports
>  > one set of coefficients on the first sample, then a different set of
>  > coefficients on the second and all subsequent samples.
>
>
> My speculation would be this: These commands have in common that they
>  estimate the parameters using simulated maximum likelihood. So, these
>  estimates are in part due to a random simulation, and may thus result
>  in different estimates each time the command runs. It may be that the
>  authors liked to make sure that someone gets the same estimates if he
>  or she repeatly runs the same model on the same data. The way to do
>  that is to internally set the seed. This would interfere with
>  -bootstrap- because now each bootstrap sample will be exactly the same,
>  as the seed is reset to the same number each time a new bootstrap
>  sample is created.
>
>  The safest solution would be to contact the authors of these commands
>  to confirm that my speculation is correct, and if so, request that they
>  add an option, -noseed-, that will prevent these commands to set the
>  seed.
>

-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: Please do not reply to my Gmail address as I don't check
it regularly.
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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