I tried to get expressions for linear regression. First I defined the
sum of squares:
sumsq:sum((y[i]-a*x[i]-b)^2,i,1,N);
then tried to solve for the minimum (derivatives of coefficients must be
zero at solution:
solve([diff(sumsq,a),diff(sumsq,b)],[a,b]);
Maxima doesn't find anything (thinks solution is empty). What am I doing
wrong?
I tried to at least check the formulas by hand: defined the common terms:
sx:sum(x[i],i,1,N); sxy:sum(x[i]*y[i],i,1,N);
sx2:sum(x[i]^2,i,1,N); sy:sum(y[i],i,1,N);
and wrote the acutal result:
aa:(N*sxy-sx*sy)/(N*sx2-sx*sx); bb:(sx2*sy-sx*sxy)/(N*sx2-sx*sx);
and tried to backsubstitute:
diff(sumsq,a);diff(sumsq,b);
expand(sum(y[i]-aa*x[i]-bb,i,1,N));
but couldn't get maxima to simplify this expression.
Thanks for your hints..