D501: Constrained Non-Linear Least Squares and Maximum Likelihood Estimation

Author(s): W. Mönch, B. Schorr Library: MATHLIB
Submitter: W. Mönch Submitted: 15.03.1993
Language: Fortran Revised:

LEAMAX is a portable collection of subprograms for solving general non-linear least squares problems, non-linear data fitting problems, and maximum likelihood estimations.

Subroutine subprograms RSUMSQ, RFUNFT, RMAXLK and DSUMSQ, DFUNFT, DMAXLK calculate an approximation to a minimum of an objective function tex2html_wrap_inline385 , with respect to n unknown parameters tex2html_wrap_inline389 :

(S)
The general non-linear least squares problem

displaymath391

(F)
The least squares data fitting problem

displaymath393

(M)
The maximum likelihood estimation

displaymath395

subject to bounds on the variables of the form

displaymath397

The functions tex2html_wrap_inline399 (i=1,...,m) and tex2html_wrap_inline403 are arbitrary non-linear functions with respect to the argument a. In the case of the data fitting problem (F), a set of observation data tex2html_wrap_inline407 with their corresponding weights tex2html_wrap_inline409 (i=1,...,m) has to be provided, whereas for the maximum likelihood estimation (M), the set of data points tex2html_wrap_inline413 belongs to the input of the problem.

These subprograms are based on the algorithm described by Moré (Ref. 1) for finding the solution of a general non-linear least squares problem by using the Levenberg-Marquardt algorithm. The method is completed by an active set strategy for handling simple box constraints to the unknown parameters (see Long Write-up for details). The necessary derivatives can either be supplied by the user (subprogram SUB) or are approximated numerically. In the case of a non-linear data fitting problem, approximations to the covariance matrix and the standard deviations of the model parameter estimators are also provided.

On computers other than CDC or Cray, only the double-precision versions DSUMSQ, DFUNFT, DMAXLK are available. On CDC and Cray computers, only the single-precision versions RSUMSQ, RFUNFT, RMAXLK are available.

Structure:

SUBROUTINE subprograms
User Entry Names: RSUMSQ, RFUNFT, RMAXLK, DSUMSQ, DFUNFT, DMAXLK
Internal Entry Names: D501L1, D501L2, D501SF, D501P1, D501P2, D501N1, D501N2
External References:
RGEQPF,RORMQR, RTRTRS, DGEQPF,
DORMQR,DTRTRS, RVSET, RVSCL,
RVSUB, RVCPY, RVMPY, DVSET,
DVSCL, DVSUB, DVCPY, DVMPY,
RMSET, RMSCL, RMCPY, RMMPY,
RMBIL, DMMLT, DMSET, DMSCL,
DMCPY, DMMPY, DMBIL,
RMMLT, DMMLT, RSINV, DSINV
@l User-supplied SUBROUTINE subprogram

Usage:

For tex2html_wrap_inline415 (type REAL), tex2html_wrap_inline417 (type DOUBLE PRECISION):

(S) General non-linear least squares problem

    CALL tSUMSQ(SUB,M,N,NC,A,AL,AU,MODE,EPS,MAXIT,IPRT,
   +            MFR,IAFR,PHI,DPHI,COV,STD,W,NERROR)
(F) Least squares data fitting problem
    CALL tFUNFT(SUB,K,M,N,NX,NC,X,Y,SY,A,AL,AU,MODE,EPS,MAXIT,IPRT,
   +            MFR,IAFR,PHI,DPHI,COV,STD,W,NERROR)
(M) Maximum likelihood estimation
    CALL tMAXLK(SUB,K,M,N,NX,X,A,AL,AU,MODE,EPS,MAXIT,IPRT,
   +            MFR,IAFR,PHI,DPHI,W,NERROR)
