Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

[Date Index] [Thread Index] [Author Index]

Search the Archive

Fwd: Linear and logarithmic fit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39373] Fwd: [mg39363] Linear and logarithmic fit
  • From: "Jay D. Martin" <jdm111 at psu.edu>
  • Date: Thu, 13 Feb 2003 04:52:19 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

>Hi everybody,
>
>If I have 9 points in a 2 dimensional space how do I decide if they
>fit better a linear function or a logarithmic function?
>
>Thanks in advance,
>
>Jay

Jay,

The first question to answer is, Do I need
to interpolate the data or just approximate it?
If the data is the result of physical experiments or
for some reason has a random error component
to it, there is no reason to interpolate the data
exactly. If the data is deterministic, ie if you
performed the experiment again you would get
exactly the same answer, you would want to interpolate
the data.

The answer to this question directs the selection of possible
function families to approximate the process that is represented
by the data you have sampled.

If your data has random error, it is non-deterministic,
you will want to select an approximating function. One way to do
this is to use the Statistics`LinearRegression` package and the Regress
function. Given a set of functions to fit, this function will return the
coefficients of the functions, the quality of fit of the model and the
importance of each function in the model.

If you want to fit nonlinear functions such as 2^x, you can use
the Statistics`NonlinearFit` package and the NonlinearRegress
function. I would recommend sticking to the LinearRegression
package and perform the nonlinear transformation on the "y"
values instead. The primary reason for this is efficiency in calculating
the optimal coefficients. NonlinearRegress requires an iterative optimization
while Regress has a closed-form solution.

If you need to interpolate the data, there are many options available.
The easiest to use is the standard function Interpolation. This function
will fit a spline between  the points of any order you specify. The limitation
of this routine is your data must be on a cartesian grid. If this is not 
the case,
and you have 2D data you can use a triangulation of the data to fit a plane
to each region defined by its three closest neighbors. I do not have the 
latest version
of Mathematica, but I believe there is a function that supports this 
directly now.

The last options for interpolation, especially for 2D+ data is to use
spatial correlation functions. These include radial basis functions and
kriging functions. In general, these functions assume nearby points have
some influence on the prediction of an unknown location. The amount of 
influence
becomes a function of the distance from all of the known points.
These functions can provide a great deal of flexibility in fitting data,
but they are more complex to use and in the case of kriging, difficult
to fit. Kriging requires an optimization process to determine the parameters
for the model that control the range of influence of nearby points and
the smoothness of the resulting surface.

I have probably confused you more than helped with my long-winded
answer, but I hope it helps you address your problem.

Jay Martin
Penn State University



  • Prev by Date: Re: Limits: Is there something I'm missing Here?
  • Next by Date: Re: Detecting unsuccessful computations
  • Previous by thread: Re: Linear and logarithmic fit
  • Next by thread: a first-time user question