Skip to content

Home / Monte Carlo / Model Building / Fit From Data / Math Details

Math Details

What each column of the results grid is, what it is allowed to be, and when it reads NA. What the tool is for is on Fit Distribution from Data, and the controls are on Options.

What this page does not cover

How Quantum XL estimates each distribution's parameters is not documented, and neither is how it arrives at the p-value or how it orders the grid internally. The published quantities the columns report are defined below and cited in the references, so the mathematics can be looked up. What is not written down here is how Quantum XL computes them.

Notation

Term Description
\(n\) the number of numeric values in the range you selected
\(k\) the number of parameters the distribution has
\(\mathcal{L}\) the likelihood at the fitted parameter values
\(\ln \mathcal{L}\) the log-likelihood, the Log-likelihood column
\(F\) the fitted distribution's cumulative distribution function
\(x_{(i)}\) the \(i\)-th smallest of the selected values

Log-likelihood

The Log-likelihood column is \(\ln \mathcal{L}\) evaluated at the fitted parameters: how probable the data you selected is under the distribution that was fitted to it.

Larger is better, and it is almost always negative. It is not comparable across data sets, only across distributions fitted to the same values, which is exactly the comparison this grid is for.

On its own it cannot choose between distributions of different sizes. A distribution with more parameters can always reach a log-likelihood at least as large as one nested inside it, so ranking on \(\ln \mathcal{L}\) alone rewards complexity for its own sake. That is what the next two columns exist to correct.

AICc, the corrected Akaike information criterion

\[ \mathrm{AICc} = -2 \ln \mathcal{L} + 2k + \frac{2k(k+1)}{n - k - 1} \]

Smaller is better. The first two terms are Akaike's original criterion: twice the negative log-likelihood, plus a penalty of two per parameter. The third is the small-sample correction, which grows as \(n\) approaches \(k\) and vanishes as \(n\) grows large.

The column is labelled AICc rather than AIC because the correction term is always present. There is no setting that removes it.

It reads NA when \(n - k - 1\) is zero or negative. The smallest range this tool accepts is four values, and a three-parameter distribution fitted to four values gives \(4 - 3 - 1 = 0\), so the correction term is a division by zero. That row's AICc is not finite and is shown as NA, while its other columns are unaffected.

BIC, the Bayesian information criterion

\[ \mathrm{BIC} = -2 \ln \mathcal{L} + k \ln n \]

Smaller is better. It penalises each parameter by \(\ln n\) rather than by 2, so for any \(n\) above about 8 it penalises complexity more heavily than AICc does, and increasingly so as \(n\) grows.

AICc and BIC can disagree, and when they do it is usually about a distribution with an extra parameter that buys a modest gain in fit. Neither is wrong. They answer slightly different questions, which is why the grid shows both and lets you sort by either.

The Anderson-Darling statistic

The Anderson-Darling column is \(A^2\), an empirical distribution function statistic that measures the distance between the fitted distribution and the data:

\[ A^{2} = -n - \frac{1}{n} \sum_{i=1}^{n} (2i - 1) \left[ \ln F\!\left(x_{(i)}\right) + \ln\!\left(1 - F\!\left(x_{(n+1-i)}\right)\right) \right] \]

Smaller is better, and unlike the two information criteria it carries no penalty for the number of parameters: it measures fit alone.

Anderson-Darling weights the tails more heavily than the comparable Kolmogorov-Smirnov and Cramer-von Mises statistics do, which is why it is the statistic reported here. For a Monte Carlo input the tails are usually the part of the distribution that decides the answer.

The figure shown is the statistic itself, not a version adjusted for the sample size.

The p-value

The p-value column is the significance level attached to \(A^2\): large is good, in the sense that a small p-value is evidence the data did not come from the fitted distribution.

It is the one column where large is better rather than smaller, which is worth remembering when reading across a row.

Four forms appear in this column:

Shown What it means
0.1234 the reported value
< 0.0050 the true value is below the number shown, which is as low as the engine reports exactly
> 0.2500 the true value is above the number shown, which is as high as the engine reports exactly
NA this distribution reports no p-value at all

The bounded forms are not a failure. They mean the statistic fell outside the range over which an exact figure is available, and the direction is still the useful information: a < row fits poorly and a > row fits well enough that the exact number would not change a decision.

Several distributions report no p-value at all and show NA in this column while still reporting \(A^2\), AICc, BIC and a log-likelihood. Such a row is still selectable and can still be marked.

Reading the four together

They do not have to agree, and when they do not, the disagreement is informative.

If Then
Anderson-Darling is small and AICc is large the shape fits, but it is paying for parameters it does not need
AICc is small and the p-value is small the best of the candidates offered, and still not a good fit to this data
AICc and BIC pick different rows the difference between them is one parameter's worth of complexity
Every p-value is small no offered distribution describes this data well; consider a custom distribution

The grid's own ordering puts the distribution most likely to fit at the top whichever column you sort by, so the top row is a recommendation and these columns are how you audit it.

See Also

References

The Anderson-Darling statistic

  1. Anderson, T. W., & Darling, D. A. (1952). Asymptotic theory of certain "goodness of fit" criteria based on stochastic processes. Annals of Mathematical Statistics, 23(2), 193-212.
  2. Anderson, T. W., & Darling, D. A. (1954). A test of goodness of fit. Journal of the American Statistical Association, 49(268), 765-769.
  3. Stephens, M. A. (1974). EDF statistics for goodness of fit and some comparisons. Journal of the American Statistical Association, 69(347), 730-737.
  4. D'Agostino, R. B., & Stephens, M. A. (1986). Goodness-of-Fit Techniques. Marcel Dekker.

Information criteria

  1. Akaike, H. (1974). A new look at the statistical model identification. IEEE Transactions on Automatic Control, 19(6), 716-723.
  2. Sugiura, N. (1978). Further analysis of the data by Akaike's information criterion and the finite corrections. Communications in Statistics - Theory and Methods, 7(1), 13-26.
  3. Hurvich, C. M., & Tsai, C.-L. (1989). Regression and time series model selection in small samples. Biometrika, 76(2), 297-307.
  4. Schwarz, G. (1978). Estimating the dimension of a model. Annals of Statistics, 6(2), 461-464.
  5. Burnham, K. P., & Anderson, D. R. (2002). Model Selection and Multimodel Inference: A Practical Information-Theoretic Approach, 2nd edition. Springer.

Fitting distributions to simulation input data

  1. Law, A. M. (2015). Simulation Modeling and Analysis, 5th edition. McGraw-Hill.