Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site yale-comix.UUCP Path: utzoo!linus!decvax!yale-comix!leichter From: leichter@yale-comix.UUCP (Jerry Leichter) Newsgroups: net.math,net.ai,net.research Subject: Re: Best fitting curve Message-ID: <4061@yale-comix.UUCP> Date: Mon, 25-Jun-84 14:40:06 EDT Article-I.D.: yale-com.4061 Posted: Mon Jun 25 14:40:06 1984 Date-Received: Tue, 26-Jun-84 06:25:14 EDT References: <375@sjuvax.UUCP>, <1970@sdccsu3.UUCP> Organization: Yale University CS Dept., New Haven CT Lines: 40 The notion of a "best fitting curve" through some points has no inherent meaning. You have to specify what kinds of curves you are willing to allow, what kind of constraints you want to put on them, and what kind of measurement of "fit" you are interested in. Given n points in the plane, in general there is a unique (n-1)st degree poly- nomial that passes through those points. (Hence, there are infinitely many nth degree polynomials, one for every other point in the plane that you can consider to be an (n+1)st point.) Such a polynomial is "best" in the sense that it has 0 error at every point specified. It is almost certainly not what you would want for fitting data; it will generally oscillate between your data points and will have uncontrollable behavior outside the range in which your data points occur - i.e., the curve will not look at all "smooth" to the eye. Even if you want a curve that "looks good", you can use a cubic (or higher-order) spline curve. This is a curve defined by fitting together polynomials; you take the first 4 points in order, pass a cubic through them, take the last two and the next one, pick a cubic through those that has the same derivative at the 4th point as the first cubic, etc... (There are many other ways to choose spline curves. This particular method passes through all the points; in some cases, "smoothness" of some sort may be more important than actually touching the points, so some kinds of splines don't even pass through the given data points. All spline curves are piece- wise defined polynomials; there is no simple algebraic formula that defines them; rather, there is a series of such formulas, one for each range of input values.) If the goal of "best fit" is to produce good interpolated values for a function, rather than a curve that "looks" like it is determined by the points, all sorts of other techniques exist. For example, a Chebyshev approximation will have the least maximum error (assuming a model in which you are approximating some known, complex function by choosing some representative points on it and an approximating polynomial.) However, least maximum error is not the same as least average absolute error, or least RMS error, or... So, in summary: If you give me three points, I can write down pretty much ANY function and find some way to defend it's being the "best fit" to the three given points. You will have to specify your goals more precisely. -- Jerry decvax!yale-comix!leichter leichter@yale