[Date Index]
[Thread Index]
[Author Index]
Re: fitting surface with Mathematica 6.0.3 and range of fitted values
*To*: mathgroup at smc.vnet.net
*Subject*: [mg99028] Re: fitting surface with Mathematica 6.0.3 and range of fitted values
*From*: Bill Rowe <readnews at sbcglobal.net>
*Date*: Fri, 24 Apr 2009 03:48:15 -0400 (EDT)
On 4/23/09 at 6:45 AM, simonematool at gmail.com wrote:
>I'm trying to fit a surface with a Fit command and a 4th order
>polynomial and I can get the fit and the model but then I try to
>evaluate some data through the model and they are out of the range of
>the original data, I have looked around but I could not find an option
>to pass into Fit command to keep the fitted values in the range of the
>possible cases.
The fact you get a result using Fit is meaningless since Fit
will always give you a result. But, there is no guarantee the
result will be useful or meaningful. Nor is there any way to
constrain the range of values returned by Fit for the fitted parameters.
=46it only solves the linear regression problem. The solution to
the linear regression problem can be expressed in closed form
and requires no initial estimate of the solution.
=46indFit accepts constraints on the fitted parameters.
Alternatively, you can write you own function to compute the sum
of squares or some other measure of goodness of fit and use
NMimimize to find optimum values. NMimimize also accepts
constaints on fitting parameters.
But there is another issue here as well. While you did not
specify what you are using as basis functions for Fit, I suspect
you might be using simply powers of x, i.e., {1, x, x^2, x^3,
x^4} as the set of functions to fit to your data. If so, this is
a very bad idea.
There are several issues here that will cause problems. First,
the linear regression problem is increasingly numerically
unstable when the degree of the polynomial increases when using
powers of x as the set of basis functions. Since Fit does it
thing by default with machine precision arithmetic, this means
small changes in your data will result in large changes in the
fitted values.
Next, powers of x do not form an orthogonal set of basis
functions. That means the fitted coefficients will not be
independent of each other. Additionally, the variance in the
fitted parameters scales as 1/(1-r) where r is the correlation
coefficient between basis functions.
If you absolutely need a polynomial fit, you should be using an
orthogonal set of polynomials for your basis functions such as
Chebyshev or Legendre polynomials. Chebyshev polynomials are
particularly good.
Prev by Date:
**Re: Re: pure function with optional number of arguments**
Next by Date:
**Re: Change Figure according to Session Time**
Previous by thread:
**Re: fitting surface with Mathematica 6.0.3 and range of fitted values**
Next by thread:
**Re: Re: representing the dihedral group**
| |