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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: strange behavior of bootstrap over my ado file


From   Benjamin Villena <b_villena@yahoo.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
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,

Benjamin

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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