Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Question about programming using bootstrap

From   "feldman" <>
Subject   st: Question about programming using bootstrap
Date   Thu, 15 Sep 2005 07:04:00 -0700

I have a question about how to bootstrap a set of variables
using a single
command. More specifically what I am interested in doing is
the following.
I create a program that estimates a scalar for a set of
variables defined
in varlist. I then want to bootstrap that program to obtain
the standard
errors of each one of the scalars. Nevertheless, I canít
find a way to tell
Stata to do this using a single command for bootstrap. Below
is the
relevant part of the code that I am using. I get the
bootstrapped standard
errors but in a very inefficient way because Stata repeats
the bs command
for each one of the variables in varlist and that can be
extremely time
consuming. I want to do this with a single bs command. 


P.S. My apologies if this message is repeated. I sent it
before from another email account (twice) but it didnít
went through after more than 12 hours. 

program define desc
foreach var of local varlist {
scalar mg`var' = sg`var' - s`var'

foreach var of local varlist {
set seed  5432198
bs "desc `varlist' " mg`var'=mg`var' , rep(`rep')

Alejandro Lopez-Feldman
Ph.D. Candidate
Agricultural and Resource Economics

*   For searches and help try:

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