MINUIT command
Syntax: |
MINUIT y=expression
|
Qualifiers: |
\MINIMIZE, \MIGRAD, \SIMPLEX, \UPDATE, \WEIGHTS, \CHISQ, \VARNAMES, \MESSAGES |
Defaults: |
\MINIMIZE, \-WEIGHTS, \-CHISQ, \-VARNAMES, \MESSAGES |
Examples: |
MINUIT Y=A*X+B |
This command accesses the CERN Minuit package for function minimization
and error analysis. The command is very similar to the
FIT
command. The variable
parameters are defined with the SCALAR\FIT
command. The expression to be fitted must result in a vector with the same length as the
data variable y
.
For detailed information on Minuit, please refer to the Minuit Home Page at http://seal.web.cern.ch/seal/work-packages/mathlibs/minuit/home.html
This implementation is open to suggestions from users for enhancements.
If your expression calculates the chi-square value, you can just enter the
expression
, instead of the usual y=expression
.
Method
By default, or with the \MINIMIZE
qualifier, the
MIGRAD method is tried first, and if that fails to converge, the SIMPLEX method will be
tried and then the MIGRAD method again.
If the \MIGRAD
qualifier is used, the MIGRAD method is used, which "is the best minimizer
for nearly all functions. It is a variable-metric method with inexact line search, a stable
metric updating scheme, and checks for positive-definiteness.... Its main weakness is that
it depends heavily on knowledge of the first derivatives, and fails miserably if they are
very inaccurate."
If the \SIMPLEX
qualifier is used, the SIMPLEX method is used. "This genuine multidimensional
minimization routine is uusually much slower than MIGRAD, but it does not use first derivatives".
Fitting parameters
There is no maximum number of fitting parameters allowed in the expression, but
fifteen (15) parameters is probably a practical limit. Variable fitting parameters are
created with the SCALAR\FIT
command, and can be converted to fixed value scalar
variables with the SCALAR
command.
If the \VARNAMES
qualifier is used, an array text variable named
FIT$VAR
will be made which will contain the names of the
fitting parameter variables. The array length of FIT$VAR
will be equal to the number of fitting parameters.
The SCALAR
command allows for limits to be placed on a fitting parameter. Use the
a[amin:amax]
syntax to create fit parameter a
with lower limit
amin
and upper limit amax
. To set an upper limit only, use
a[:amax]
, and to set a lower limit only, use a[amin:]
. These limits are
only used by the MINUIT
command and are ignored by the FIT
command.
Weights
The \WEIGHTS
qualifier must be used if you want to enter a vector of weights.
The optional weight vector will then be expected. The weights are assigned
to the dependent variable in a one-to-one fashion, so the length of the weight
vector must be the same as the length of the data vectors.
χ2
If the \CHISQ
qualifier is used, a scalar named
FIT$CHISQ
will be made with value
equal to the total chi-square. The chi-square is calculated as sum(w*(y-expression)^2)
where w
is the weight vector, y
is the data vector, and
expression
contains the variable parameters to be fitted.
Output messages
If the \-MESSAGES
qualifier is used, then there will be no
informational messages output to the display window.
Update after a fit
The MINUIT\UPDATE yout
command evaluates
the previously fitted expression, that is, the expression
in the last MINUIT
command, for the current
parameter values, and stores this result in the vector yout
.
This is exactly equivalent to entering: yout=previously_fitted_expression
and is provided only to obviate the necessity of re-entering a complicated expression.
Note: The vector name yout usually differs from the name of the vector being fitted to avoid destroying the original data.