Is it possible to fit a data curve to another data curve?

Please see this plot

enter image description here

I do not have the model for the black data curve or I don't want to model it. But I want to see how the red data curve fits/matches with the black one. Is it possible? I am looking for a non-parametric solution or a solution that can be arrived at even without plotting the two curves.

  • 2
    $\begingroup$ Fitting process usually involves some kind of optimisation, so if you red-curve has some parametric expression, then yes you can fit it, using non-linear least squares for example. If the red curve is fixed then you can only calculate some metric which says how close your red curve is to the black curve. $\endgroup$ – mpiktas Jul 28 '11 at 6:50
  • $\begingroup$ @mpiktas 'calculate some metric which says how close your red curve is to the black curve.' But what metric and how? $\endgroup$ – Noble P. Abraham Jul 28 '11 at 10:36

It sounds like you want a goodness-of-fit measure. One possibility is the area between the curves. That is $$ \int \left|f(x)-g(x)\right| dx $$ where $f(x)$ is the black curve and $g(x)$ is the red curve.

Since you only appear to know the curves at discrete points, you will probably need to interpolate between the points in order to estimate the integral. It appears that you are working in R, so the approx() function may be useful for the interpolation.

  • $\begingroup$ Of course I am in R. Will look into approx() and get back to you. $\endgroup$ – Noble P. Abraham Jul 28 '11 at 10:39
  • $\begingroup$ Think I should have said, I am actually looking at the sampling effects. Both the curves follow the same model, but with different pattern of sampling; one is uniformly sampled (Black) and other is sparsely sampled (Red). By fitting, I want to see how sparse a curve can get to match the shape/period with that of the reference one (Black). Will you still suggest interpolation? $\endgroup$ – Noble P. Abraham Jul 29 '11 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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