Newbie question: linear regression



Furuya Gosei showed how to get Maxima to solve the linear regression 
equations. 
Let me add two comments:

1. Getting Maxima to do this calculation requires either luck or
adroitness; the first time I tried, I discovered a bug in simpsum:

(C1) sum(a+x[i],i,1,n),simpsum;
(D1)                                  a n
(C2) sum(1+sqrt(i),i,1,n), simpsum;
(D2)                                   n
(C3) 

Maybe this bug has already been reported and fixed?  (The culprit maybe in 
the
function sumsum.)

2. As Maxima presents them, the formulae for the slope and the intercept 
are 
poorly suited for numerical evaluation.  (They involve differences of 
numbers
that might be close together.) To fix this, you'll need to do some 
algebraic
tricks that would be far easier to do by hand than by Maxima.  In the end, 

it isn't worth the trouble; there are lots of  software tools (a 
garden-variety 
spreadsheet or gnuplot are two that I have used) that will do linear 
regression accurately without the hassle.

Currently, Maxima lacks the tools to build a good linear regression 
function;
to do a decent job, we'd at least need a good numerical LU and SVD 
functions.
It seems that there is interest in adding tools for fitting data to 
curves;
for now, Maxima isn't up to the task.

Barton