From fifis.himik at gmail.com  Wed Feb 21 00:17:09 2018
From: fifis.himik at gmail.com (=?UTF-8?Q?Andre=C3=AF_V=2E_Kostyrka?=)
Date: Wed, 21 Feb 2018 00:17:09 +0100
Subject: [Rd] Unwanted behaviour of bw.nrd: sometimes,
 zero is returned as a valid bandwidth
Message-ID: <CAHFGd_N0_ga6PuRDTmnV7AyRgrS6tC_xwvz+8x1uHicb4xMXjg@mail.gmail.com>

Dear all,

Sorry if I am posting to the wrong place, but I could not find the link for
registration on the bug tracker, that?s why I am writing here.

I think there is inconsistency between two R functions from the stats
package, bw.nrd0 and bw.nrd.

Consider the following vector:
D <- c(0, 1, 1, 1, 1)

bw.nrd(D) returns zero bandwidth for this object even without a warning.
Considering the fact that in most cases, one divides something by the
bandwidth, it is highly undesirable that these function return zero
bandwidth without a warning.

Contrast bw.nrd0: it has three failsafes. First, if the minimum of SD and
IQR/1.34 is 0, it tries three things: set the base multiplier to SD, or to
|x[1]|, or to 1.

In my opinion, bw.nrd should have either one of these failsafes or a
warning that the vanilla formula equals to zero and that the user should
try another method of bandwidth selection (just like bw.ucv warns if the
minimum occurred at one end). It would be better than suddenly discovering
NaNs or NAs without even knowing the possible cause.


--
Bien cordialement,  |  Yours sincerely,
Andre? V. Kostyrka.
http://kostyrka.ru, http://kostyrka.ru/blog

	[[alternative HTML version deleted]]



[Rd] Unwanted behaviour of bw.nrd: sometimes, zero is returned as a valid bandwidth
=?UTF-8?Q?Andre=C3=AF_V=2E_Kostyrka?=