[Maxima] revision of lsquares package
robert.dodier at gmail.com
Sun Jul 29 22:26:33 CDT 2007
I have replaced share/contrib/lsquares.mac with a new version.
I hope this proves to be useful.
There are now several functions in the package. The functionality
previously provided by the lsquares function is now handled by
lsquares_estimates. Aside from changing the name the arguments
are the same.
The revised package puts some emphasis on the mean square
error since that is often an object of some interest in analysis.
Also there are functions to compute residuals and the residual MSE.
A general problem which came up is that different Lisp
implementations yield substantially different numerical results
for some problems. I wish there were a way to get exactly
the same results.
PS. Here is the CVS commit message:
Replace previous lsquares (least squares) package.
Features of new version:
(1) Formulate numerical problem as a minimization (solved via lbfgs)
instead of a system of equations (solved via mnewton).
The minimization formulation is more likely to converge
(since there is always a notion of the correct direction, namely downhill)
(2) Separate functions for exact vs numerical estimates
(3) Separate functions to construct the mean square error expression,
residuals, and residual mean square error.
Residual MSE function supersedes the DETCOEF global variable
(4) Test script with many examples. Includes examples from previous
implementation and others
(5) Revised documentation
* share/contrib/lsquares.mac: replaced implementation
* share/contrib/rtest_lsquares.mac: test script
* doc/info/lsquares.texi: revised documentation
Implementation note: Values obtained for numerical estimates vary
from one Lisp implementation to another. That's disconcerting but
I don't know how to make them all agree. The test script fudges
this point by testing some examples with a greater tolerance.
More information about the Maxima