RE: st: confidence intervals for locpoly

 From "Martin Weiss" <[email protected]> To <[email protected]> Subject RE: st: confidence intervals for locpoly Date Mon, 25 Jan 2010 21:02:21 +0100

```<>

The function was introduced in Stata 11, see -help whatsnew10to11-

HTH
Martin

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Sharooon
Sent: Montag, 25. Januar 2010 20:55
To: [email protected]
Subject: Re: st: confidence intervals for locpoly

This works right until the end when I get the error message:

. egen ub = rowpctile(yhat? yhat?? yhat???), p(97.5)
unrecognized command:  _growpctile

I couldn't find rowpctile, so I'm guessing this is pctile, which also doesn't work. I enjoyed your FAQ by the way. Thanks.

--- On Mon, 1/25/10, Maarten buis <[email protected]> wrote:

> From: Maarten buis <[email protected]>
> Subject: Re: st: confidence intervals for locpoly
> To: [email protected]
> Date: Monday, January 25, 2010, 4:38 AM
> --- On Mon, 25/1/10, Sharooon wrote:
> > I can't get the bootstrap to work with locpoly.
>
> If you are using a program that is not part of official
> Stata, then the
> Statalist FAQ askes you to specify where you got. I am
> assuming you are
> using the updated version that appeared in the Stata
> Journal 6(4) (,which
> I found by typing -findit locpoly).
>
> Below is an example on how to do that. However, you'll want
> on whether the simple bootstrap is appropriate in your
> case, for example
> Chapters 8 and 9 of Efron and Tibshirani (1993). Still,
> even if it
> doesn't produce meaningfull standard errors/confidence
> intervals, it can
> be used to asses the stability of your estimates, as
> discussed by
> Royston and Sauerbrei in the latest Stata Journal.
>
> *----------------- begin example ------------------
>
> sysuse auto, clear
> locpoly mpg weight, nograph  ///
>         degree(3) width(500) ///
>         generate(xgrid yhat_obs)
>
> keep if xgrid <.
> keep xgrid yhat_obs
> tempfile tofill
> sort xgrid
> save `tofill'
> gen id = _n
> keep id xgrid
> sort id
> tempfile grid
> save `grid'
>
> forvalues i = 1/500 {
>     qui {
>         sysuse auto, clear
>         bsample
>         gen id = _n
>         sort id
>         merge id using
> `grid'
>         drop _merge
>
> locpoly mpg weight,      ///
>
> degree(3) width(500) ///
>
> generate(yhat`i')    ///
>
> at(xgrid) nograph
>         keep if xgrid < .
>         keep xgrid yhat`i'
>         sort xgrid
>         merge xgrid using
> `tofill'
>         assert _merge == 3
>         drop _merge
>         sort xgrid
>         save `tofill',
> replace
>     }
>     _dots `i' 0
> }
> use `tofill'
> egen lb = rowpctile(yhat? yhat?? yhat???), p(2.5)
> egen ub = rowpctile(yhat? yhat?? yhat???), p(97.5)
> twoway rarea lb ub xgrid || line yhat_obs xgrid
> *------------------ end example ---------------------
> ( For more on how to use examples I sent to statalist see:
>  http://www.maartenbuis.nl/stata/exampleFAQ..html )
>
> Hope this helps,
> Maarten
>
> Bradley Efron and Robert J. Tibshirani (1993) An
> Introduction to the
> Bootstrap. Boca Raton: Chapman & Hall/CRC.
>
> Patrick Royston and Willi Sauerbrei (2009) Bootstrap
> assessment of the
> stability of multivariable models. The Stata Journal, 9(4):
> 547–570.
> http://www.stata-journal.com/article.html?article=st0177
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/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/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/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```