Thanks for all the ideas.  splinefun looks like the simplest way to
achieve what I need:

> x <- 1:10
> y <- x^2
> f <- splinefun(x,y)
> f(3,deriv=0)
[1] 9
> f(3,deriv=1)
[1] 6
> f(3,2)
[1] 2
> f(3,3)
[1] -3.330669e-16

The fda package has a function bsplineS which does nearly the same
thing, and the SemiPar solution looks good for irregular x and y
values, but the built-in function seems to work for my purposes.

______________________________________________
R-help@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.

Reply via email to