SUB
Name of user-supplied SUBROUTINE subprogram, declared EXTERNAL in the calling program. This subprogram must provide the values of the functions tex2html_wrap_inline419 , tex2html_wrap_inline421 , and, if tex2html_wrap_inline423 , the values of the derivatives tex2html_wrap_inline425 and tex2html_wrap_inline427 tex2html_wrap_inline429 (see Examples).
K
(INTEGER) Cases (F) and (M): dimension k of a data point (observation) tex2html_wrap_inline433 .
M
(INTEGER) Case (S): number of non-linear functions tex2html_wrap_inline435 ; cases (F) and (M): number of data points (observations).
N
(INTEGER) Number of unknown parameters a.
NX
(INTEGER) Cases (F) and (M): declared first dimension of array X in the calling program, tex2html_wrap_inline439 .
NC
(INTEGER) Cases (S) and (F): declared first dimension of array COV in the calling program, tex2html_wrap_inline441 .
X
(Type according to t) Cases (F) and (M): two-dimensional array of dimension tex2html_wrap_inline443 . On entry, X must contain the data set { tex2html_wrap_inline445 } (the i-th column of X belongs to the data point tex2html_wrap_inline449 , i=1,...,m).
Y
(type according to t) Case (F): one-dimensional array of length tex2html_wrap_inline453 , contains, on entry, the data set { tex2html_wrap_inline455 }.
SY
(type according to t) Case (F): one-dimensional array of length tex2html_wrap_inline457 , contains, on entry, the weights { tex2html_wrap_inline459 } of the data points.
A
(Type according to t) One-dimensional array of length tex2html_wrap_inline461 . On entry, A(J) must contain the starting value of tex2html_wrap_inline463 for the Levenberg-Marquardt algorithm. On exit, A(J) contains an approximation to tex2html_wrap_inline465 of a minimum point (if the algorithm was successful).
AL
(Type according to t) One-dimensional array of length tex2html_wrap_inline467 . On entry, AL(J) must contain the lower bound tex2html_wrap_inline469 of tex2html_wrap_inline471 .
AU
(Type according to t) One-dimensional array of length tex2html_wrap_inline473 . On entry, AU(J) must contain the upper bound tex2html_wrap_inline475 of tex2html_wrap_inline477 .
MODE
(INTEGER)
tex2html_wrap_inline479 The derivatives are approximated by divided differences.
tex2html_wrap_inline481 The derivatives are to be supplied by subprogram SUB.
Other values for MODE are treated as MODE = 0.
EPS
(Type according to t) User-supplied tolerance used to control the termination criterion. EPS should be chosen according to the accuracy required by the problem and the machine accuracy t (recommended value on entry: between tex2html_wrap_inline483 for t = R , and tex2html_wrap_inline485 for t = D, respectively).
MAXIT
(INTEGER) Maximum permitted number of iterations.
IPRT
(INTEGER) Printing control.
tex2html_wrap_inline487 no printing of intermediate results,
tex2html_wrap_inline489 tex2html_wrap587
MFR
(INTEGER) On exit, MFR contains the number of free variables at the solution point.
IAFR
(INTEGER) One-dimensional array of length tex2html_wrap_inline495 for cases (S) and (F), and of length tex2html_wrap_inline497 for case (M), used as working space. On exit, the first MFR elements of IAFR contain the indices of the free variables at the solution point.
PHI
(Type according to t) On exit, PHI contains the value of the objective function tex2html_wrap_inline499 at the solution point.
DPHI
(Type according to t) One-dimensional array of length tex2html_wrap_inline501 . On exit, DPHI(J) contains the derivative tex2html_wrap_inline503 of tex2html_wrap_inline505 with respect to tex2html_wrap_inline507 (j-th component of the gradient of tex2html_wrap_inline509 ) at the solution point.
COV
(Type according to t) Cases (S) and (F): two-dimensional array of dimension tex2html_wrap_inline511 . On exit, COV contains an approximation to the covariance matrix.
STD
(Type according to t) Cases (S) and (F): one-dimensional array of length tex2html_wrap_inline513 . On exit, STD(J) contains an approximation to the standard deviation of the estimator of the model parameter tex2html_wrap_inline515 .
W
(Type according to t) One-dimensional array of length tex2html_wrap_inline517 for cases (S) and (F), and of length tex2html_wrap_inline519 for case (M), used as working space.
NERROR
(INTEGER) Error indicator. On exit:
tex2html_wrap_inline521 No error or warning detected.
tex2html_wrap_inline523 tex2html_wrap589
tex2html_wrap_inline529 The maximum number MAXIT of iterations has been reached.
tex2html_wrap_inline531 tex2html_wrap591
tex2html_wrap_inline537 tex2html_wrap593

