# calc_mlr

sherpa.utils.calc_mlr(delta_dof, delta_stat)[source] [edit on github]

Compare two models using the Maximum Likelihood Ratio test.

The Maximum Likelihood Ratio (MLR) test is a model comparison test; that is, it is a test used to select from two competing models which best describes a particular data set. A model comparison test statistic, T, is created from the best-fit statistics of each fit; as with all statistics, it is sampled from a probability distribution p(T). The test significance is defined as the integral of p(T) from the observed value of T to infinity. Thesignificance quantifies the probability that one would select the more complex model when in fact the null hypothesis is correct. See also `calc_ftest`.

Parameters:
• delta_dof (int or sequence of int) – change in the number of degrees of freedom

• delta_stat (number or sequence of number) – change in the best-fit statistic value

Returns:

sig – The significance, or p-value. A standard threshold for selecting the more complex model is significance < 0.05 (the ‘95% criterion’ of statistics).

Return type:

number or ndarray

Notes

The MLR test should only be used when:

• the simpler of the two models is nested within the other; that is, one can obtain the simpler model by setting the extra parameters of the more complex model (often to zero or one);

• the extra parameters have values sampled from normal distributions under the null hypothesis (i.e., if one samples many datasets given the null hypothesis and fits these data with the more complex model, the distributions of values for the extra parameters must be Gaussian);

• those normal distributions are not truncated by parameter space boundaries;

• the best-fit statistics for each fit are sampled from the chi-square distribution.

See Protassov et al. 2002  for more discussion.

References

Examples

In this example, the more-complex model has 2 extra degrees of freedom and a statistic value that is larger by 3.7. The MLR test does not provide any evidence that the complex model is a better fit to the data than the simple model since the result is much larger than 0.

```>>> calc_mlr(2, 3.7)
0.15723716631362761
```