From pelzc at ohsu.edu  Mon May 23 20:35:23 2005
From: pelzc at ohsu.edu (pelzc@ohsu.edu)
Date: Mon May 23 20:35:28 2005
Subject: [Rd] lowess output looks wrong (PR#7891)
Message-ID: <20050523183523.63C638D38@slim.kubism.ku.dk>

Full_Name: Carl Pelz
Version: 2.1.0 & 2.0.1
OS: Windows 2000
Submission from: (NULL) (137.53.64.158)


# Paste this all into an R session for a graphical demonstration of BUG...
# I?ve found a bug in lowess in R versions 2.0.1 & 2.1.0 (Windows binary
versions).
# Running on Windows 2000 system.
# Someone noticed a similar problem and reported it under ID 4459.

# Data to reproduce...
R <- c(3.0, 3.5,  4.5,  5.0,  10.0)
T <- R
T <- 1.5*T + 0.1*(T^2)

# Bug in lowess (third y value is wrong in lowess output)...
xin <- log2(R)
yin <- log2(T)
minVal <- min (xin, yin)
maxVal <- max (xin, yin)
plot (xin, yin, xlim=c(minVal, maxVal), ylim=c(minVal, maxVal))
lines (lowess(xin, yin, f = 2/3, iter = 3))
text(3.5, 2, "3rd lowess point is wrong.", col="red")
text(3.5, 1.75, "Click for next graph.", col="red")
locator (n=1, type="n")

# lowess OK...
xin <- log2(R)
yin <- log2(T)
minVal <- min (xin, yin)
maxVal <- max (xin, yin)
plot (xin, yin, xlim=c(minVal, maxVal), ylim=c(minVal, maxVal))
# f = 1/2
lines (lowess(xin, yin, f = 1/2, iter = 3))
text(3.5, 2, "OK with f = 1/2.", col="red")
text(3.5, 1.75, "Click for next graph.", col="red")
locator (n=1, type="n")

# lowess OK...
xin <- log2(R)
yin <- log2(T)
minVal <- min (xin, yin)
maxVal <- max (xin, yin)
plot (xin, yin, xlim=c(minVal, maxVal), ylim=c(minVal, maxVal))
# iter = 0
lines (lowess(xin, yin, f = 2/3, iter = 0))
text(3.5, 2, "OK with iter = 0.", col="red")
text(3.5, 1.75, "Click for next graph.", col="red")
locator (n=1, type="n")

# Bug in lowess (forth y value is wrong in lowess output)...
xin <- log2(R)
yin <- log2(T)
# Change xin[3]
xin[3] <- 2.2
minVal <- min (xin, yin)
maxVal <- max (xin, yin)
plot (xin, yin, xlim=c(minVal, maxVal), ylim=c(minVal, maxVal))
lines (lowess(xin, yin, f = 2/3, iter = 3))
text(3.5, 2, "4th lowess point is wrong.", col="red")
text(3.5, 1.75, "Done.", col="red")


[Rd] lowess output looks wrong (PR#7891)
pelzc@ohsu.edu