# Re: st: variable selection and bootstrap

 From Tim Wade To statalist@hsphsun2.harvard.edu Subject Re: st: variable selection and bootstrap Date Sun, 22 Mar 2009 21:59:55 -0400

```I wonder if something like this is what you are trying to do:

sysuse auto.dta
bootstrap _b[mpg]: stepwise, pr(0.1) lockterm1: regress  price mpg
rep78 headroom trunk weight length turn displacement gear_ratio

(running stepwise on estimation sample)

Bootstrap replications (50)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
..................................................    50

Bootstrap results                               Number of obs      =        69
Replications       =        50

command:  stepwise, pr(0.1) lockterm1 : regress price mpg rep78
headroom trunk weight length turn displacement gear_ratio
_bs_1:  _b[mpg]

------------------------------------------------------------------------------
|   Observed   Bootstrap                         Normal-based
|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_bs_1 |  -106.7122   94.63724    -1.13   0.259    -292.1978    78.77339
------------------------------------------------------------------------------

if you are interested in the effect of mpg on price, then you would
need to lock this term since each run of the stepwise procedure on the
bootstrapped sample would give you a different set of terms that meet
the stepwise criteria and the effect of interest, in this example,
mpg, would not be guaranteed to be in every sample

Tim

On Sat, Mar 21, 2009 at 5:51 PM, aegl <aegl@orange.fr> wrote:
> Hello,
>
> I need to run a logistic regression including several X variables . I
> therefore plan to use backwards selection to select the best predictors and
> I have read that it is possible to combine this approach with boostrap.
> I have tried using the following syntax :
>
> stepwise, pr(.10): logistic Y  X1 X2 X3 X4 X5 X6 X7, vce(bootstrap)
>
> This gives a result that is different from using an alternative approach:
> first running the backwards selection on the original sample, and then using
> the bootstrap to compute the CIs.
>
> Does anybody know what I am doing by using this syntax ? Is there another
> way to run backwards selection procedures with bootstrap ?
>
> Thank you very much for any input.
>
> Joel Rebloch'
> Data analyst
> Grenoble, France
>
>
>
>
>
> *
> *   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/
>

*
*   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/
```