Statalist The Stata Listserver

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

Re: st: bootstrapped standard errors and noconstant

From (Jeff Pitblado, StataCorp LP)
Subject   Re: st: bootstrapped standard errors and noconstant
Date   Thu, 14 Jun 2007 15:23:09 -0500

Christian Thoeni <> is using -vce(bootstrap)- with
-regress- and needs the -noconstant- to prevent an indicator variable from
being dropped due to collinearity:

> I have a problem with bootstrapping and the noconstant option.
> consider the following example:
> clear
> set obs 50
> gen byte group=3Dmod(_n,10)
> sort group
> gen byte country=3D0
> replace country=3D1 in 26/50
> gen y=3Duniform()
> xi, noomit: reg y, noconstant  cluster(group)
> reg y country_0 country_1, noconstant  vce(boot, reps(10) cluster(group))
> the first regression includes all both dummies, while the second regres sion
> eliminates the dummy country_1.  The reason for this is unclear to me.  Is
> there a problem with the combination of noconstant and bootstrapping
> standard errors?

The -vce(bootstrap)- option is trying to report on variables that are removed
due to collinearity but isn't aware that the -noconstant- option was
specified.  We will have this fixed in the next update to Stata 9.

Johan Hellstrom <> replied that Christian could use
the -bootstrap- prefix to get around the problem in the mean time.


Johan Hellstrom <> also posted a program for use
with the -simulate- prefix to "simulate" what the -bootstrap- is doing:

> As a novice in Stata programming I wrote a short bootstrap program as an
> exercise from Cristian's question. I guess my code does the same thing as
> the bootstrap prefix (that was my intention by the way)? Does anyone have
> any corrections or comments?
> -----
> * Creating the dataset
> clear
> set obs 50
> gen byte group=mod(_n,10)
> sort group
> gen byte country=0
> replace country=1 in 26/50
> gen y=uniform()
> * Bootstrap program
> quietly xi, noomit: reg y, noconstant cluster(group)
>     matrix beta = e(b)
>     capture program drop boot_noc
>     program define boot_noc, rclass
>      preserve 
>       bsample
>       xi, noomit: reg y, noconstant cluster(group)
>       return list
>    restore
> end
> simulate,  reps(100) seed(12345): boot_noc
> bstat, stat(beta) n(50)
> estat bootstrap, all

Johan should move the -cluster(group)- option to -bsample-.

If Johan is interested in bootstrapping the clustered SEs or bootstrapping a
grouped estimator such as -xtreg- or -areg-, then the -idcluster()- option of
-bsample- should also be used.

The current example does not require the -idcluster()- option.

*   For searches and help try:

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