Article View: bit.listserv.graph-ti
Article #113Re: looking for a formula.
From: Andy Den Tandt
Date: Fri, 13 Jan 1995 12:58
Date: Fri, 13 Jan 1995 12:58
45 lines
2463 bytes
2463 bytes
ANDREW CHEYNE (006809c@axe.acadiau.ca) wrote:
: Hello!
: I'm attempting to write a program that will read in a bunch of data
: points, perform a least squares fit to the points, and then draw the best
: fit line. I know the basics behind writing the program, but I'm in need of
: formulas that woud calculate m and b in y=mx+b. I know I should be able to
: figure these out with a little bit of calculus, but the calculus seems to
: lost on me! I also know that I should be able to do this using the Stats
: button on my TI-85, but I want to be able to integrate this program between
: the 85 and my PC. If anyone could mail me the formulas, I'd really
: appreciate it!
The general least squares fit for A.X=Y
with A a (m x n) matrix,
X a (n x 1)
Y a (m x 1)
For you, A=[ x0 1 ] X= [m] Y=[y0]
[ x1 1 ] [b] [y1]
etc. etc.
T T
is given by the lineair system A .A.X=A .Y, so you transpose A and
multiply by AX and Y.
There's allways a solution, but you need the one with the smallest
length. I think that if your x0,x1.. aren't all the same, there should be
only one solution. And if they are, the y's are it too, so you took only
1 point, which is crazy.
Hope I helped.
************************************************************
Watch out! Even I am not perfect!
************************************************************
****************************
** Andy Den Tandt **
****************************
** adntandt@rug.ac.be **
****************************
** University of Ghent **
** Belgium **
****************************
Technical Details
Message-ID:
<3f5td8$7qc@infoserv.rug.ac.be>Path:
arc1-ca.pugleaf.net!nntp.gmd.de!Germany.EU.net!howland.reston.ans.net!EU.net!ub4b!idefix.CS.kuleuven.ac.be!infoserv.rug.ac.be!eduserv!adntandtReferences:
<006809c.132.2F149736@axe.acadiau.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 104512,d0200b7b1651a9a9 X-Google-Attributes: gid104512,public X-Google-ArrivalTime: 1995-01-13 04:58:16 PST Path: arc1-ca.pugleaf.net!nntp.gmd.de!Germany.EU.net!howland.reston.ans.net!EU.net!ub4b!idefix.CS.kuleuven.ac.be!infoserv.rug.ac.be!eduserv!adntandt From: adntandt@eduserv.rug.ac.be (Andy Den Tandt) Newsgroups: bit.listserv.graph-ti Subject: Re: looking for a formula. Date: 13 Jan 1995 12:58:16 GMT Organization: University of Ghent, Belgium Lines: 45 Message-ID: <3f5td8$7qc@infoserv.rug.ac.be> References: <006809c.132.2F149736@axe.acadiau.ca> NNTP-Posting-Host: eduserv.rug.ac.be X-Newsreader: TIN [version 1.2 PL2]