[Rd] error in ksmooth C code + patch (PR#1050)

htang@hpl.hp.com htang@hpl.hp.com
Mon, 13 Aug 2001 04:57:47 +0200 (MET DST)


Full_Name: Hsiu-Khuern Tang
Version: 1.3.0
OS: GNU/Linux (Debian unstable)
Submission from: (NULL) (192.6.19.190)


Hi!

    If

x <- 1:4
y <- 1:4
z <- ksmooth(x, y, x.points=x)

I get for z

$x
[1] 1 2 3 4

$y
[1] 1.0 1.5 2.0 3.0

    In this case, the default bandwidth (0.5) makes it so that the neighborhood
of any point of x.points contains only one point in x, so z$y should be equal to
y.  I think the error is in
ksmooth.c:

Replace
	  if(x[i] < x0 - cutoff) imin = i;

by
	  if(x[i] < x0 - cutoff) {imin = i; continue;}


Best,
Hsiu-Khuern.




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._