Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

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.

share|improve this question
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

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
Of course I am in R. Will look into approx() and get back to you. –  Noble P. Abraham Jul 28 '11 at 10:39
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? –  Noble P. Abraham Jul 29 '11 at 5:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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