Fitting
Page maintainer: Luciano
| This page is considered done. It been reviewed by an expert. There may be missing elements, but they are all flagged and the text has no errors. |
Intro
Various fit methods are available on the market. The two mostly used at HERMES are the "method of Least Squares" (LS) and the "method of Maximum Likelihood Estimation" (MLE). While the latter can be applied to binned or unbinned data, the first one requires the data points (e.g. the events) to be Gaussian distributed with a known variance. This is achievable if the events are grouped into yields (e.g. bins) with sufficiently high statistics. In general, however, binning results in a loss of information and hence in larger statistical errors for the parameter estimates. As a consequence the unbinned Maximum Likelihood fit method is usually preferable, especially in case of relatively limited statistics (e.g. kaons, two-pions, etc).
Essentials
The method of Least Squares (LS)
Suppose we want to fit a model function that has M adjustable parameters Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle a_j} , Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle j=1,...,M} to N data points Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle (x_i,y_i)} Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle i=1,...,N} , where Fehler beim Parsen (Konvertierungsfehler. Der Server („https://wikimedia.org/api/rest_“) hat berichtet: „Cannot get mml. Server problem.“): {\displaystyle N\geq M} . The model predicts a functional relationship between the measured and independent variables. The "best" values for the parameters Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle a_j} are those for which the model represents an estimator for the underlying real function Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle y(x)} giving rise to the data. If the data points Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle y_i} are Gaussian distributed around the "true" model
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \hat{y}(x;\bar{\alpha})}
with variance , the best fit parameters Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \bar{\alpha}} can be found by minimizing the quantity:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2=\sum_{i=1}^N\frac{[y_i-\hat{y}(x_i;a_1,...,a_M)]^2}{\sigma^2_i}} ,
namely the quadratic sum of differences between measured and hypothesized values, weighted by the inverse of the variance. If the measurements are not independent but described by an N-dimensional Gaussian probability distribution with known covariance matrix Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle C} but unknown mean values, the fit parameters are obtained by minimizing the more general quantity:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2=\sum_{i,j=1}^N\ [y_i-\hat{y}(x_i;a_1,...,a_M)](C^{-1})_{i,j}[y_j-\hat{y}(x_j;a_1,...,a_M)]} ,
which reduces to the previous one if the covariance matrix (and hence its inverse) is diagonal. In general, the inverse covariance matrix Fehler beim Parsen (Konvertierungsfehler. Der Server („https://wikimedia.org/api/rest_“) hat berichtet: „Cannot get mml. Server problem.“): {\displaystyle C^{-1}} is given by:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle (C^{-1})_{i,j}=\frac{1}{2} \bigg[ \frac{\partial^2\chi^2}{\partial a_i \partial a_j} \bigg]_{\alpha=\tilde\alpha}} .
To find the minimum Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2}
one has just to set its derivatives with respect to the parameters Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle a_i}
equal to zero and solve for the parameters. This is usually done very easily with the package MINUIT (see dedicated section below for details).
The minimum value of the Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2}
is distributed according to the distribution with Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle N-M}
degrees of freedom (d.o.f). The chi-square divided by the number of d.o.f. (Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle n_d}
), also known as reduced chi-square, gives a quantitative measure of the goodness-of-fit of the model. If the probability Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle Q}
that the Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2}
should exceed by chance a particular value is very small, then the appearent discrepancies are unlikely to be statistical fluctuations. More likely either the model is inappropriate or the uncertainties Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \sigma_i^2}
are underestimated. If, on the other hand, the probability Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle Q}
is too large (Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2/n_d}
too small) then the uncertainties Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \sigma_i^2}
are likely overestimated.
Linear regression
Although one can carry out the least squares procedure for any function , the case where:
(1) the Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle y_i} Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle i=1,...,N} are independent Gaussian random variables with known variances Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \sigma_i^2} (or are distributed according to an N-dimensional Gaussian with known covariance matrix Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle C} );
(2) the hypothesis (model) is linear in the parameters Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle a_j} ; and
(3) the functional form of the model is correct,
is particularly conveninet since it allows the use of the Linear Regression, which is much faster and deterministic. In this case, indeed, the parameters and their uncertainties can be found analytically. Furthermore, a single absolute minimum exists thus resulting in an unbiased extraction of the fit parameters.
Let's consider a model function which is linear in the parameters Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle a_j} :
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \hat{y}(x;\alpha)=\sum_{j=1}^M q_j(x) a_j} ,
where the functions Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle q_j(x)} are not in general linear in but are linearly independent from each other. The value of the function Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \hat{y}(x;\alpha)} at a certain point Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle x_i} is given by:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \hat{y}(x_i;\alpha)=\sum_{j=1}^M q_j(x_i) a_j=\sum_{j=1}^M Q_{i,j} a_j} .
The general expression for the Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2} then becomes:
Fehler beim Parsen (Konvertierungsfehler. Der Server („https://wikimedia.org/api/rest_“) hat berichtet: „Cannot get mml. Server problem.“): {\displaystyle \chi ^{2}=(y-{\hat {y}}(x,\alpha ))^{T}C^{-1}(y-{\hat {y}}(x,\alpha ))=(y-Q\alpha )^{T}C^{-1}(y-Q\alpha )}
where Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle y=(y_1,...,y_N)} is the vector of measured values and 'T' indicates a transposed (i.e. row) vector.
To find the minimum one has to set its derivatives with respect to the parameters Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle a_j} equal to zero and solve the system of equations:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \nabla\chi^2=-2(Q^TC^{-1}y-Q^TC^{-1}Q\alpha)=0} .
Providing the matrix Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle Q^TC^{-1}Q} is not singular, this can be solved for the estimators :
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \alpha=(Q^TC^{-1}Q)^{-1} Q^TC^{-1}y \equiv By} ,
that is, the solutions Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \alpha} are linear functions of the original measurements Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle y} . Using error propagation one finds the covariance matrix from the general relation:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \tilde C=BCB^T} .
The method of Maximum Likelihood Estimation (MLE)
Let's consider a set of measurements Fehler beim Parsen (Konvertierungsfehler. Der Server („https://wikimedia.org/api/rest_“) hat berichtet: „Cannot get mml. Server problem.“): {\displaystyle (x_{1},...,x_{N})} of some quantity Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle X} , where each measurement Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle x_i} characterizes an event Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle i} . These events are distributed according to a Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle N} -dimensional probability density function (p.d.f) , where Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \alpha=(a_1,...,a_M)} is a set of Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle M} parameters. The method of Maximum Likelihood Estimation (MLE) finds the best values for the parameters by maximizing the Likelihood function:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L(\alpha)=\prod_{i=1}^N f(x_i;\alpha)} ,
which represents the joint p.d.f. for the data set.
A crucial and delicate issue is to properly normalize the p.d.f.. The explicit form for the Likelihood funcion above is indeed given by:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L(\alpha)=\frac{\prod_{i=1}^N f(x_i;\alpha)}{[\mathcal{N}(\alpha)]^N}} ,
where:
Fehler beim Parsen (Konvertierungsfehler. Der Server („https://wikimedia.org/api/rest_“) hat berichtet: „Cannot get mml. Server problem.“): {\displaystyle {\mathcal {N}}(\alpha )=\int f(x;\alpha )dx}
is the normalization integral of the p.d.f.. It can be shown that the normalization integral is independent of the parameters Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \alpha} and can be ignored in the likelihooh maximization if the whole data set has no net polarization. Details and examples on how to implement and normalize correctly the p.d.f. are given in the 'famous' Andy's notes on ML Fit. A more general explanation is given in two documents by Steve Gliske, Introduction to Maximum Likelihood Estimation and Note Regarding MLE and Asymmetries.
Since both Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L} and Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle log(L)} are maximized for the same parameter values Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \bar\alpha} , it is usually preferable to maximize . The maximum likelihood estimators can be found by solving the equation:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \frac{\partial log(L)}{\partial a_i}=0} where Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle i=1,...,M} .
In practice, however, one uses MINUIT (see below) to minimize the quantity Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle -2log(L)} . In general the procedure is similar to that adopted for the Least Squares fit: one can use a dedicated program (let's call it MINUIT_ML.F) linked to a subroutine (let's call it FCN_ML.F) with the definition of the p.d.f. and the Likelihood function, which uses the standard MINUIT commands to minimize the quantity Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle -2log(L)} .
If the analyzer is NOT using the RICH unfolding or weighted MC data:
1) Define properly the p.d.f and the Likelihood function paying attention to correctly normalize the p.d.f
2) find the minimum (e.g. with the MIGRAD command of MINUIT) and get the values of the parameters and the corresponding covariance matrix
If the analyzer is using the RICH unfolding or weighted MC data (i.e. events come with event-weights), a slightly more involved procedure has to be used to get the correct error estimation:
1) define two p.d.f. and log-likelihood functions:
(a) using events-weights
(b) using squared events-weights
2) find the minimum (e.g. with the MIGRAD command of MINUIT) using the definition (a) get values of parameters and covariance matrix (let's call it Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle C_{old}} )
3) on the same minimum extract the covariance matrix (let's call it Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle C_{new}} ) using the definition (b) and the MINUIT command HESSE
4) extract the correct parameters errors from the 'corrected' covariance matrix: Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle C_{corr}=C_{old} \cdot C_{new}^{-1} \cdot C_{old}}
- Note: this does not completely agree with F. T. Solmitz, "Analysis of Experiments in Particle Physics". He has a different quantity instead of Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle C_{new}^{-1}} , although in some cases Fehler beim Parsen (Konvertierungsfehler. Der Server („https://wikimedia.org/api/rest_“) hat berichtet: „Cannot get mml. Server problem.“): {\displaystyle C_{new}^{-1}} reduces to his quantity.
An example is given in minuit_ml.f. Here two different subroutines containing the two different definitions above are called: fcn_ml.f (linear weights) and fcnerr_ml.f (squared weights). To compile need link to cernlib:
f77 -o minuit_ml minuit_ml.f fcn_ml.f fcnerr_ml.f `cernlib mathlib`.
This is just an example; of course one can use a single subroutine with the two definitions and switch between the two to get Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle C_{old}} and Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle C_{new}} .
The two fit methods (Maximum Likelihood and Least Squares) are equivalent in the limit of infinite statistics. If one has to deal with a limited (i.e. Poisson) statistics, then the least squares are not good maximum likelihood estimators and the method of Maximum Likelihood Estimation has to be used. Due to its superiority, it is recommended to always use (when possible) the (unbinned) MLE fit.
A main disadvantage of the MLE fit method is that there is not an immediate way to interpret the goodness of fit (like using the reduced Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2} ), though in general a higher likelihood means a better fit (or possible over fitting). A general theory of goodness-of-fit for binned and unbinned MLE fit can by found in
A Measure of the Goodness of Fit in Unbinned Likelihood Fits: arXiv:physics/0207083
A General Theory of Goodness of Fit in Likelihood Fits: arXiv:physics/0509008
An application of the Goodness of Fit in Unbinned Likelihood can be found in the HERMES Thesis 08-009 (Section 6.6.2, page 153).
The method of Extended Maximum Likelihood Estimation (EMLE)
Let us suppose that instead of recording individual measements Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle x_i \,} , the measurements are histogrammed to yield a set of entries in Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle M \,} bins. The entire histogram can be considered as a single measurement of a multi-dimensional vector. The total number of counts in the extended method is considered to be also a random number variable which obeys the Poisson probablity distribution. The probablility Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L \,} of obtaining this measurement (the Likelihood Function) is therefore given by the product of this probability distribution and the multinomial distribution:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L(\alpha) = \frac{\overline{N}^N}{N!}e^{-\overline{N}} \frac{N!}{n_1!\cdots n_M!}\;p_1^{n_1}\cdots p_M^{n_M} } ,
where
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle n_i = \,} no. of counts in bin Fehler beim Parsen (Konvertierungsfehler. Der Server („https://wikimedia.org/api/rest_“) hat berichtet: „Cannot get mml. Server problem.“): {\displaystyle i\,}
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle M = \, } no. of bins
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle N = \sum_{i=1}^M n_i } is the total no. of counts
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle p_i = \int_{x_i^{min}}^{x_i^{max}}f(x;\alpha)dx} is the probability of getting a single count in bin Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle i \,}
Using the relations Fehler beim Parsen (Konvertierungsfehler. Der Server („https://wikimedia.org/api/rest_“) hat berichtet: „Cannot get mml. Server problem.“): {\displaystyle {\overline {n}}_{i}={\overline {N}}p_{i}} and Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \overline{N}=\sum_{i=1}^M\overline{n}_i} , we can transorm Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L(\alpha) \,} into the
Binned Extended Maximum Likelihood Function
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L(\alpha) = \prod_{i=1}^M \frac{\overline{n}_i^{n_i}}{n_i!}e^{-\overline{n}_i}} ,
(an expected result).
The function which is usually maximized is the logarithm of the Binned EML Function:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle log(L) = \sum_{i=1}^M n_i log (\overline{n}_i) - \overline{N} - \sum_{i=1}^M log(n_i!)}
Let us now consider the case where the size of each bin approaches 0. For any given set of measurements Fehler beim Parsen (Konvertierungsfehler. Der Server („https://wikimedia.org/api/rest_“) hat berichtet: „Cannot get mml. Server problem.“): {\displaystyle (x_{1},...,x_{N})\,} the bins separate into 2 classes: bins that contain 0 counts and bins that contain exactly 1 count. For bins containing 0 counts, the corresponding factor Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \overline{n}_i^{n_i}/n_i!} in the Binned EML Function Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L(\alpha) \,} is 1. For bins containing 1 count, the factor is
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \overline{n}_i^{n_i}/n_i! \rightarrow \overline{n}_i = \overline{N} f(x_i;\alpha) dx_i} , where Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle (i=1, \ldots, N) \,} .
In this limit, the Binnned EML Function becomes
,
where Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle F(x_i;\alpha) \equiv \overline{N} f(x_i;\alpha)} .
The quantity Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L' \,} (a probability density function) becomes the
Unbinned Extended Maximum Likelihood Function
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle L'(\alpha) = e^{-\overline{N}} \prod_{i=1}^N F(x_i;\alpha)}
The function which is usually maximized is the logarithm of this:
Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle log(L') = \sum_{i=1}^N log(F(x_i;\alpha)) - \overline{N} }
Suggested Further Reading
- R. Barlow, Nucl. Instr. and Meth. A297 (1990) 496.
- L. Lyons, W.W.M. Allison and J. Pañella Comellas, Nucl. Instr. and Meth. A245 (1986) 530.
- Glen Cowan, Statistical Data Analysis (Oxford University Press, 1998).
Minuit
Minuit is a very widely used standard tool to find the minimum value of a multi-parameter function. It can be operated directly or by an intermediate program such as HBOOK, PAW or ROOT. Minuit acts on a multi-parameter FORTRAN function FCN which has to be defined and supplied by the user. Using Minuit commands, the user can request Minuit to minimize the function FCN with respect to the parameters, that is, to find those values of the parameters which give the lowest value of . Minuit offers the user a choice of several minimization algorithms. The defoult MIGRAD algorithm is in general the best minimizer for nearly all functions. The width of the function minimum, or more in general, the shape of the function in some neighbourhood of the minimum, gives information about the uncertainty in the best parameters values and allows the determination of the parameters uncertainties. Minuit offers several tools to analyze the parameters uncertainties. The Minuit processors MIGRAD and HESSE normally produce an error matrix (covariance matrix) which is the inverse of the matrix of second order derivatives (the Hessian) of FCN. Therefore, uncertainties based on the Minuit error matrix take into account all the parameter correlations. When the covariance matrix has been calculated, the parameter uncertainties printed by Minuit are the square roots of the diagonal elements of this matrix.
WARNING (NEW!!!)
As reported in the MINUIT web page (http://wwwasdoc.web.cern.ch/wwwasdoc/minuit/node32.html) "MIGRAD usually yields good estimates of the error matrix, but it is not absolutely reliable"
The reason could be either one of the two given below (refer to the web page above for more details):
1. Convergence to the minimum may occur ``too fast for MIGRAD to have a good estimate of the error matrix. For n parameters the number of FCN calls from MIGRAD must be large compared with n^2 in order for the MIGRAD error matrix calculation to be reliable.
2. If the problem is highly non-linear, the error matrix will depend strongly on the parameters, MIGRAD will converge more slowly, and the resulting error matrix will at best represent some average value
The SOLUTION suggested by the MINUIT group is: always call HESSE right after calling MIGRAD.
In this way, MIGRAD will provide the correct minimization and HESSE the correct error matrix.
Details on how to use Minuit can be found in the Minuit Reference manual under "Old Manual of Fortran MINUIT" in MINUIT. Don't be misled by Table 7.1 of the Minuit Reference manual. This treatment is not relevant to the standard definition of statistical uncertainties as defined by the Particle Data Group [W.-M Yao et al. (PDG), Journal of Phys G. 33 (2006), Chapter 32].
Example of PAW commands for a 3-parameters 2-dimensional fit with the method of Least Squares:
vect/fit x y err_y fitfun.for 0 [np] par step ! ! errpar
where [NP] is the number of parameters (3 in this example) and the fit function (FITFUN.FOR) is provided by a separate fortran function:
FUNCTION FITFUN(X)
DIMENSION X(2)
COMMON/PAWPAR/PAR(3)
COMMON/PAWPAR/ERRPAR(3)
FITFUN=
s PAR(1)*sin(X(2)+X(1))+
s PAR(2)*sin(X(2)-X(1))+
s PAR(3)
END
For further details see PAW HISTO/FIT
One can call the MINUIT functions (e.g. to minimize the Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2} ) using a dedicated program (in FORTRAN or C). As an example one can use a "master" program (let us call it MINUIT_LS.F) to:
1) read the data from an external file (input.dat)
2) call a "slave" program (let us call it FCN_LS.F) which contains the definition of the function to be minimized (e.g. the Fehler beim Parsen (MathML mit SVG- oder PNG-Rückgriff (empfohlen für moderne Browser und Barrierefreiheitswerkzeuge): Ungültige Antwort („Math extension cannot connect to Restbase.“) von Server „https://wikimedia.org/api/rest_v1/“:): {\displaystyle \chi^2} )
3) call the Minuit functions MIGRAD (to minimize) and HESSE (to get the parameter errors)
4) write the values of the fit parameters (plus errors) on an output file (output.dat)
A user-friendly example (in FORTRAN) is provided in minuit_ls.f and fcn_ls.f. To compile need link to cernlib:
f77 -o minuit_ls minuit_ls.f fcn_ls.f `cernlib mathlib`.
Other Packages for Minimization/Maximization
Many other standard minimization packages exist besides Minuit. For example, both the Boost library (C++) and the GNU Scientific Library (C/C++) have several minimization and root finding functions, some of which can utilize first and second derivatives. An independent C or C++ code using these libraries will determine the fit parameters (For either regression or MLE) much faster than calling Minuit from within PAW or ROOT.
More Info
For a detailed description see
Technical Doucmentation
Documents by Collaborators
- Stephen Gliske's Intro. to Maximum Likelihood Estimation (August 2009)
- Stephen Gliske's Note Regarding MLE and Asymmetries (August 2009) (discusses proper interpretation of fit parameters for polarized data samples, as well as in the context of acceptance correction. A clarification of the link below to Andy Miller's email from 13.4.2008. Updated from an older version(March 2009)
- Latest Andy Miller's notes on Maximum Likelihood Fit
- Andy Miller's mail 13.4.2008: "Which asymmetry Maximum Likelihood produces"
- Xianguo Lu's Maximum likelihood lecture during DVCS week in Sept. 2007
Publications
- Solmitz's review about statistics in particle physics (including the Solmitz Correction)
- Error estimation with Maximum Likelihood fits Note: this document includes a number of errors, including missing a factor in the normalization. Equation 3 is also wrong, as the covariance matrix is the matrix inverse of the Hessian matrix, not the element by element inverse as he suggests. In addition, he states the equation on the top of page 9 comes from his Reference 9 (the Solmitz paper), yet this equation disagrees with the Solmitz paper (as does this page, as of August, 2009).
- arXiv:physics/0207083 A Measure of the Goodness of Fit in Unbinned Likelihood Fits:
- arXiv:physics/0509008 A General Theory of Goodness of Fit in Likelihood Fits
Weblinks
- Paul Avery: Fitting Theory Writeups and References (also: track finding and fitting, also taking into account multiple scattering)
- Volker Blobel: track finding and fitting
Code Repository
- Maximum Likelihood
- Physica macro to fit the DVCS Longitudinal Target Spin Asymmetry (LTSA) Courtesy A. Miller.
- README how to run fitdvcsltsa.pcm
- Example input file (DVCS events from real data. For MC data, the weights can be different from 1.0000)
- The output file (when running the script with the given input file) is contained in the README
- Physica logfile physica.journal when running the script with the given input file
- Physica macro to fit the DVCS Longitudinal Target Spin Asymmetry (LTSA) Courtesy A. Miller.