Skip to content
Prev 386798 / 398502 Next

Problem with a LOESS curve

Your x values aren't in increasing order.  When you plot lines(x, yfit), 
it joins the points in the order you give them, which jumps back and 
forth.  To fix, try

o <- order(x)
lines(x[o], yfit[o], col="green", lwd=2)

Duncan Murdoch
On 09/01/2021 2:58 p.m., varin sacha via R-help wrote: