compare_dists: Compare Distribution Fits and Return a Ranking Table

View source: R/fitverse.R

compare_distsR Documentation

Compare Distribution Fits and Return a Ranking Table

Description

Fits one or more parametric distributions to a numeric vector and returns an ordered ranking table without producing a plot or a full fitverse object. Use this function when you want a quick tabular comparison and do not need the fitted-object infrastructure.

Usage

compare_dists(x,
              dists     = "all",
              method    = "MLE",
              criterion = "AIC",
              xlab      = "x",
              verbose   = TRUE)

Arguments

x

A numeric vector of observations. Non-finite values are removed automatically before fitting.

dists

Character vector of distribution keys, or "all" to try every compatible distribution. See fitverse_distributions().

method

Character vector: one or more of "MLE", "MOM", "LMOM". All results are combined into a single table when multiple methods are specified.

criterion

"AIC" (default) or "BIC": the criterion by which rows are sorted.

xlab

Character: a label for the data variable, passed through to any downstream functions. Default "x".

verbose

Logical: print progress messages? Default TRUE.

Details

compare_dists() calls the same internal fitting engine as fitverse() but skips GoF test computation, data-summary computation, and plotting. It is therefore faster and better suited to exploratory screening of many distributions or methods.

The returned data frame can be used directly with kable or datatable for reporting.

Value

A data frame with one row per distribution-method combination, ordered by the chosen information criterion (ascending), with columns:

Rank

Integer rank (1 = best).

Distribution

Full distribution name.

Method

Estimation method ("MLE", "MOM", or "LMOM").

N_params

Number of free parameters.

LogLik

Maximised log-likelihood.

AIC

Akaike Information Criterion.

Delta_AIC

AIC difference relative to the best model.

BIC

Bayesian Information Criterion.

Delta_BIC

BIC difference relative to the best model.

Converged

Logical: did the optimiser converge?

dist_key

Internal distribution key (character).

Author(s)

Karuna G. Reddy karuna.reddy@auckland.ac.nz
M. G. M. Khan mgm.khan@usp.ac.fj

See Also

fitverse for a full fitted object plus diagnostic plot.

Examples

set.seed(1)
x <- rgamma(200, shape = 3, rate = 0.5)

tbl <- compare_dists(x,
                     dists   = c("gamma", "lognormal", "weibull", "exponential"),
                     method  = "MLE",
                     verbose = FALSE)
head(tbl)

FitVerse documentation built on Dec. 1, 2026, 1:07 a.m.