1

I am trying to fit curve using Spline.

As I studied it, knots and control points are important factor for making curve.

However functions which support to make spline curve, there is no argument on control points. (includes arguments on knots....)

Here functions that I want to use for curve fitting. bs and smooth.spline function in r.

bs (x, df = NULL, knots = NULL, degree = 3, intercept = FALSE, Boundary.knots = range(x))


smooth.spline (x, y = NULL, w = NULL, df, spar = NULL, cv = FALSE,
              all.knots = FALSE, nknots = .nknots.smspl,
              keep.data = TRUE, df.offset = 0, penalty = 1,
              control.spar = list(), tol = 1e-6 * IQR(x))

Could you explain the relationship between control points and knots?

And how can I determine appropriate number of knots, for my dataset? (coordinates data, cubic spline, want to make trail using spline)

The question might be naive, please answer for naive engineer.

Thanks.

Sujin Kwon
  • 11
  • 1
  • 1
    Is `bs()` from the `splines` package? Please always specify, when you loaded a package. – Stibu Mar 20 '16 at 13:54
  • Are you looking for something more like Bézier curves? https://cran.r-project.org/web/packages/bezier/index.html – Roman Luštrik Mar 20 '16 at 14:56
  • Knots are points which are lying on the spline curve. Control points are shaping the spline not being on the spline curve – Severin Pappadeux Mar 20 '16 at 15:32
  • @Stibu Yes. bs() from splines package. – Sujin Kwon Mar 20 '16 at 16:59
  • @SeverinPappadeux As I understood, I can handle curve depending on control points. In those functions that I mentioned, How do I reflecting control points? – Sujin Kwon Mar 20 '16 at 17:03
  • @SujinKwon the (apparent) fit on data will become better the more knots you set, which, however, leads to overfitting and bad fit for new data. What you want is penalized splines, but why would you want to do that manually, there are allready sophisticated functions available in R, that set up basis functions and estimate (penalized) splines – adibender Mar 20 '16 at 17:06
  • What is a problem you want to solve? Knots are frequently referred to b-splines. Smoothing cubic spline is another kind of splines. – MBo Mar 26 '16 at 15:17

0 Answers0