next up previous
Next: About this document ...

FIT EXAMPLE

November 1, 2010



This is an example of a fit done using Root, which in turn uses the MINUIT software package for fitting. This example is based on one in Cowan.

Here is the example script. The program creates random histograms according to the function
$f(x;\alpha,\beta) = \frac{1+\alpha x + \beta
x^2}{(x_{\rm max}-x_{\rm min})+ \...
...2}(x_{\rm
max}^2-x_{\rm min}^2)+\frac{\beta}{3}(x_{\rm max}^3-x_{\rm
min}^3)}$,

where the true values of the parameters are $\alpha=0.5$ and $\beta=0.5$. Values of $x$ range from $x_{\rm min}$ to $x_{\rm max}$ and the distribution is normalized over this interval. Each ``experiment'' corresponds to a distribution of 2000 $x$ values chosen according to this function. The data are then fit to this functional form to determine the parameters $\alpha$ and $\beta$. The best-fit values $\hat{\alpha}$ and $\hat{\beta}$ are determined, and so are the components of the error matrix for the fit.

The output for a fit of one ``experiment'' is shown in Figure 1.

Figure 1: Distribution of $x$ for a single ``experiment'', also showing the curve corresponding to the best-fit parameters $\hat{\alpha}$ and $\hat{\beta}$.
\includegraphics[height=2.8in]{angfit.eps}

The best-fit parameters for this specific experiment are $\alpha=0.486$, $\beta=0.381$; and the square roots of the values of the error matrix entries (output of MINUIT) are $\sigma_{\hat{\alpha}}=0.046$, $\sigma_{\hat{\beta}}=0.091$, $\sigma_{\hat{\alpha}\hat{\beta}}=0.041$. Note that the covariance is non-zero, indicating that the best-fit estimates are correlated.

Figure 2: Distribution over experiments of best fit values.
\includegraphics[height=2.8in]{alpha.eps} \includegraphics[height=2.8in]{beta.eps}

Figure 3: 2D plot of best fit values, with error ellipse for one particular data set superimposed.
\includegraphics[height=2.8in]{2d.eps}

The program loops over a total of 500 ``experiments'', each time choosing a different random distribution (for the same true parameter values) and re-doing the fit. Figure 2 shows the distributions of $\hat{\alpha}$ and $\hat{\beta}$ values for all of the experiments. Figure 3 shows a 2D plot of $\hat{\beta}$ versus $\hat{\alpha}$ for the set of experiments. The central red star corresponds to the true parameter values. The ellipses shown are the $1\sigma$ and $2\sigma$ error ellipses for the parameters, for one particular random data set and fit (the same one as shown in Figure 1). The correlation between the best-fit estimated parameters is manifest in the slope of the ellipses: if $\alpha$ is overestimated for a particular dataset, then so will $\beta$ be likely overestimated, and similarly, if $\alpha$ is underestimated, $\beta$ will likely also be underestimated.




next up previous
Next: About this document ...
Kate Scholberg 2014-11-21