PDA

View Full Version : Simple question - fitting a function to data


joto
Apr9-04, 05:15 PM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>Hi, I have a simple question about fitting a function to some data\npoints.\n\nI have 5 x,y data points (calibration points), to which I need to fit a\nfunction (a "line" of best fit). Each data point is from one measurement.\nI know the function isn\'t linear, and it looks like it could be a\npolynomial or exponential. The reason I need to fit a function to these\npoints, is because I have several other x coordinates for which I need to\nestimate the y. I know the amount of data I have is tiny, but what\'s the\nbest technique/method to find a good fit and what software can I use to\nimplement it?\n\nUsing excel I tried finding a good function, by taking the 5 calibration\npoints, doing exponential and polynomial fits on 4 of the calibration\npoints and seeing how well the fits estimated the y value of the one\ncalibration point I left out. This didn\'t seem to work very well, and I\'m\nlooking for something more formal/rigorous.\n\nThanks.\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>Hi, I have a simple question about fitting a function to some data
points.

I have 5 x,y data points (calibration points), to which I need to fit a
function (a "line" of best fit). Each data point is from one measurement.
I know the function isn't linear, and it looks like it could be a
polynomial or exponential. The reason I need to fit a function to these
points, is because I have several other x coordinates for which I need to
estimate the y. I know the amount of data I have is tiny, but what's the
best technique/method to find a good fit and what software can I use to
implement it?

Using excel I tried finding a good function, by taking the 5 calibration
points, doing exponential and polynomial fits on 4 of the calibration
points and seeing how well the fits estimated the y value of the one
calibration point I left out. This didn't seem to work very well, and I'm
looking for something more formal/rigorous.

Thanks.

Integral
Apr11-04, 12:08 AM
Do you know what the data "should" be? You can fit a 5th order poly exactly through the data points, but I do not think you will be happy with the results. For a poly use the lowest possible order, attempt fitting to a parabola for example. Fit to all of your data, then have Excel draw the predicted curve. Observe how well it "hits" your data points. Why not show use the data set, perhaps you will find better help that way.

Steven Shippee
Apr11-04, 11:43 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>\n\nSee URL:\n\nhttp://documents.wolfram.com/teachersedition/Teacher/LinesofBestFit.html\n\nThis could be applied to other mathematics applications, such as Maple,\nSPSS, Mintab or even TI calculators.\n\nSteven Shippee\nshippee@jcs.mil\n\n\n"joto" &lt;a@a.com&gt; wrote in message\nnews:MPG.1ae0c81bbd2c0e6a98968f@news.quee nsu.ca...\n&gt; Hi, I have a simple question about fitting a function to some data\n&gt; points.\n&gt;\n&gt; I have 5 x,y data points (calibration points), to which I need to fit a\n&gt; function (a "line" of best fit). Each data point is from one measurement.\n&gt; I know the function isn\'t linear, and it looks like it could be a\n&gt; polynomial or exponential. The reason I need to fit a function to these\n&gt; points, is because I have several other x coordinates for which I need to\n&gt; estimate the y. I know the amount of data I have is tiny, but what\'s the\n&gt; best technique/method to find a good fit and what software can I use to\n&gt; implement it?\n&gt;\n&gt; Using excel I tried finding a good function, by taking the 5 calibration\n&gt; points, doing exponential and polynomial fits on 4 of the calibration\n&gt; points and seeing how well the fits estimated the y value of the one\n&gt; calibration point I left out. This didn\'t seem to work very well, and I\'m\n&gt; looking for something more formal/rigorous.\n&gt;\n&gt; Thanks.\n&gt;\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>See URL:

http://documents.wolfram.com/teachersedition/Teacher/LinesofBestFit.html

This could be applied to other mathematics applications, such as Maple,
SPSS, Mintab or even TI calculators.

Steven Shippee
shippee@jcs.mil


"joto" <a@a.com> wrote in message
news:MPG.1ae0c81bbd2c0e6a98968f@news.queensu.ca...
> Hi, I have a simple question about fitting a function to some data
> points.
>
> I have 5 x,y data points (calibration points), to which I need to fit a
> function (a "line" of best fit). Each data point is from one measurement.
> I know the function isn't linear, and it looks like it could be a
> polynomial or exponential. The reason I need to fit a function to these
> points, is because I have several other x coordinates for which I need to
> estimate the y. I know the amount of data I have is tiny, but what's the
> best technique/method to find a good fit and what software can I use to
> implement it?
>
> Using excel I tried finding a good function, by taking the 5 calibration
> points, doing exponential and polynomial fits on 4 of the calibration
> points and seeing how well the fits estimated the y value of the one
> calibration point I left out. This didn't seem to work very well, and I'm
> looking for something more formal/rigorous.
>
> Thanks.
>

