Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

st: Program syntax for svy bootstrap or bs4rw

From   Mark McGovern <>
Subject   st: Program syntax for svy bootstrap or bs4rw
Date   Fri, 22 Jun 2012 12:59:45 -0400

Dear all,

I am attempting to write a simple program for a bootstrap in which
predicted values (random effects) are estimated in a first stage and
then used in a heckman selection model in the second.

This works fine when I use the standard bootstrap command, however I
am using survey data and would like to account for this with SVY as
discussed on this list previously.

I have tried to meet the syntax requirements for SVY as outlined in
the programming manual, and have tried various additions but I am
having trouble with the program. I noted the discussion on and also
tried the bs4rw command. I would appreciate your advice. I am using
Stata 12 MP.

Here is a simple illustration with the NHIMES data. I find that the
same sample is used in each bootstrap.

I svyset the data and run the command (with just 5 replications for testing).

webuse nmihs_bs
svyset _n [pweight=finwgt], bsrweight(bsrw1-bsrw5) vce(bootstrap)

program define test1, eclass properties(svyb)
syntax [if] [pw iw] [, NULLOPT]
xi:reg age race
capture drop re1
predict re1
xi:reg birthwgt re1
ereturn local cmd="test1"

svy : test1

bs4rw , rw(bsrw1-bsrw5) noisily: test1 [pweight=finwgt]


*   For searches and help try:

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