lsquares_estimates SciMax Toolbox lsquares_estimates_exact

SciMax Toolbox >> lsquares_estimates_approximate

lsquares_estimates_approximate

Maxima Function

Calling Sequence

lsquares_estimates_approximate (MSE, a, initial = L, tol = t)

Description

Estimate parameters a to minimize the mean square error MSE, via the numerical minimization function lbfgs. The mean square error is an expression in the parameters a, such as that returned by lsquares_mse.

The solution returned by lsquares_estimates_approximate is a local (perhaps global) minimum of the mean square error. For consistency with lsquares_estimates_exact, the return value is a nested list which contains one element, namely a list of equations of the form [a = ..., b = ..., c = ...].

Additional arguments to lsquares_estimates_approximate are specified as equations and passed on verbatim to the function lbfgs.

MSE must evaluate to a number when the parameters are assigned numeric values. This requires that the data from which MSE was constructed comprise only numeric constants such as %pi and %e and literal numbers (integers, rationals, ordinary floats, and bigfloats). Numerical calculations are carried out with ordinary floating-point arithmetic, so all other kinds of numbers are converted to ordinary floats for calculations.

load(lsquares) loads this function.

See also lsquares_estimates, lsquares_estimates_exact, lsquares_mse, lsquares_residuals, and lsquares_residual_mse.

Example:

(%i1) load (lsquares)$
(%i2) M : matrix ([1, 1, 1], [3/2, 1, 2], [9/4, 2, 1], [3, 2, 2], [2, 2, 1]);
                           [ 1  1  1 ]
                           [         ]
                           [ 3       ]
                           [ -  1  2 ]
                           [ 2       ]
                           [         ]
(%o2)                      [ 9       ]
                           [ -  2  1 ]
                           [ 4       ]
                           [         ]
                           [ 3  2  2 ]
                           [         ]
                           [ 2  2  1 ]
(%i3) mse : lsquares_mse (M, [z, x, y], (z + D)^2 = A*x + B*y + C);
           5
          ====
          \                 2                         2
           >    ((D + M    )  - C - M     B - M     A)
          /            i, 1          i, 3      i, 2
          ====
          i = 1
(%o3)     ---------------------------------------------
                                5
(%i4) lsquares_estimates_approximate (mse, [A, B, C, D], iprint = [-1, 0]);
(%o4) [[A = - 3.67850494740174, B = - 1.683070351177813,
                 C = 10.63469950148635, D = - 3.340357993175206]]
lsquares_estimates SciMax Toolbox lsquares_estimates_exact