< Mujpy.Methods2 | Index | Mujpy.Tests >
There is a small diffeernce in the asymmetry fit of mujpy and musrfit, when count rate ratio {$\alpha$} is a free fit parameter. They obtain the same minimum but the chisquare values per degree of freedom, fcn/ndof in minuit parlance, deviate by a percent. Below it is explained why.
The definition of the experimental data {$y_i$} and function {$y_{\mathrm th}(t)$} that appear in
{$$\chi^2
= \sum_i \left(\frac { y_i - y_{\mathrm th}(t_i)} { \sigma_i }\right)^2 $$}
are different.
- For mujpy:
- the data are the (approximate) muon decay asymmetry {${\mathcal A}_i$} that are extracted from forward and backward detector count rates {$N_{\mathrm{F,B} i} $} at time {$t_i$} with a parameter {$\alpha$} that would yield zero asymmetry for an unpolarized beam, according to
{$$\begin{equation} \tag{1} {\mathcal A}_i = \frac {N_{\mathrm{F}i}-\alpha N_{\mathrm{B}i}}{N_{\mathrm{F}i}+\alpha N_{\mathrm{B}i}} \end{equation} $$}
- this combination reproduces the decay asymmetry {$ A_{\mathrm{th}} (t) = A_0 P(t)$}, where {$P(t)$} is the ensemble average of the muon spin polarization, and {$A$} a constant whose value is typically in the order of 0,3. assuming that the forward and backward count rates, after background count rate correction, obey
{$$\begin{equation}\tag{2} N_{\mathrm{F,B}i} = N_{0\mathrm{F,B}} e^{-t_i/\tau_\mu} \left[ 1\pm A_0 P(t_i)\right] \end{equation}$$}
- notice that here {$N_{0\mathrm{F}} = \alpha N_{0\mathrm{B}}$}
- the function models the asymmetry {$ A_{\mathrm{th}} (t)$} to optimally represent the ensamble polarization function {${\mathcal A}_i$} and the chisquare is normalized by the std {$\sigma_i$} calcolated by error propagation from Poisson count statistics for Eq. (1)
- For musrfit
- the data are used to produce the experimental uncorrected muon decay asymmetries to be used in Eq. (1)
{$$ \begin{equation}\tag{3}{\mathcal A}_{\mathrm u i} = \frac {N_{\mathrm{F}i} - N_{\mathrm{B}i}}{N_{\mathrm{F}i} + N_{\mathrm{B}i}} \end{equation}$$}
- musrfit simulates the same theoretical asymmetry as mujpy, {$ A_{\mathrm th}(t) $}, and uses this to model the uncorrected asymmetry. The corresponding theoretical function for Eq. (1), {$\mathcal A_{\mathrm {u,th}}$}, can be substituted to {$A_0 P(t_i)$} in Eq. (2). Musrfit does it with the opposite definition for {$\alpha^\prime=1/\alpha$}, {$ N_{0\mathrm{B}} = \alpha^\prime N_{0\mathrm{F}} $} plus a further distinction {$A_{0\mathrm{B}} = \beta A_0$} so that the count rates are
{$$ \begin{align}
\tag{5}
N_{\mathrm{F}i} &= N_{0} e^{-t_i/\tau_\mu} \left[ 1\ + A_0 P(t_i)\right] \\
N_{\mathrm{B}i} &= \alpha^\prime N_{0} e^{-t_i/\tau_\mu} \left[ 1 - \beta A_0 P(t_i)\right]
\end{align}
$$}
- For {$\beta=1$} the mujpy case is reproduced. The condition {$\beta\ne 1$} is indeed realized in practice, e.g. in GPD, but the fit yields large parameter correlations and convergence problems. Fixing {$\beta=1$} is the standard solution. This yields effective average total asymmetries, but absolute experimental asymmetries are generally not a quantity of interest.
- Replacing Eq. (5) into Eq. (3) one obtains
{$$ \begin{equation} \tag {6} A_{\mathrm {u, th}}(t) = \frac {A_{\mathrm {th}}(t) (1+\alpha^\prime\beta) + 1-\alpha^\prime}{1+\alpha^\prime - A_{\mathrm {th}}(t) (\alpha^\prime\beta-1)} \end{equation} $$}
- musrfit performs chisquare (and log-likelihood) minimization of the deviations between Eq. (6) and Eq. (3), using the experimental standard deviations for Eq. (3).
- To cast the full Eq. (6) into mujpy terms implies using {$\alpha$} in
{$$ \begin{align}
\tag{7}
N_{\mathrm{F}i} &= N_{0} e^{-t_i/\tau_\mu} \left[ 1\ + {\mathcal A}_i \right] \\
N_{\mathrm{B}i} &= \frac 1 \alpha N_{0} e^{-t_i/\tau_\mu} \left[ 1 - \beta {\mathcal A}_i\right]
\end{align}
$$}
- It is easy to check by direct substitution that the experimental asymmetry {${\mathcal A}_i$} can be retrieved to be directly compared with {$A_{\mathrm {th} i}$} as
{$$
\begin{equation}
\tag{8} {\mathcal A}_i = \frac {N_{\mathrm{F}i}-\alpha N_{\mathrm{B}i}}{\beta N_{\mathrm{F}i} + \alpha N_{\mathrm{B}i}}
\end{equation}
$$}
However, this option will not be included in mujpy, since it is practically never used.
Conclusion on chisquare comparison
- As anticipated, the parameter value minima are consistent within estimated errorbars in all tested cases.
- However, when forward-backward rate ratios {$\alpha$} are fit parameters, the minimum reduced chisquare values deviate sligtly for the two methods (typically by few parts permil)
- This is attributed to the different role of a systematic statistical imprecision, common to both methods: the (small) statistical uncertainty of the ratio parameter is ignored in the chisquare denominator. It should be included but theere is no way to determine this analytically, and the contribution is very small, so both mujpy and musrfit ignore it.
- The different role of {$\alpha$} in the two chisquare definitions may explain why they are affected differently: both are very slightly wrong, probably the right chisquare value is in between.
- Checked: fits where {$\alpha$} is fixed to the same value, have reduced chisquare agreement within the permil level.
Error propagation in rebinning
- mujpy treats rebinned histograms as the sums of adjacent bins, musrfit treats them as the per bin average. It should be the same. Let's consider the simple {$\alpha=1$} case for mujpy
- the sum over {$M$} bins is {$f = \sum_i f_i, b = \sum_i b_i$} and since {$f_i, b_i$} are counts, they have Poisson variances {$\sigma^2_f= \sum_i \sigma_{f,i}^2=\sum_i f_i = f$} and {$\sigma^2_b= \sum_i \sigma_{b,i}^2 = \sum_i b_i = b$}, respectively
- with {$A = (f-b)/(f+b)$} and {$\sigma_A = 2\sqrt{\sigma_f^2 b^2+ \sigma_b^2 f^2}/(f+b)^2$} becomes {$\sigma_A = 2\sqrt{f b^2+ b f^2}/(f+b)^2$}
- for musrfit
- the averages over {$M$} bins are now {$\overline{f} = \sum_i f_i/M = f/M$} and {$\overline{b} = \sum_i b_i/M = b/M$} respectively, with {$\sigma^2_f= \sum_i \sigma_{f,i}^2/M^2=\sum_i f_i/M^2 = \overline{f}/M = f/M^2$} and {$\sigma^2_b = \overline{b}/M= f/M^2$}, respectively
- the asymmetry is the same, since the numerator and denominator both have factor {$1/M$} that cancel out. As for the standars deviation on A it also doesn't make a difference as it should
{$$\sigma_A = \frac 2 {(\overline{f}+\overline{b})^2} \sqrt{\overline{b}^2\frac{\overline{f}}M+\overline{f}^2\frac {\overline{b}}M} = \frac {2M^2} {(f+b)^2} \sqrt{\frac {b^2}{M^2}\frac f{M^2}+\frac {f^2}{M^2}\frac f{M^2}}$$}
Hence forget the division by {$M$}, unless you want to fit decay histograms without renormalizing the fit function when you plot it packed.
What really mujpy does is the following
- rebin is used directly in mufitplot.plot_run twice (for rrf), indirectly by mufitplot.chi (perhaps the fft block as well) that calls
- mumodel._rebin_plot_
- rrf rebins unbinned asymmetries and errors
- mufit calls only indirectly, in mufit.dofit_ that calls
- mumodel itself calls rebin three times in _rebin_ and as many in _rebin_plot_, each acting on
- (yf, eyf), (yb, eyb), on grouped detector counts and their std, for calib and then calculating rebinned mumodel._asymmetry_
- (y,e) on unbinned a, ea, forn non calib
The same average procedure is applied to calib counts and to non calib asymmetry as well as to rrf (calib and non calib), whereas calib asymmetry is calculated on already rebinned quantities. Not really homogeneous. What about right, in principle? See Mujpy.Asymmetry
< Mujpy.Methods2 | Index | Mujpy.Tests >