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

# RE: st: Rule-of-thumb bandwidth in lpoly

 From "Hasan, Syed" To Subject RE: st: Rule-of-thumb bandwidth in lpoly Date Fri, 18 May 2012 20:24:07 +1000

```Hi Nick
Thanks a lot. I was also thinking about going for spline.

Kind regards
Syed Hasan, CBE, ANU

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Friday, 18 May 2012 7:49 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Rule-of-thumb bandwidth in lpoly

I don't think looking at the code will help you in this case. The
default bandwidth appears to be calculated inside the Mata function
you name and its source code is I think not bundled with Stata. But
the manual entry does explain as I recall. (At this moment, I do not

Tastes differ, greatly, and this is partly irrelevant to your
question, but I've often found it difficult to get genuinely smooth
curves that are physically(*) plausible out of -lpoly- and I tend to
go for spline or fractional polynomial smooths. This is partly
relevant, because the default bandwidths often don't work well and you
need to choose your own, which is one reason why one tends to get
curious about how bandwidth is handled any way.

(*) In your case, substitutely economically, biomedically, or whatever

Nick

On Fri, May 18, 2012 at 10:14 AM, Hasan, Syed <syed.hasan@anu.edu.au> wrote:
>
> The command lpoly calculates a rule of thumb (ROT) bandwidth, when it is
> not specified. I am trying to understand the ROT bandwidth calculation.
> Looking at the lpoly.ado file (185-221 line) I found the following
>
>        if `"`bwidth'"' == "" {
>                qui gen byte `bw'= 0
>        }
>        else {
>      ...................................................
>                }
>                qui gen double `bw' = `bwidth' if `tousegrid'
>        }
>
> In addition, in 305-306 line, I found the following
>
>        mata: _lpoly_work(`degree',`pwidth', `l', `u', ///
>                          `doSE', &_lpoly_`kernel'(), `savevar')
>
> I am not sure what it is doing.I am new is STATA programming and
> appreciate any help.

*
*   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/
```