Skip to contents

Fit each of the 14 candidate distributions to a sample by maximum likelihood and return their goodness-of-fit metrics. Ranking is left to the caller. Wraps the shared C++ FittingAnalysis.

Usage

fit_distributions(data)

Arguments

data

numeric vector of observations.

Value

A named list with equal-length vectors distribution (candidate name), aic, bic, rmse, and converged (logical, whether the fit succeeded) – one entry per candidate.

Examples

peaks <- c(45000, 38000, 52000, 61000, 33000, 49000, 55000, 42000, 67000, 39000)
gof <- fit_distributions(peaks)
gof$distribution[which.min(gof$aic)]
#> [1] "Exponential"