Skip to content
Prev 4268 / 63424 Next

bug in spline()? (PR#653)

imsw@holyrood.ed.ac.uk writes:
I think the `interpSpline' function in the splines package gives the
desired natural interpolation spline.  Perhaps we should change the
underlying code for the spline function.

 > library(splines)
 > x <- c(2,5,8,10)
 > y <- c(1.2266,-1.7606,-0.5051,1.0390)
 > ns1 <- interpSpline(y ~ x)
 > plot(ns1)   # gives a plot that looks reasonable
 > points(x,y)
 > predict(ns1, 1:10)
 $x
  [1]  1  2  3  4  5  6  7  8  9 10

 $y
  [1]  2.5758923  1.2266000 -0.0834080 -1.1577100 -1.7606000 -1.7349409
  [7] -1.2378717 -0.5051000  0.2669514  1.0390000

 attr(,"class")
 [1] "xyVector"
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._