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: Rule-of-thumb bandwidth in lpoly
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: Rule-of-thumb bandwidth in lpoly
Date
Fri, 18 May 2012 10:48:57 +0100
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
have access to the manuals.)
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
fits your application.
Nick
On Fri, May 18, 2012 at 10:14 AM, Hasan, Syed <[email protected]> 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/