2
$\begingroup$

I have an $(x,y)$ dataset consisting of points on an unknown curve and I've been using spline fits to generate a curve joining these points as a guide-to-the-eye (and nothing more). However, I also know $dy/dx$ at each of my points, and so I know that the spline fit is not ideal: e.g. I know that there's a maxima at one point and a minima at another, and the spline fit is misleading at these points.

What kind of curve fitting should I use if I want to also incorporate this extra information? I have access to Matlab, Mathematica, R and anything open source. Suggestions for even just a place to start reading would be much appreciated. Thank you.

Edit: the only thing that I have thought of is to manually make additional points either side of my "real" points at $x+dx$ and $x-dx$, and then use this new set of points to generate the spline, but this seems a little dubious to me.

$\endgroup$
5
  • $\begingroup$ Are you doing interpolating splines or smoothing/penalized splines or regression splines? (You can specify derivative information, it effectively provides linear constraints on the coefficients.) $\endgroup$
    – Glen_b
    Apr 30, 2013 at 0:43
  • $\begingroup$ Cubic spline interpolation, I believe: it's an in-built feature in the graphing package I'm using. I'm not exactly clear on what the difference is between smoothing/penalized and regression splines. Is there a specific implementation of these that you would recommend? $\endgroup$
    – Matthew
    Apr 30, 2013 at 10:44
  • $\begingroup$ That's a tall order for a comment reply! Here goes: I'm not sure how we're going to be able to input the necessary constraints to an inbuilt graphics feature. (Is there a sense in which cubic spline interpolation is actually a stats problem rather than say a numerical analysis one?). Regression splines are where you prespecify a set of knots and generate regression predictors to fit the spline (as in R's cs and ns functions), while smoothing splines place a knot at every data point and then impose a smoothness penalty on the fit to regularize... (ctd) $\endgroup$
    – Glen_b
    Apr 30, 2013 at 22:41
  • $\begingroup$ (ctd) ... that is, the LS problem converts to optimizing $\sum_{i=1}^n (Y_i - \hat\mu(x_i))^2 + \lambda \int_{x_1}^{x_n} \hat\mu''(x)^2 \,dx$ where $\lambda$ acts as a tuning parameter that allows you to choose the tradeoff between fit and smoothness. Penalized splines are basically the same thing, but where fewer than $n$ knots are initially chosen. Smoothing splines have a very close connection to older ideas like Whittaker-Henderson smoothing. ...(ctd) $\endgroup$
    – Glen_b
    Apr 30, 2013 at 22:45
  • $\begingroup$ (ctd)... In R you can fit smoothing splines using smooth.spline and there are R packages that will do penalized splines. I'm not aware of any issues that would lead me to recommend one software package's implementation of any of these over another one - all the ones I've used at various times seemed to do the job. $\endgroup$
    – Glen_b
    Apr 30, 2013 at 22:49

3 Answers 3

1
$\begingroup$

See the R package cobs here. Specifically, the pointwise argument to the main function cobs() allows you to set constraints on points the spline should pass through as well as derivatives. In this case

cobs(x, y, pointwise=rbind(c(2, x_1, <derivative at x_1>), <etc>))

should be what you want.

$\endgroup$
0
1
$\begingroup$

(Hoermann and Leydold 2003) provide one application of such a problem with a discussion of an algorithm. In this case we have points on a CDF and a PDF, and we want to write the CDF as an interpolating spline and use the fact that the PDF gives the first derivatives of the CDF. Moreover, it also includes the constraint that a CDF is never decreasing. In this case the purpose is to invert the CDF to get an approximation of the quartile function. This is pretty specific, but it may give you enough inspiration to solve your problem.

Hoermann, Wolfgang and Leydold, Josef. (2003). Continuous random variate generation by fast numerical inversion. ACM Transactions on Modeling and Computer Simulation, 13(4): 347--362.

$\endgroup$
1
  • $\begingroup$ I've looked up the paper and it seems a bit involved; I was hoping for a function already implemented in a popular software package somewhere, especially because the curve fit I'm hoping for is only going to be for illustrative purposes. $\endgroup$
    – Matthew
    Apr 30, 2013 at 10:47
0
$\begingroup$

Here are two papers that deal with this exact problem. They use support vector regression instead of splines:

  1. Lázaro et al. "Support vector regression for the simultaneous learning of a multivariate function and its derivatives." Neurocomputing 69.1 (2005): 42-61. http://gtas.unican.es/pub/68

  2. Jayadeva et al., "Regularized Least Squares Twin SVR for the Simultaneous Learning of a Function and its Derivative," 2006 International Joint Conference on Neural Networks (IJCNN), pp.1192,1197 http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=1716237&isnumber=36115

Nevertheless, it seems unlikely that there is a popular implementation of any of such methods, as it's a quite specific problem.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.