J. J. Lodder
Apr11-04, 11:43 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>\n\n\njoto &lt;a@a.com&gt; wrote:\n\n&gt; Hi, I have a simple question about fitting a function to some data\n&gt; points.\n&gt;\n&gt; I have 5 x,y data points (calibration points), to which I need to fit a\n&gt; function (a "line" of best fit). Each data point is from one measurement.\n&gt; I know the function isn\'t linear, and it looks like it could be a\n&gt; polynomial or exponential. The reason I need to fit a function to these\n&gt; points, is because I have several other x coordinates for which I need to\n&gt; estimate the y. I know the amount of data I have is tiny, but what\'s the\n&gt; best technique/method to find a good fit and what software can I use to\n&gt; implement it?\n&gt;\n&gt; Using excel I tried finding a good function, by taking the 5 calibration\n&gt; points, doing exponential and polynomial fits on 4 of the calibration\n&gt; points and seeing how well the fits estimated the y value of the one\n&gt; calibration point I left out. This didn\'t seem to work very well, and I\'m\n&gt; looking for something more formal/rigorous.\n\nThere is no \'best\', until you have defined a norm.\nWhat you need is therefore not nathematical technique,\nbut an idea of what your functional dependence should look like,\nand what the errors in your points are,\n\nJan\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>joto <a@a.com> wrote:

> Hi, I have a simple question about fitting a function to some data
> points.
>
> I have 5 x,y data points (calibration points), to which I need to fit a
> function (a "line" of best fit). Each data point is from one measurement.
> I know the function isn't linear, and it looks like it could be a
> polynomial or exponential. The reason I need to fit a function to these
> points, is because I have several other x coordinates for which I need to
> estimate the y. I know the amount of data I have is tiny, but what's the
> best technique/method to find a good fit and what software can I use to
> implement it?
>
> Using excel I tried finding a good function, by taking the 5 calibration
> points, doing exponential and polynomial fits on 4 of the calibration
> points and seeing how well the fits estimated the y value of the one
> calibration point I left out. This didn't seem to work very well, and I'm
> looking for something more formal/rigorous.

There is no 'best', until you have defined a norm.
What you need is therefore not nathematical technique,
but an idea of what your functional dependence should look like,
and what the errors in your points are,

Jan

ebunn@lfa221051.richmond.edu
Apr11-04, 11:44 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>\n\nIn article &lt;MPG.1ae0c81bbd2c0e6a98968f@news.queensu.ca&gt;, joto &lt;a@a.com&gt; wrote:\n&gt;Hi, I have a simple question about fitting a function to some data\n&gt;points.\n\nI think you\'re going to have to give us more information. What sort\nof relationship do you expect the data to follow? Do you know\nanything about the noise properties of the data? What exactly was\nunsatisfactory about the polynomial / exponential fits you did?\n\nThere\'s no one-size-fits-all "right" way to fit a curve through\na bunch of data points. The "right" way depends on what you\nalready know (or are willing to assume) about your data, and on what\nyou want to use the results for.\n\n-Ted\n\n--\n[E-mail me at name@domain.edu, as opposed to name@machine.domain.edu.]\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>In article <MPG.1ae0c81bbd2c0e6a98968f@news.queensu.ca>, joto <a@a.com> wrote:
>Hi, I have a simple question about fitting a function to some data
>points.

I think you're going to have to give us more information. What sort
of relationship do you expect the data to follow? Do you know
anything about the noise properties of the data? What exactly was
unsatisfactory about the polynomial / exponential fits you did?

There's no one-size-fits-all "right" way to fit a curve through
a bunch of data points. The "right" way depends on what you
already know (or are willing to assume) about your data, and on what
you want to use the results for.

-Ted

--
[E-mail me at name@domain.edu, as opposed to name@machine.domain.edu.]

Paddy
Apr12-04, 10:06 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>\n\n\n\n&gt; but what\'s the\n&gt; best technique/method to find a good fit and what software can I use to\n&gt; implement it?\n&gt;\nThat is a simple enough question to answer without going\ninto technacalities. You want a function that will minimise\nthe total error between the points calculated by that function\nand the actual measured points.\n\nIn practise we normally minimise the sum of the squares of the\ndifferences. So, if you have several potential functions, the\none with the lowest sum of the squares of the differences between\nactual y and computed y will be the better fit.\n\nMost probably though, with so few points, whatever you say will\nhave little meaning.\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>but what's the
> best technique/method to find a good fit and what software can I use to
> implement it?
>
That is a simple enough question to answer without going
into technacalities. You want a function that will minimise
the total error between the points calculated by that function
and the actual measured points.

In practise we normally minimise the sum of the squares of the
differences. So, if you have several potential functions, the
one with the lowest sum of the squares of the differences between
actual y and computed y will be the better fit.

Most probably though, with so few points, whatever you say will
have little meaning.

