[R]自然スプラインによるスプライン補間
splinefun関数を使う。Rの初期状態で使うことができる。以下、実行例。
> x <- c(1, 2, 4, 6, 8, 16)
> y <- c(0, 1, 2, 4, 3, 5)
> rfun <- splinefun(x, y, method = "natural")
> estx <- seq(min(x), max(x), length.out = 80)
> esty <- rfun(estx)
> plot(x, y)
> lines(estx, esty, col = "red")
splinefun関数のmethodオプションにnaturalを必ず指定すること。splinefun関数の戻り値は関数であり、スプライン補間による推定値の計算に使う。

