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, **statalist.org** is already up and running.

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

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 njcoxstata@gmail.com On 29 April 2013 04:19, Benjamin Villena <b_villena@yahoo.com> 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/

**References**:**st: Latent Growth model and mixed effects random slopes model - equivalent ?***From:*W Robert Long <W.R.Long@leeds.ac.uk>

**st: strange behavior of bootstrap over my ado file***From:*Benjamin Villena <b_villena@yahoo.com>

- Prev by Date:
**Re: st: Rolling regression based on trading days** - Next by Date:
**Re: st: Rolling regression based on trading days** - Previous by thread:
**st: strange behavior of bootstrap over my ado file** - Next by thread:
**st: Egen to sum across rows (with an if across rows)** - Index(es):