Re: [R] Connect observed values by a smooth curve, is there any method to get coordinate value of arbitrary point on the curve?

From: Zhipeng Wang <wangz_at_kuhp.kyoto-u.ac.jp>
Date: Sat, 02 Apr 2011 00:21:28 +0900

Dear Prof. Murdoch and Dr. Winsemius,

Thank you very much for your suggestion. They were big help. One of my friends told me another approach by using "smooth.spline". Here is the code:

x <- c(1,2,3,4,5,6)
y <- c(1,4,9,16,25,36)
sp <- smooth.spline(x,y)
x <- seq(1, 6, length=100)
pred <- predict(sp, x)
real <- x^2
err <- real - pred$y
cbind(pred$x, pred$y, real, err)
plot(pred)

Thank a lot. Have a nice weekend :)

Wang Zhipeng

        [[alternative HTML version deleted]]



R-help_at_r-project.org 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 Fri 01 Apr 2011 - 15:24:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 01 Apr 2011 - 15:40:26 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.

list of date sections of archive