Finding the Right Curve Fit: A Question About Curve Fitting

Click For Summary

Discussion Overview

The discussion revolves around the challenges and methodologies of curve fitting in data analysis. Participants explore various approaches to selecting appropriate mathematical functions for fitting data points, particularly when the underlying relationship is not immediately clear. The conversation includes both theoretical considerations and practical applications, touching on different types of curves and fitting techniques.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants suggest using splines, particularly cubic splines, as a flexible method for curve fitting.
  • Others argue that the choice of fitting function should depend on the underlying phenomena represented by the data, rather than purely mathematical considerations.
  • One participant mentions the possibility of breaking the curve into segments that can each be approximated by simpler functions, such as polynomials.
  • There is a suggestion to evaluate the confidence intervals for coefficients in linear and quadratic regressions to assess the fit's validity.
  • Some participants discuss the use of polynomial fitting that requires the curve to pass through specified data points while also controlling for slope and curvature at those points.
  • A participant notes the importance of distinguishing between deterministic data and data with a random component, as this affects the applicability of splines.
  • Bezier curves are mentioned as a method for generating smoothed curve fits, with some uncertainty about their behavior regarding data points.
  • One participant expresses interest in experimenting with Bezier splines on a small dataset to evaluate the fitting quality.
  • Another participant references "The NURBS Book" as a resource for B-spline interpolation techniques.

Areas of Agreement / Disagreement

Participants generally agree that there is no single correct method for curve fitting, and multiple competing views on the best approach remain. The discussion reflects a range of opinions on the appropriateness of various fitting techniques and the conditions under which they should be applied.

Contextual Notes

Some discussions highlight limitations related to the assumptions made about the data, the need for computational tools, and the potential absence of certain curve-fitting exercises in educational curricula.

fog37
Messages
1,566
Reaction score
108
Hello everyone,

A question about curve fitting. Hope you can share some helpful hints.

Given some data we plot a graph y versus x. How do we approach the problem from a curve fitting standpoint? For example, using Excel, if the data "looks" linear from the graph, we choose a linear fit and get a best fit line.
If the data looks "parabolic", we choose a quadratic fit, etc. But what if we have no idea of what fit may be the appropriate fit and the data distributes along a curve but the curve does not look like any familiar curve? What is the wise way to proceed?

Thank you.
Fog37
 
Physics news on Phys.org
Thank you! I will read up on splines today.
 
fog37 said:
Given some data we plot a graph y versus x. How do we approach the problem from a curve fitting standpoint?

There is no unique answer to that question. If the data represents some phenomena in the real world then you must consider what family of mathematical functions represent it using your knowledge of that phenomena. It isn't a question that can be answered just by considering pure mathematics.

If your goal is artistic (to create a pleasing curve) then, as Nidum suggests, splines of various types could be useful.
 
  • Like
Likes   Reactions: lavinia and symbolipoint
It might be impossible to find a good fitting function by hand. A solution is to cut up the curve in a lot of pieces, where each piece can be approximated by a simple curve (a polynomial or something familiar).
 
You may consider a linear fit and then look for the confidence interval for the coefficient m of x in y=mx+b. There is test for whether the coefficient is 0. Maybe you can do similar tests for coefficients in quadratic regressions. Usually, or at least often, lack of linearity has to see with interactions between the variables.
 
Stephen Tashi said:
There is no unique answer to that question. If the data represents some phenomena in the real world then you must consider what family of mathematical functions represent it using your knowledge of that phenomena. It isn't a question that can be answered just by considering pure mathematics.

If your goal is artistic (to create a pleasing curve) then, as Nidum suggests, splines of various types could be useful.
That is why students at colleges seem to be required to earn credit in College Algebra. By getting through THAT course, student has enough sense to perform some basic curve-fitting; and he never knows exactly when he may find some data which he may like to fit to a function. One problem about this is that, as I best remember, curve-fitting exercises may be missing from College Algebra courses - but the basic idea is there.
 
I've had some good results fitting polynomials where I not only require the curve to pass through the specified data points, but also specify slope and curvature at specific points. There are lots of option, but you have to apply what you know about the situation.
 
Dr.D said:
I've had some good results fitting polynomials where I not only require the curve to pass through the specified data points, but also specify slope and curvature at specific points. There are lots of option, but you have to apply what you know about the situation.
What do you use, Lagrange interpolation?
 
  • #10
I have used the Lagrange technique, but I have used a wide variety of other methods, some of them original with me.
 
  • #11
A lot depends on if the data is deterministic or has a random component. If there is no random component, then splines of a particular order can allow you to fit the data with a piecewise defined function that has smooth derivatives up to an order. If there is a random component, then it is possible that the same x value will have multiple y values. That rules out a direct application of splines. Some sort of statistical pre-process would have to be done before a spline can be used.
 
Last edited:
  • #12
fog37 said:
Hello everyone,

A question about curve fitting. Hope you can share some helpful hints.

Given some data we plot a graph y versus x. How do we approach the problem from a curve fitting standpoint? For example, using Excel, if the data "looks" linear from the graph, we choose a linear fit and get a best fit line.
If the data looks "parabolic", we choose a quadratic fit, etc. But what if we have no idea of what fit may be the appropriate fit and the data distributes along a curve but the curve does not look like any familiar curve? What is the wise way to proceed?

Thank you.
Fog37
Like you say, GRAPH the (x,y) points and decide what you see? Can you identify a type of equation that might fit? Pick the form of equation and set up a system of equations and try to find the unknown coefficients or other unknown values. You would probably what some computer power to help, and you would expect nonwhole constants to finish finding the equation or function which fits your data.
 
  • #13
Splines don't necessarily have to go through all of the data points .

Bezier curves

Essentially they generate the best smoothed curve fit to a set of data points .
 
  • Like
Likes   Reactions: FactChecker
  • #14
Nidum said:
Splines don't necessarily have to go through all of the data points .

Bezier curves

Essentially they generate the best smoothed curve fit to a set of data points .
Interesting. It looks like the curves will not go through any points except the endpoints of each curve. So, for instance, the 3 intermediate points of a quartic Bezier curve are just control points, not points on the curve, regardless of how well behaved the points are. I don't know how acceptable that would be for the OP. I have no experience with Bezier curves.
CORRECTION: Looking at @Nidum post below, it looks like the Bezier curve does go through the points (or close enough).
 
Last edited:
  • #15
Splines.jpg
 

Attachments

  • Splines.jpg
    Splines.jpg
    11.6 KB · Views: 633
  • Like
Likes   Reactions: FactChecker
  • #16
If anyone has a not too large data set (up to about 20 points) from some experiment I would be interested to see what sort of Belzier spline my CAD would generate and how good a fit it would actually be .
 
  • #17
If you're interested going the B-spline interpolation route, "The NURBS Book" by Piegl and Tiller has a few algorithms that I've personally used. They work well.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 26 ·
Replies
26
Views
3K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
1
Views
4K