Bookmark and Share

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


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

Re: st: strange behavior of bootstrap over my ado file


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: strange behavior of bootstrap over my ado file
Date   Mon, 29 Apr 2013 10:36:56 +0100

Don't do that then!

A bit more positively: You at least have three strategies here.

0. You rewrite your program to avoid the unusual syntax.

1. You can try working out what -bootstrap- is doing given your
unusual syntax, but although that might be quite interesting, I can't
see that it would help much. I wouldn't try cloning -bootstrap- and
rewriting whatever part is misinterpreting your command. That's
unlikely to be quick and you could easily mess things up. Indeed, the
problem might lurk at a much lower level: it's possibly deep within
Stata that one of your characters is being misinterpreted.

2. You might consider writing a wrapper for your program that hides
its syntax from -bootstrap-. I can't judge how feasible that is for
you, but my instinct points that way.

Nick
[email protected]


On 29 April 2013 04:19, Benjamin Villena <[email protected]> wrote:
> 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/
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index