Estimation index | MLE | Bayesian MCMC | Influence diagnostics | Technical Reference
Model comparison in BestFit spans likelihood criteria (AIC/BIC), posterior criteria (DIC/WAIC), and Pareto-smoothed leave-one-out cross-validation (LOOIC). These quantities answer different questions. They are comparable only when candidates use the same observations, observation process, pointwise partition, response transformation including Jacobian, and likelihood constants.
Let IModel.PointwiseDataLogLikelihood; priors are deliberately excluded. For exact observations, an element ordinarily corresponds to one value. Censored intervals, uncertain observations, and threshold-count groups can be different information units. The data-frame chapter documents their decomposition.
Criterion values are not meaningful if two models partition the same record differently. In particular, expanding a threshold count into repeated contributions versus retaining one grouped binomial-like contribution changes pointwise variance and cross-validation interpretation even when aggregate likelihoods agree.
For an MLE with
MaximumLikelihood.GetAIC() and GetBIC(n) implement (MC.1). AIC estimates relative expected out-of-sample deviance under regularity conditions; BIC is a large-sample approximation related to a particular marginal-likelihood regime. Lower is preferred only relative to the candidate set. Neither is a goodness-of-fit test.
MaximumAPosteriori and the Bayesian analysis summaries use the same formulas with the data log likelihood evaluated at the posterior mode,
Define deviance from the data likelihood only:
BestFit computes posterior mean deviance
The public API exposes DIC but not its
A deterministic 40-draw Normal fixture verifies the full calculation against R BayesianTools 0.1.9. BestFit agrees within
BestFit uses the variance form of the effective parameter count. The log pointwise predictive density is
evaluated with a log-sum-exp shift. With unbiased sample variance across draws,
The properties are WAIC_pD and WAIC. Large pointwise variance signals weak WAIC reliability. Serial correlation among retained MCMC draws reduces Monte Carlo precision even though (MC.5) uses all output draws as supplied.
The same deterministic fixture verifies every pointwise data-log-likelihood value and the aggregate lppd, loo 2.10.0 within
Exact leave-one-out predictive density for observation
Using draws from the full posterior gives raw importance ratios
PSIS fits a generalized Pareto law to excesses over a high cutoff, replaces the ordered tail ratios with stabilized expected order statistics, and uses the fitted shape
BestFit exposes LOOIC, LOO_pD = lppd - elpd_loo, LOOIC_SE, and one ParetoK per pointwise unit. Its standard error is $2\sqrt{n\widehat{\operatorname{Var}}i(\widehat{\mathrm{elpd}}{\mathrm{loo},i})}$.
BestFit's smoothing path follows R loo 2.10.0 for independent draws (r_eff = 1): it selects the reference tail length, fits positive cutoff excesses with the bounded fixed-grid posterior::gpdfit 1.7.0 estimator and shrinkage, replaces ordered tail ratios with monotone expected order statistics, and applies the reference truncation. The same transient pointwise matrix supplies WAIC and PSIS, so the model is evaluated once per retained draw. Pointwise ELPD and Pareto-$k$ arrays are cached for later influence reporting without retaining the
The pinned R fixture verifies aggregate and pointwise LOO values, every smoothed weight, importance-sampling effective sample size, Pareto
For loo 2.10.0 reliability limit
A pointwise value at or above this limit means the approximation needs investigation;
For criterion
These are normalized relative scores, not posterior model probabilities unless the assumptions of a specific derivation are satisfied. AIC, BIC, DIC, WAIC, LOOIC, RMSE, and equal weights must not be mixed in one weighting calculation. Nonfinite child criteria and separately indexed posterior draws have additional composite-model caveats documented in the composite chapter.
For WAIC or LOO differences, uncertainty should be calculated from paired pointwise differences because candidate predictions for the same observations are correlated. Comparing two standalone LOOIC_SE values does not give the standard error of their difference.
private static (
double Dic,
double Waic,
double EffectiveParametersWaic,
double Looic,
double LooicStandardError) ReadBayesianCriteria(
BayesianAnalysis analysis)
{
if (!analysis.IsEstimated || analysis.Results is null)
{
throw new InvalidOperationException(
"Run the Bayesian analysis before reading model criteria.");
}
return (
analysis.DIC,
analysis.WAIC,
analysis.WAIC_pD,
analysis.LOOIC,
analysis.LOOIC_SE);
}The example reflects the API. Interpret DIC and WAIC with their documented posterior and pointwise limitations, and inspect Pareto
The documentation test compiles the API example and checks its exact source region. Unit tests exercise arithmetic, threshold interpretation, legacy serialization compatibility, and state behavior. Focused verification establishes deterministic external-package parity for DIC, WAIC, and PSIS-LOO. The PSIS artifact independently verifies R loo 2.10.0 weights, effective sample size, pointwise and aggregate LOO values, standard errors, Pareto MaximumLikelihood.GetAIC, GetBIC, BayesianAnalysis.ComputeDIC, ComputeWAIC, ComputePSISLOO, ParetoSmoothWeights, DIC, WAIC, WAIC_pD, LOOIC, LOO_pD, LOOIC_SE, and ParetoK.
[1] H. Akaike, “A new look at the statistical model identification,” IEEE Transactions on Automatic Control, vol. 19, no. 6, pp. 716–723, 1974.
[2] G. Schwarz, “Estimating the dimension of a model,” The Annals of Statistics, vol. 6, no. 2, pp. 461–464, 1978.
[3] D. J. Spiegelhalter et al., “Bayesian measures of model complexity and fit,” Journal of the Royal Statistical Society: Series B, vol. 64, no. 4, pp. 583–639, 2002.
[4] S. Watanabe, “Asymptotic equivalence of Bayes cross validation and widely applicable information criterion in singular learning theory,” Journal of Machine Learning Research, vol. 11, pp. 3571–3594, 2010.
[5] A. Vehtari, A. Gelman, and J. Gabry, “Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC,” Statistics and Computing, vol. 27, pp. 1413–1432, 2017.
[6] A. Vehtari et al., “Pareto smoothed importance sampling,” Journal of Machine Learning Research, vol. 25, no. 72, pp. 1–58, 2024.