Examples:

For the user-supplied SUBROUTINE subprogram SUB write for instance in the case tex2html_wrap_inline539 :

(S) Objective function (Brown badly-scaled function, tex2html_wrap_inline541 ):

displaymath543

.

      SUBROUTINE SUB(N,A,M,F,DF,MODE,NERROR)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      PARAMETER (Z0 = 0)
      DIMENSION A(*),F(*),DF(M,*)
      NERROR=0
      F(1)=A(1)-1D6
      F(2)=A(2)-2D-6
      F(3)=A(1)*A(2)-2
      IF(MODE .NE. 1) RETURN
      CALL DMSET(M,N,Z0,DF(1,1),DF(1,2),DF(2,1))
      DF(1,1)=1
      DF(2,2)=1
      DF(3,1)=A(2)
      DF(3,2)=A(1)
      RETURN
      END

(F) Objective function (Bard function, tex2html_wrap_inline545 ):

displaymath547

.

      SUBROUTINE SUB(K,X,N,A,F,DF,MODE,NERROR)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DIMENSION A(*),X(*),DF(*)
      T=X(2)*A(2)+X(3)*A(3)
      IF (T .EQ. 0) THEN
       NERROR=3
      ELSE
       NERROR=0
       F=A(1)+X(1)/T
       IF(MODE .NE. 1) RETURN
       DF(1)=1
       DF(2)=-X(1)*X(2)/T**2
       DF(3)=-X(1)*X(3)/T**2
      ENDIF
      RETURN
      END

(M) Objective function ( tex2html_wrap_inline549 ):

displaymath551

.

      SUBROUTINE SUB(K,X,N,A,F,DF,MODE,NERROR)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DIMENSION A(*),X(*),DF(*)
      PARAMETER (PIR = 0.56418 95835 47756 287D0)
      NERROR=3
      IF(A(1) .LE. 0) RETURN
      T=0.5D0*((X(1)-1)/A(1))**2
      F=PIR*EXP(-T)/A(1)
      NERROR=0
      IF(MODE .EQ. 1) DF(1)=-F*(1-2*T)/A(1)**2
      RETURN
      END

In all three cases the parameters K , N , A , M , MODE , NERROR are as declared above. The other parameters are the following:

F
(Type according to t) Case (S): one-dimensional array of length tex2html_wrap_inline553 . F(I) must contain the function value tex2html_wrap_inline555 at a tex2html_wrap_inline559 , on exit.
Cases (F) and (M): F must contain the function value f(x,a) at (x,a), on exit.
DF
(Type according to t) If MODE = 1 values of DF are supplied by SUB. For other values of MODE the parameter DF is not referenced.
Case (S): two-dimensional array of dimension tex2html_wrap_inline565 . DF(I,J) must contain the value of the partial derivative tex2html_wrap_inline567 at a, tex2html_wrap_inline571 , on exit.
Cases (F) and (M): one-dimensional array of length tex2html_wrap_inline573 . DF(J) must contain the value of the partial derivative tex2html_wrap_inline575 , tex2html_wrap_inline577 , on exit.
X
(Type according to t) Cases (F) and (M): one-dimensional array of length tex2html_wrap_inline579 for one data point tex2html_wrap_inline581 (in contrast to above declaration).

References:

  1. J.J. Moré, The Levenberg-Marquardt algorithm: Implementation and theory, In: Numerical Analysis, G.A. Watson (Ed.), Lecture Notes in Mathematics 630, Springer-Verlag, New York (1977) 105-116.
  2. Å.Björck: Solution of Equations in tex2html_wrap_inline583 (Part 1: Least Squares Methods). In: Handbook of Numerical Analysis, P.G.Ciarlet, J.L.Lions (Eds.), North-Holland, Amsterdam, New York, Oxford, Tokyo, 1990, 467-636.
  3. R.Fletcher: Practical Methods of Optimization. John Wiley and Sons, Chichester, 2nd Edition, 1987.
tex2html_wrap_inline585

Michel Goossens Wed Jun 5 00:48:44 METDST 1996