Murray Arnow
Apr13-04, 03:43 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>hog.badger@mbox.bol.bg (Paddy) wrote:\n&gt;\n&gt; &gt; but what\'s the\n&gt; &gt; best technique/method to find a good fit and what software can I use to\n&gt; &gt; implement it?\n&gt; &gt;\n&gt; That is a simple enough question to answer without going\n&gt; into technacalities. You want a function that will minimise\n&gt; the total error between the points calculated by that function\n&gt; and the actual measured points.\n&gt;\n&gt; In practise we normally minimise the sum of the squares of the\n&gt; differences. So, if you have several potential functions, the\n&gt; one with the lowest sum of the squares of the differences between\n&gt; actual y and computed y will be the better fit.\n&gt;\n&gt; Most probably though, with so few points, whatever you say will\n&gt; have little meaning.\n\nThe above is not always true. An extreme example would be fitting n\ndata-points to an n-1 degree polynomial. You should be able to get a\nleast squares value of zero, but this need not be the "correct\nfunction."\n\nIt is better to use some statistics to help decide which function gives\nthe best fit to the data. I prefer using the "Chi-Square Goodness of\nFit" test to answer that question. There are other tests, to be sure,\nbut the problem outlined seems easily amenable to the Chi-Square\napproach.\n\nA good source to find practical help is Bevington & Robinson\'s "Data\nReduction and Error Analysis for the Physical Sciences."\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>hog.badger@mbox.bol.bg (Paddy) wrote:
>
> > but what's the
> > best technique/method to find a good fit and what software can I use to
> > implement it?
> >
> That is a simple enough question to answer without going
> into technacalities. You want a function that will minimise
> the total error between the points calculated by that function
> and the actual measured points.
>
> In practise we normally minimise the sum of the squares of the
> differences. So, if you have several potential functions, the
> one with the lowest sum of the squares of the differences between
> actual y and computed y will be the better fit.
>
> Most probably though, with so few points, whatever you say will
> have little meaning.

The above is not always true. An extreme example would be fitting n
data-points to an n-1 degree polynomial. You should be able to get a
least squares value of zero, but this need not be the "correct
function."

It is better to use some statistics to help decide which function gives
the best fit to the data. I prefer using the "\Chi-Square Goodness of
Fit" test to answer that question. There are other tests, to be sure,
but the problem outlined seems easily amenable to the \Chi-Square
approach.

A good source to find practical help is Bevington & Robinson's "Data
Reduction and Error Analysis for the Physical Sciences."

chronon
Apr13-04, 03:43 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>joto &lt;a@a.com&gt; wrote in message news:&lt;MPG.1ae0c81bbd2c0e6a98968f@news.queensu.ca&gt;. ..\n&gt;\n&gt; I have 5 x,y data points (calibration points), to which I need to fit a\n&gt; function (a "line" of best fit). Each data point is from one measurement.\n&gt; I know the function isn\'t linear, and it looks like it could be a\n&gt; polynomial or exponential. The reason I need to fit a function to these\n&gt; points, is because I have several other x coordinates for which I need to\n&gt; estimate the y.\n\nIs it a case of extrapolation or interpoolation? Either way I would\nadvise you to go for a fairly simple function - straight line or\nquadratic. In the case of extrapolation you will have to accept that\nyou are not going to get a very accurate result. For interpolation\njust drawing a series of straight lines between the points would\nprobably be as good as anything, but you can get a better looking\ncurve by using several points at a time and a higher order polynomial\n- a google search for \'Splines\' will give you some useful information.\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>joto <a@a.com> wrote in message news:<MPG.1ae0c81bbd2c0e6a98968f@news.queensu.ca>...
>
> I have 5 x,y data points (calibration points), to which I need to fit a
> function (a "line" of best fit). Each data point is from one measurement.
> I know the function isn't linear, and it looks like it could be a
> polynomial or exponential. The reason I need to fit a function to these
> points, is because I have several other x coordinates for which I need to
> estimate the y.

Is it a case of extrapolation or interpoolation? Either way I would
advise you to go for a fairly simple function - straight line or
quadratic. In the case of extrapolation you will have to accept that
you are not going to get a very accurate result. For interpolation
just drawing a series of straight lines between the points would
probably be as good as anything, but you can get a better looking
curve by using several points at a time and a higher order polynomial
- a google search for 'Splines' will give you some useful information.

Peter Tobias
Apr13-04, 11:29 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>\n\n\n\nPaddy:\n&gt; In practise we normally minimise the sum of the squares of the\n&gt; differences. So, if you have several potential functions, the\n&gt; one with the lowest sum of the squares of the differences between\n&gt; actual y and computed y will be the better fit.\n\nIf I recall correctly, minimising the sum of the squares of the\ndifferences gives the best fit also in theory, if the right function\nhas been chosen and no data point is from an obviously bad\nmeasurement.\n\nAnother point to keep in mind is the number of fitting parameters in\nyour fit. With only five data points, you cannot have more than five\nparameters and shouldn\'t have more than three in a reasonable fit:\nlinear and quadratic fits are o.k., a cubic fit is not. If you judge\nthe fit not being \'good\', you have to add more information to your\nmodel, either more data points or more theoretical knowledge of how\nthe fit ought to look like.\n\nRegards,\n\nPeter\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>Paddy:
> In practise we normally minimise the sum of the squares of the
> differences. So, if you have several potential functions, the
> one with the lowest sum of the squares of the differences between
> actual y and computed y will be the better fit.

