Re: [R] Bug in lowess

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 12 Oct 2006 - 11:43:11 GMT

On Thu, 12 Oct 2006, Gavin Simpson wrote:

> On Wed, 2006-10-11 at 22:29 -0500, Frank E Harrell Jr wrote:
>> x <- c(0,7,8,14,15,120,242)
>> y <- c(122,128,130,158,110,110,92)
>>
>> lowess(x,y)
>>
>> $x
>> [1] 0 7 8 14 15 120 242
>>
>> $y
>> [1] 122.0000 128.0000 132.2857 158.0000 110.0000 -4930.0000
>> 110.0000
>
> Same behaviour here on a more recent R (below), and I recall a posting
> for a year or so back that reported similar behaviour in the then
> current version of R.

Actually, it is system-dependent as I get (on x86_64)

> lowess(x,y, iter=3)
lowess(): ns = 4

    cmad =      0.25589
    cmad =            0
    cmad =   0.00583385

$x
[1] 0 7 8 14 15 120 242

$y
[1] 128.0000 128.0000 132.2857 158.0000 110.0000 109.9990 110.0000

having turned DEBUG_lowess on. So the issue is finite-precision arithmetic, once again.

It seems rather a moot point as to what the right answer actually is here, and even if that found by Frank is indeed wrong, as lowess() is defined by an algorithm. Perhaps the best one can hope for is a good approximation to what the algorithm would give in infinite-precision arithmetic (having defined what should happen if cmod is zero).

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-help@stat.math.ethz.ch mailing list
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.
Received on Thu Oct 12 21:48:38 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 12 Oct 2006 - 13:30:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.