fitverse_batch: Fit Distributions to All Columns of a Data Frame

View source: R/fitverse_batch.R

fitverse_batchR Documentation

Fit Distributions to All Columns of a Data Frame

Description

Applies fitverse() to every numeric column of a data frame (or matrix, or named list), collects the results, and returns a tidy summary table alongside the full list of fitted objects.

Use fitverse_batch() for automated data characterisation workflows, survey-population profiling, or as a pre-processing step before optimal stratification with stratifyR.

Usage

fitverse_batch(data,
               cols      = NULL,
               dists     = "all",
               method    = "MLE",
               criterion = "AIC",
               top_n     = 3L,
               plot      = FALSE,
               progress  = NULL,
               verbose   = TRUE)

## S3 method for class 'fitverse_batch'
print(x, ...)

## S3 method for class 'fitverse_batch'
summary(object, ...)

Arguments

data

A data.frame, matrix, or named list of numeric vectors. Non-numeric columns are silently ignored.

cols

Character vector of column names to process. If NULL (default), all numeric columns are processed.

dists

Distribution keys to try, or "all". Passed to fitverse().

method

Estimation method(s): "MLE", "MOM", "LMOM", or a character vector of multiple methods. Default "MLE".

criterion

"AIC" or "BIC". Default "AIC".

top_n

Integer: number of top-ranked distributions stored in each fit. Default 3.

plot

Logical: produce and print a diagnostic plot for each variable? Default FALSE (recommended for batch use).

progress

Optional callback function(p) for reporting overall batch progress, where p is a value in [0, 1].

verbose

Logical: print per-column progress messages? Default TRUE.

x, object

An object of class "fitverse_batch".

...

Currently unused.

Details

fitverse_batch() iterates over columns with a tryCatch() wrapper so that a fitting failure for one column does not abort the entire batch. Failed columns are collected in the failed element of the returned object.

Column names containing spaces or special characters are handled correctly via make.names() internally.

Value

An S3 object of class "fitverse_batch" with elements:

fits

Named list of "fitverse" objects, one per successfully fitted column.

summary

Data frame with one row per column, columns: variable, n, best_dist, method, AIC, BIC, loglik, KS_p, AD_p.

failed

Character vector of column names for which fitting failed, or character(0) if all succeeded.

criterion

Character: the criterion used.

call

The matched call.

Author(s)

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

See Also

fitverse for single-column fitting.
generate_report for producing a report from batch results.

Examples


# Fit all numeric columns of the airquality dataset
data(airquality)
batch <- fitverse_batch(airquality,
                        method  = "MLE",
                        verbose = FALSE)
print(batch)
summary(batch)

# Access the fit for the Ozone column
batch$fits[["Ozone"]]


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