If I recall correctly, minimising the sum of the squares of the
differences gives the best fit also in theory, if the right function
has been chosen and no data point is from an obviously bad
measurement.

Another point to keep in mind is the number of fitting parameters in
your fit. With only five data points, you cannot have more than five
parameters and shouldn't have more than three in a reasonable fit:
linear and quadratic fits are o.k., a cubic fit is not. If you judge
the fit not being 'good', you have to add more information to your
model, either more data points or more theoretical knowledge of how
the fit ought to look like.

Regards,

Peter

Joseph.D.Warner
Apr13-04, 11:29 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>\n\n\n\n\njoto wrote:\n&gt; Hi, I have a simple question about fitting a function to some data\n&gt; points.\n&gt;\n&gt; I have 5 x,y data points (calibration points), to which I need to fit a\n&gt; function (a "line" of best fit). Each data point is from one measurement.\n&gt; I know the function isn\'t linear, and it looks like it could be a\n&gt; polynomial or exponential. The reason I need to fit a function to these\n&gt; points, is because I have several other x coordinates for which I need to\n&gt; estimate the y. I know the amount of data I have is tiny, but what\'s the\n&gt; best technique/method to find a good fit and what software can I use to\n&gt; implement it?\n&gt;\n&gt; Using excel I tried finding a good function, by taking the 5 calibration\n&gt; points, doing exponential and polynomial fits on 4 of the calibration\n&gt; points and seeing how well the fits estimated the y value of the one\n&gt; calibration point I left out. This didn\'t seem to work very well, and I\'m\n&gt; looking for something more formal/rigorous.\n\n5 points is an awfully few point to fit a high order polynomial through\nwithout any regard to the underlying functional basis for the points.\n\nThat said, what you need to do is to set up the least squares fit or if\nyou know the uncertainity of each point and the distribution function\nfor the uncertainity of each point you can go to the full blown\nlikelihood function. Lets ignore the likelihood function and assume that\nat each point the uncertainity of that point is governed by a Gaussian\ndistribution and the weights of each point is the same.\nA good primary on the subject is by Hugh Young. It is a simple book that\nmost people can understand.\n\nFirst write down the chi-square equation. I\'ll do this for a linear fit\nand it is similar for any function.\n\nX2= (sum of (ax(i) + b - y(i))^2)/(N-2) where x(i),y(i) are set of\npoints and N is the number of points. 2 is the number of parameters you\nare fitting. If you fit a quadriatic function then 2 becomes 3.\n\nthe sum is over all points.\n\n\nNow you want to minimize X2 in repect to the parameters a and b.\n\nSo take dX2/da and dX2/db where these are the partials. Sorry I don\'t\nhave an alpha on my keyboard.\n\nSo now you get two equations\n\n(2/N)*(SUM (ax(i)+b-y(i))*x(i)) = 0\n\n(2/N)*(SUM (ax(i)+b-y(i))=0\n\nNow with two equations and two unknowns solve for a and b. You can use\nmatrix algebra for this.\n\nAfter you find a and b plug it back into the top equation and to find\nX2. You can do this for all the functions you want to fit and see which\ngives you the lowest X2. Though, with so few points I would not\nextrapolate beyound those 5 points very far. Also, it would be good to\nplot out the curves with many more points in between the 5 to see if the\nfunction is well-behave between points.\n\nAlso, if you like you can go and estimate the uncertainity in a and b by\ncalculating x2 and slowly changing a until x2 is one. That value of a\nminus the original value is the uncertainity in a. Then go back to the\noriginal x2 and do similar action to get the uncertainity in b.\n\nAfter you\'ve done this for a straight line you can do it for any\nfunction you like though you are limited to 5 adjustable parameters and\nat 5 x2 of course is undefined ( zero divided by zero).\n\n\n\n\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>joto wrote:
> Hi, I have a simple question about fitting a function to some data
> points.
>
> I have 5 x,y data points (calibration points), to which I need to fit a
> function (a "line" of best fit). Each data point is from one measurement.
> I know the function isn't linear, and it looks like it could be a
> polynomial or exponential. The reason I need to fit a function to these
> points, is because I have several other x coordinates for which I need to
> estimate the y. I know the amount of data I have is tiny, but what's the
> best technique/method to find a good fit and what software can I use to
> implement it?
>
> Using excel I tried finding a good function, by taking the 5 calibration
> points, doing exponential and polynomial fits on 4 of the calibration
> points and seeing how well the fits estimated the y value of the one
> calibration point I left out. This didn't seem to work very well, and I'm
> looking for something more formal/rigorous.

5 points is an awfully few point to fit a high order polynomial through
without any regard to the underlying functional basis for the points.

That said, what you need to do is to set up the least squares fit or if
you know the uncertainity of each point and the distribution function
for the uncertainity of each point you can go to the full blown
likelihood function. Lets ignore the likelihood function and assume that
at each point the uncertainity of that point is governed by a Gaussian
distribution and the weights of each point is the same.
A good primary on the subject is by Hugh Young. It is a simple book that
most people can understand.

