Pegah
Pegah

Reputation: 682

lowess fit curve in R

This code gives me the mean, but I don't know how to get the +1sd and -1 sd lines.

y<-lowess(x[,1],x[,2],f=0.01)

Thanks for your help.

Upvotes: 1

Views: 2119

Answers (1)

EDi
EDi

Reputation: 13280

Hmm, perhabs msir:::loess.sd() does what you want:

require(graphics)
plot(cars, main = "lowess(cars)")

require(msir)
low <- loess.sd(cars[ ,1], cars[ ,2])
lines(low$x, low$y)
lines(low$x, low$upper)
lines(low$x, low$lower)

enter image description here

Upvotes: 5

Related Questions