Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: strange behavior of bootstrap over my ado file

From   Benjamin Villena <>
To   "" <>
Subject   st: strange behavior of bootstrap over my ado file
Date   Sun, 28 Apr 2013 20:19:15 -0700 (PDT)

Dear Statalist,
I wrote an ado file which basically does the following
(1) Estimate a linear model  - reg w x z - 
(2) Generate a fitted value for w, let's call it w_hat
(3) Estimate a linear system of equations using 
- reg3 ( y1 = x w_hat) ( y2 = x w_hat) ( y3 = x w_hat), 3sls -

My goal is to provide bootstraped standard errors that can correct for the sampling error introduced when I use w_hat. 
While the ado file works fine if I run it for a single model estimation, it crashes when I use it with the bootstrap prefix.

The syntax of my program is a bit unusual. A typical command line looks like this
- newreg3  ( y1 = x #w) ( y2 = x #w) ( y3 = x #w) <w = x z>, 3sls -
The program interprets the sentence inside <> as the one for the generated regressor. 
I also use # to mean that is the variable to be replaced by the first-stage fitted value. 
The command line above works just fine. However, if I try to get bootstrapped errors, by doing
- bootstrap, reps(50); newreg3  ( y1 = x #w) ( y2 = x #w) ( y3 = x #w) <w = x z>, 3sls -

the program crashes.

The main problem seems to be that the bootstrap routine does not work well with my notation using <> to signal a first stage. 
When looking at the code when running (using set trace on) I see that the bootstrap routine seems to introduce 
a symbol "(" before "<". I have no idea how that "(" symbol gets in there. As I mention, it only happens when 
I'm running a bootstrap routine. Standard estimation works fine.
It is something essentially flawed with my programming approach? I would appreciate any possible clue to solve this problem.

Thanks in advance,


*   For searches and help try:

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