Hello dear R developers,

# Bellow is an added method to lines to make the plotting of loess
consistent with what we get when using lines on lowess (which is also, IMHO,
more "intuitive")

lines.loess <- function(object,...)
{
# object: a loess object to plot using lines
# ...:  passes to lines

ss <- order(object$x)
lines(object$fitted[ss] ~ object$x[ss],...)
}


# example of why this is useful:
set.seed(134)
y <- rnorm(100)
x <- rnorm(100)
plot(y~x)
lines(lowess(y~x), col = 1, lwd = 3)
lines.default(loess(y~x), col = 2)
lines.loess(loess(y~x), col = 3, lwd = 5)
legend("topright", legend = c("lines.default", "lines.loess", "lines for
lowess"), fill = c(2,3,1))




Best,
Tal Galili

----------------Contact
Details:-------------------------------------------------------
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to