[R] Inquiry about bandwidth rescaling in Ksmooth

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Thu Oct 26 20:19:56 CEST 2023

Apologies in advance if my comments don't help, in which case, no need
to respond,  but I noted in ?ksmooth:

the bandwidth. The kernels are scaled so that their quartiles (viewed
as probability densities) are at ± 0.25*bandwidth." So, could this be
a source of the discrepancies you cited?

Given that ?ksmooth explicitly says:

This function was implemented for compatibility with S, although it is
nowhere near as slow as the S function. Better kernel smoothers are
available in other packages such as KernSmooth."

One wonder why you bother with it at all? (That was rhetorical -- do
not answer).


On Thu, Oct 26, 2023 at 11:06 AM Jan Failenschmid via R-help
<r-help using r-project.org> wrote:
> Dear Sir, Madam, or to whom this may concern,
> my name is Jan Failenschmid and I am a Ph.D. student at Tilburg University.
> For my project I have been looking into different types of kernel regression estimators and corresponding R functions.
> While comparing different functions I noticed that stats::ksmooth returned different estimates for the same bandwidth
> as other kernel regression estimators that should be equivalent (i.e. the local polynomial estimators KernSmooth::locpoly and
> locpol::locpol with degree 0). However, when optimizing the bandwidth of ksmooth separately using the same loss function, I find comparable estimates to the other two estimators for a (larger) different bandwidth. To confirm this, I wrote my own Nadaraya-Watson kernel regression estimator, which is consistent with the two local polynomial estimators and shows the same discordance with ksmooth.
> This led me to the suspicion that the bandwidth that is passed to kmooth is rescaled or transformed within the function. Unfortunately, I was not able to confirm this with either the code of the function or the documentation. It would be of great help to me if you could clarify this for me.
> Thank you very much for your time and help in advance.
> Kind regards,
> Jan Failenschmid
>         [[alternative HTML version deleted]]
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list