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

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

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.

-
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. –  mpiktas Jul 28 '11 at 6:50
@mpiktas 'calculate some metric which says how close your red curve is to the black curve.' But what metric and how? –  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.
Of course I am in R. Will look into approx() and get back to you. –  Noble P. Abraham Jul 28 '11 at 10:39