First write down the \chi-square equation. I'll do this for a linear fit
and it is similar for any function.

X2= (sum of (ax(i) + b - y(i))^2)/(N-2) where x(i),y(i) are set of
points and N is the number of points. 2 is the number of parameters you
are fitting. If you fit a quadriatic function then 2 becomes 3.

the sum is over all points.


Now you want to minimize X2 in repect to the parameters a and b.

So take dX2/da and dX2/db where these are the partials. Sorry I don't
have an \alpha on my keyboard.

So now you get two equations

(2/N)*(SUM (ax(i)+b-y(i))*x(i)) =

(2/N)*(SUM (ax(i)+b-y(i))=0

Now with two equations and two unknowns solve for a and b. You can use
matrix algebra for this.

After you find a and b plug it back into the top equation and to find
X2. You can do this for all the functions you want to fit and see which
gives you the lowest X2. Though, with so few points I would not
extrapolate beyound those 5 points very far. Also, it would be good to
plot out the curves with many more points in between the 5 to see if the
function is well-behave between points.

Also, if you like you can go and estimate the uncertainity in a and b by
calculating x2 and slowly changing a until x2 is one. That value of a
minus the original value is the uncertainity in a. Then go back to the
original x2 and do similar action to get the uncertainity in b.

After you've done this for a straight line you can do it for any
function you like though you are limited to 5 adjustable parameters and
at 5 x2 of course is undefined ( zero divided by zero).

Joseph.D.Warner
Apr13-04, 11:29 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>\n\n\n\n\nSteven Shippee wrote:\n&gt; See URL:\n&gt;\n&gt; http://documents.wolfram.com/teachersedition/Teacher/LinesofBestFit.html\n&gt;\n&gt; This could be applied to other mathematics applications, such as Maple,\n&gt; SPSS, Mintab or even TI calculators.\n&gt;\n\nI don\'t like this link. It tell you how to do a linear fit to a straight\nline but never calculates or mention the uncertainity. This is always a\npet peeve of mine against many can programs that does curve fitting.\nBecause just predicting an answer without knowledge of its uncertainity\nisn\'t worth much unless you have prior knowledge of what the\nuncertainity is.\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>Steven Shippee wrote:
> See URL:
>
> http://documents.wolfram.com/teachersedition/Teacher/LinesofBestFit.html
>
> This could be applied to other mathematics applications, such as Maple,
> SPSS, Mintab or even TI calculators.
>

I don't like this link. It tell you how to do a linear fit to a straight
line but never calculates or mention the uncertainity. This is always a
pet peeve of mine against many can programs that does curve fitting.
Because just predicting an answer without knowledge of its uncertainity
isn't worth much unless you have prior knowledge of what the
uncertainity is.

Steven Shippee
Apr13-04, 05:50 PM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>Please add this to my earlier post:\n\n[Moderator\'s note: I\'m posting it separately instead. Posts to\nsci.physics.research are routed at random to to the moderators, who\ndeal with them on their own schedules. I don\'t think I got the\noriginal post, so I can\'t easily add anything to it. -TB]\n\nIf you want to stay within Excel, see URL:\n\nhttp://support.microsoft.com/default.aspx?scid=kb;en-us;103839\n\nwhich explains how to do this in Excel in much greater detail that you tried\nas outlined below.\n\nSteven Shippee\nshippee@jcs.mil\n\n\n"joto" &lt;a@a.com&gt; wrote in message\nnews:MPG.1ae0c81bbd2c0e6a98968f@news.quee nsu.ca...\n&gt; Hi, I have a simple question about fitting a function to some data\n&gt; points.\n&gt;\n&gt; I have 5 x,y data points (calibration points), to which I need to fit a\n&gt; function (a "line" of best fit). Each data point is from one measurement.\n&gt; I know the function isn\'t linear, and it looks like it could be a\n&gt; polynomial or exponential. The reason I need to fit a function to these\n&gt; points, is because I have several other x coordinates for which I need to\n&gt; estimate the y. I know the amount of data I have is tiny, but what\'s the\n&gt; best technique/method to find a good fit and what software can I use to\n&gt; implement it?\n&gt;\n&gt; Using excel I tried finding a good function, by taking the 5 calibration\n&gt; points, doing exponential and polynomial fits on 4 of the calibration\n&gt; points and seeing how well the fits estimated the y value of the one\n&gt; calibration point I left out. This didn\'t seem to work very well, and I\'m\n&gt; looking for something more formal/rigorous.\n&gt;\n&gt; Thanks.\n&gt;\n\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>Please add this to my earlier post:

[Moderator's note: I'm posting it separately instead. Posts to
sci.physics.research are routed at random to to the moderators, who
deal with them on their own schedules. I don't think I got the
original post, so I can't easily add anything to it. -TB]

If you want to stay within Excel, see URL:

http://support.microsoft.com/default.aspx?scid=kb;en-us;103839

which explains how to do this in Excel in much greater detail that you tried
as outlined below.

Steven Shippee
shippee@jcs.mil


"joto" <a@a.com> wrote in message
news:MPG.1ae0c81bbd2c0e6a98968f@news.queensu.ca...
> Hi, I have a simple question about fitting a function to some data
> points.
>
> I have 5 x,y data points (calibration points), to which I need to fit a
> function (a "line" of best fit). Each data point is from one measurement.
> I know the function isn't linear, and it looks like it could be a
> polynomial or exponential. The reason I need to fit a function to these
> points, is because I have several other x coordinates for which I need to
> estimate the y. I know the amount of data I have is tiny, but what's the
> best technique/method to find a good fit and what software can I use to
> implement it?
>
> Using excel I tried finding a good function, by taking the 5 calibration
> points, doing exponential and polynomial fits on 4 of the calibration
> points and seeing how well the fits estimated the y value of the one
> calibration point I left out. This didn't seem to work very well, and I'm
> looking for something more formal/rigorous.
>
> Thanks.
>

Patrick Powers
Apr13-04, 05:52 PM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>joto &lt;a@a.com&gt; wrote in message news:&lt;MPG.1ae0c81bbd2c0e6a98968f@news.queensu.ca&gt;. ..\n&gt; Hi, I have a simple question about fitting a function to some data\n&gt; points.\n&gt;\n&gt; I have 5 x,y data points (calibration points), to which I need to fit a\n&gt; function (a "line" of best fit). Each data point is from one measurement.\n&gt; I know the function isn\'t linear, and it looks like it could be a\n&gt; polynomial or exponential. The reason I need to fit a function to these\n&gt; points, is because I have several other x coordinates for which I need to\n&gt; estimate the y. I know the amount of data I have is tiny, but what\'s the\n&gt; best technique/method to find a good fit and what software can I use to\n&gt; implement it?\n&gt;\n&gt; Using excel I tried finding a good function, by taking the 5 calibration\n&gt; points, doing exponential and polynomial fits on 4 of the calibration\n&gt; points and seeing how well the fits estimated the y value of the one\n&gt; calibration point I left out. This didn\'t seem to work very well, and I\'m\n&gt; looking for something more formal/rigorous.\n&gt;\n\nThere is really no way to do this. Parametric statistics in general,\nand with so little data in particular, needs prior knowledge of the\ndistribution. There is such a thing as non-parametric statistics but\nthat can\'t be used to fit a function.\n\nIf you must then I suggest fitting a curve by eye and hand. It would\nbe as good as anything and better than most.\n&gt; Thanks.\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>joto <a@a.com> wrote in message news:<MPG.1ae0c81bbd2c0e6a98968f@news.queensu.ca>...
> Hi, I have a simple question about fitting a function to some data
> points.
>
> I have 5 x,y data points (calibration points), to which I need to fit a
> function (a "line" of best fit). Each data point is from one measurement.
> I know the function isn't linear, and it looks like it could be a
> polynomial or exponential. The reason I need to fit a function to these
> points, is because I have several other x coordinates for which I need to
> estimate the y. I know the amount of data I have is tiny, but what's the
> best technique/method to find a good fit and what software can I use to
> implement it?
>
> Using excel I tried finding a good function, by taking the 5 calibration
> points, doing exponential and polynomial fits on 4 of the calibration
> points and seeing how well the fits estimated the y value of the one
> calibration point I left out. This didn't seem to work very well, and I'm
> looking for something more formal/rigorous.
>

There is really no way to do this. Parametric statistics in general,
and with so little data in particular, needs prior knowledge of the
distribution. There is such a thing as non-parametric statistics but
that can't be used to fit a function.

If you must then I suggest fitting a curve by eye and hand. It would
be as good as anything and better than most.
> Thanks.

Arnold Neumaier
Apr14-04, 03:17 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>Peter Tobias wrote:\n&gt; Paddy:\n&gt;\n&gt;&gt;In practise we normally minimise the sum of the squares of the\n&gt;&gt;differences. So, if you have several potential functions, the\n&gt;&gt;one with the lowest sum of the squares of the differences between\n&gt;&gt;actual y and computed y will be the better fit.\n&gt;\n&gt;\n&gt; If I recall correctly, minimising the sum of the squares of the\n&gt; differences gives the best fit also in theory, if the right function\n&gt; has been chosen and no data point is from an obviously bad\n&gt; measurement.\n\nOnly if all data have the same absolute uncertainty,\nand the matrix of the normal equations is well-conditioned.\nIf the latter is not the case, the fit is overparamerized\nand one needs to reduce the number of parameters; if the former\nis not the case, one has to weight the squares by dividing each\nsquare by the square of the uncertainty before taking the sum.\n\nArnold Neumaier\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>Peter Tobias wrote:
> Paddy:
>
>>In practise we normally minimise the sum of the squares of the
>>differences. So, if you have several potential functions, the
>>one with the lowest sum of the squares of the differences between
>>actual y and computed y will be the better fit.
>
>
> If I recall correctly, minimising the sum of the squares of the
> differences gives the best fit also in theory, if the right function
> has been chosen and no data point is from an obviously bad
> measurement.

Only if all data have the same absolute uncertainty,
and the matrix of the normal equations is well-conditioned.
If the latter is not the case, the fit is overparamerized
and one needs to reduce the number of parameters; if the former
is not the case, one has to weight the squares by dividing each
square by the square of the uncertainty before taking the sum.

Arnold Neumaier

ebunn@lfa221051.richmond.edu
Apr14-04, 03:17 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>In article &lt;7c1ef1e6.0404130506.74ededf1@posting.google.com&gt;, \nPeter Tobias &lt;tobias@pa.msu.edu&gt; wrote:\n\n&gt;Paddy:\n&gt;&gt; In practise we normally minimise the sum of the squares of the\n&gt;&gt; differences. So, if you have several potential functions, the\n&gt;&gt; one with the lowest sum of the squares of the differences between\n&gt;&gt; actual y and computed y will be the better fit.\n&gt;\n&gt;If I recall correctly, minimising the sum of the squares of the\n&gt;differences gives the best fit also in theory, if the right function\n&gt;has been chosen and no data point is from an obviously bad\n&gt;measurement.\n\nWhether this is true or not depends on what you mean by "best."\nOften, "best-fit" is taken to mean "fit that minimizes the total\nsquared deviation," in which case your statement is true by\ndefinition.\n\n\n&gt;Another point to keep in mind is the number of fitting parameters in\n&gt;your fit. With only five data points, you cannot have more than five\n&gt;parameters and shouldn\'t have more than three in a reasonable fit:\n&gt;linear and quadratic fits are o.k., a cubic fit is not. If you judge\n&gt;the fit not being \'good\', you have to add more information to your\n&gt;model, either more data points or more theoretical knowledge of how\n&gt;the fit ought to look like.\n\nExcellent advice.\n\n-Ted\n\n--\n[E-mail me at name@domain.edu, as opposed to name@machine.domain.edu.]\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>In article <7c1ef1e6.0404130506.74ededf1@posting.google.com>,
Peter Tobias <tobias@pa.msu.edu> wrote:

>Paddy:
>> In practise we normally minimise the sum of the squares of the
>> differences. So, if you have several potential functions, the
>> one with the lowest sum of the squares of the differences between
>> actual y and computed y will be the better fit.
>
>If I recall correctly, minimising the sum of the squares of the
>differences gives the best fit also in theory, if the right function
>has been chosen and no data point is from an obviously bad
>measurement.

Whether this is true or not depends on what you mean by "best."
Often, "best-fit" is taken to mean "fit that minimizes the total
squared deviation," in which case your statement is true by
definition.


>Another point to keep in mind is the number of fitting parameters in
>your fit. With only five data points, you cannot have more than five
>parameters and shouldn't have more than three in a reasonable fit:
>linear and quadratic fits are o.k., a cubic fit is not. If you judge
>the fit not being 'good', you have to add more information to your
>model, either more data points or more theoretical knowledge of how
>the fit ought to look like.

Excellent advice.

-Ted

--
[E-mail me at name@domain.edu, as opposed to name@machine.domain.edu.]

Bill Jefferys
Apr15-04, 02:57 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>At 11:29 AM -0400 4/13/04, Peter Tobias wrote:\n&gt;Paddy:\n&gt;&gt;In practise we normally minimise the sum of the squares of the\n&gt;&gt;differences. So, if you have several potential functions, the one\n&gt;&gt;with the lowest sum of the squares of the differences between\n&gt;&gt;actual y and computed y will be the better fit.\n&gt;\n&gt;If I recall correctly, minimising the sum of the squares of the\n&gt;differences gives the best fit also in theory, if the right function\n&gt;has been chosen and no data point is from an obviously bad\n&gt;measurement.\n&gt;\n&gt;Another point to keep in mind is the number of fitting parameters in\n&gt;your fit. With only five data points, you cannot have more than five\n&gt;parameters and shouldn\'t have more than three in a reasonable fit:\n&gt;linear and quadratic fits are o.k., a cubic fit is not. If you judge\n&gt;the fit not being \'good\', you have to add more information to your\n&gt;model, either more data points or more theoretical knowledge of how\n&gt;the fit ought to look like.\n\nI wouldn\'t fit a quadratic if I had only five points, unless they\nwere known to be very accurate. In many cases I wouldn\'t even fit a\nlinear function.\n\nBill\n\n--\nBill Jefferys/Department of Astronomy/University of Texas/Austin, TX 78712\nEmail: replace \'warthog\' with \'clyde\' | Homepage: quasar.as.utexas.edu\nI report spammers to fraudinfo@psinet.com\nFinger for PGP Key: F7 11 FB 82 C6 21 D8 95 2E BD F7 6E 99 89 E1 82\nUnlawful to use this email address for unsolicited ads: USC Title 47 Sec 227\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>At 11:29 AM -0400 4/13/04, Peter Tobias wrote:
>Paddy:
>>In practise we normally minimise the sum of the squares of the
>>differences. So, if you have several potential functions, the one
>>with the lowest sum of the squares of the differences between
>>actual y and computed y will be the better fit.
>
>If I recall correctly, minimising the sum of the squares of the
>differences gives the best fit also in theory, if the right function
>has been chosen and no data point is from an obviously bad
>measurement.
>
>Another point to keep in mind is the number of fitting parameters in
>your fit. With only five data points, you cannot have more than five
>parameters and shouldn't have more than three in a reasonable fit:
>linear and quadratic fits are o.k., a cubic fit is not. If you judge
>the fit not being 'good', you have to add more information to your
>model, either more data points or more theoretical knowledge of how
>the fit ought to look like.

I wouldn't fit a quadratic if I had only five points, unless they
were known to be very accurate. In many cases I wouldn't even fit a
linear function.

Bill

--
Bill Jefferys/Department of Astronomy/University of Texas/Austin, TX 78712
Email: replace 'warthog' with 'clyde' | Homepage: quasar.as.utexas.edu
I report spammers to fraudinfo@psinet.com
Finger for PGP Key: F7 11 FB 82 C6 21 D8 95 2E BD F7 6E 99 89 E1 82
Unlawful to use this email address for unsolicited ads: USC Title 47 Sec 227

Doug Goncz
Apr15-04, 11:28 AM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>Mathcad\'s genfit function does this nicely. You just scribble in some arbitrary\nfunction with numbered parameters, and Mathcad tweaks the parameters, gets the\nbest fit, _and_ tells you how good the fit is!\n\nI used it on muon decay data and wrote a function including the variable\n"gotaway", that is, the number of muons that escaped detection. This produced\nthe best fit of all in the seminar. One credit earned.\n\nOne HUGE and some smaller files for you to contemplate at:\n\nftp://users.aol.com/DGoncz/PHY298/Muons\n\nor take the ride:\n\nhttp://users.aol.com/DGoncz/PHY298/Muons/TheMuonsThatGotAway.avi\n\n(takes time to load, so I gave you the ftp)\n\nBoth links tested.\n\n\nYours,\n\nDoug Goncz ( ftp://users.aol.com/DGoncz/ )\n\nMy physics project at NVCC:\nhttp://groups.google.com/groups?q=dgoncz&scoring=d plus\n"bicycle", "fluorescent", "inverter", "flywheel", "ultracapacitor", etc.\nin the search box\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>Mathcad's genfit function does this nicely. You just scribble in some arbitrary
function with numbered parameters, and Mathcad tweaks the parameters, gets the
best fit, _and_ tells you how good the fit is!

I used it on muon decay data and wrote a function including the variable
"gotaway", that is, the number of muons that escaped detection. This produced
the best fit of all in the seminar. One credit earned.

One HUGE and some smaller files for you to contemplate at:

ftp://users.aol.com/DGoncz/PHY298/Muons

or take the ride:

http://users.aol.com/DGoncz/PHY298/Muons/TheMuonsThatGotAway.avi

(takes time to load, so I gave you the ftp)

Both links tested.


Yours,

Doug Goncz ( ftp://users.aol.com/DGoncz/ )

My physics project at NVCC:
http://groups.google.com/groups?q=dgoncz&scoring=d plus
"bicycle", "fluorescent", "inverter", "flywheel", "ultracapacitor", etc.
in the search box

Paul Danaher
Apr19-04, 02:05 PM
<jabberwocky><div class="vbmenu_control"><a href="jabberwocky:;" onClick="newWindow=window.open('','usenetCode','toolbar=no, location=no,scrollbars=yes,resizable=yes,status=no ,width=650,height=400'); newWindow.document.write('<HTML><HEAD><TITLE>Usenet ASCII</TITLE></HEAD><BODY topmargin=0 leftmargin=0 BGCOLOR=#F1F1F1><table border=0 width=625><td bgcolor=midnightblue><font color=#F1F1F1>This Usenet message\'s original ASCII form: </font></td></tr><tr><td width=449><br><br><font face=courier><UL><PRE>Paddy wrote:\n&gt;&gt; but what\'s the\n&gt;&gt; best technique/method to find a good fit and what software can I use\n&gt;&gt; to implement it?\n&gt;&gt;\n&gt; That is a simple enough question to answer without going\n&gt; into technacalities. You want a function that will minimise\n&gt; the total error between the points calculated by that function\n&gt; and the actual measured points.\n\nIf you have so little data and nothing else to work from, a spline curve is\na perfectly good pragmatic start.\n\n\n</UL></PRE></font></td></tr></table></BODY><HTML>');"> <IMG SRC=/images/buttons/ip.gif BORDER=0 ALIGN=CENTER ALT="View this Usenet post in original ASCII form">&nbsp;&nbsp;View this Usenet post in original ASCII form </a></div><P></jabberwocky>Paddy wrote:
>> but what's the
>> best technique/method to find a good fit and what software can I use
>> to implement it?
>>
> That is a simple enough question to answer without going
> into technacalities. You want a function that will minimise
> the total error between the points calculated by that function
> and the actual measured points.

If you have so little data and nothing else to work from, a spline curve is
a perfectly good pragmatic start.