[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: optimal bandwidth in Stata 8

From   "Benjamin Villena Roldan" <>
To   <>
Subject   RE: st: optimal bandwidth in Stata 8
Date   Mon, 15 Sep 2008 13:51:19 -0400

Thanks for the information, Nick
By the way I didn't mean that kernreg is a density estimation procedure.
Nadaraya-Watson implemented by kernreg also needs a choice of bandwidth. I
just wanted to know what kind of default bandwidth kernreg uses.

-----Mensaje original-----
[] En nombre de Nick Cox
Enviado el: Monday, September 15, 2008 1:21 PM
Asunto: RE: st: optimal bandwidth in Stata 8

I agree with Austin. Indeed I would underline his argument with further

First, bandwidth means different things w.r.t. different kernels because
the parameter for each that tunes bandwidth does not have the same
effect, as the kernels are defined quite differently, a point that is at
least tacit in the official documentation. 

Second, -kernreg- and -kernreg1- are both buggy; -kernreg2- is I believe
better. Use -findit- for locations. But unless you are using some
ancient Stata there is no reason whatsoever to use any rather than
-lpoly- or some other similar method implemented as an official command.
I no longer have access to Stata 8 but I believe the same point applies
there too. 

Third, -kernreg- and -kernreg1- and -kernreg2- are not density
estimation command. 


Austin Nichols

Benjamin Villena Roldan <> :
The Methods and Formulas section of the manual entry [R] kdensity is
quite clear: the default bandwidth is .9*N^(-1/5)*min(sd(x),
IQR(x)/1.349) which is not globally optimal in any sense. The Methods
and Formulas section of the manual entry [R] lpoly shows the formula
for the "asymptotically optimal constant bandwidth" used there (also
not globally optimal). You mention kernreg and kernreg1 which are not
official Stata, so you would have to read their help files, read the
ado code, or contact their authors for more detail.  The -locpoly-
command on SSC enjoys a special status; it is not official Stata but
is written by Stata staff (way before -lpoly- was introduced). If you
 view "";
in Stata, you will find the hilarious throwaway line:

If width() is not specified, then the "default" width is used; see [R]
kdensity.  This default is entirely inappropriate for local polynomial
smoothing.  Roll your own.

On Mon, Sep 15, 2008 at 12:01 PM, Benjamin Villena Roldan
<> wrote:

> I'm running some kernel density estimation in Stata 8.
> The help file asserts that the "optimal" width is used (bandwidth) to
do the
> kernel estimation. I searched in the internet, but I haven't found a
> description of the procedure used. Does anyone know the precise
meaning of
> "optimal" width? (Cross-validation perhaps?).
> Does anyone know if the same choice is used for kernreg and kernreg1?

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index