Skip to main content

fitcdf

Version Python Catalog Typing

Python library for domain-agnostic tabular analysis and univariate probability distribution fitting.

fitcdf fits continuous and discrete probability distributions to tabular columns or in-memory numeric samples, computes goodness-of-fit diagnostics, ranks candidates separately by data nature (continuous vs. discrete) and estimation method, and persists Markdown reports, JSON payloads, CSV tables, and high-resolution PNG diagnostic figures. Every distribution, estimator, diagnostic, and ranking rule is implemented directly in fitcdf's self-contained statistical core.


Contents


Installation

Requires Python 3.11+ with lightweight scientific dependencies (numpy, scipy, matplotlib, and threadpoolctl).

pip install fitcdf

Verify the installation:

python -c "import fitcdf; print(fitcdf.__version__, fitcdf.catalog_snapshot()['total_families'])"

Quickstart & Python API

fitcdf works directly on your own CSV files, directories of CSV files, or in-memory numeric arrays:

  • Input path: pass either a direct CSV path ("path/to/data.csv") or a directory path ("path/to/folder") with optional file_name="data.csv" when the folder contains multiple CSV files.
  • Target columns: declare the numeric columns to evaluate explicitly via columns=["col_a", "col_b"]. Column names never trigger domain-specific assumptions, and missing or non-finite rows are never silently dropped.
  • Output directory: pass results_dir="path/to/output" to choose where artifacts are saved. When results_dir is omitted (and save_artifacts=True, the default), fitcdf automatically creates <cwd>/fit_results_<dataset_name>/ and writes each run into a unique timestamped subfolder so previous runs are never overwritten.
  • Ranking metrics: by default candidates are ranked by aic. Pass metrics to rank by any single metric ("aic", "aicc", "bic", "ks", "cvm", "ad", "chi_square"), a custom subset (e.g., ["aic", "ks", "ad"]), or "all" for rank-based consensus across all evaluable metrics.
  • Parallelism: protect script entry points with if __name__ == "__main__": whenever setting workers > 1.
from pathlib import Path
from fitcdf import (
    analyze_dataset,
    catalog_snapshot,
    compare_distributions,
    plot_distributions,
)


def main() -> None:
    # 1. Inspect the 56-family distribution catalog
    snapshot = catalog_snapshot()
    print(
        f"Catalog {snapshot['catalog_version']}: "
        f"{snapshot['total_families']} families "
        f"({snapshot['continuous_count']} continuous, {snapshot['discrete_count']} discrete)"
    )

    # 2. Analyze a CSV file or folder without results_dir
    #    Outputs are written automatically to ./fit_results_<dataset_name>/
    default_report = analyze_dataset(
        "path/to/measurements.csv",  # or a folder path with file_name="measurements.csv"
        columns=["duration_ms"],
        families=["weibull_min", "lognorm", "gamma", "norm"],
        data_type="continuous",
        method="mle",
        criterion="aic",
        seed=20261028,
        workers=1,
    )
    winner = default_report["columns"]["duration_ms"]["comparison"]["rankings"][0]["fits"][0]
    print(f"Rank-1 model: {winner['family']} | AIC={winner['aic']:.4f}")
    print(f"Saved under : {default_report['artifacts']['directory']}")

    # 3. Analyze with a custom results_dir
    custom_report = analyze_dataset(
        "path/to/folder",
        file_name="measurements.csv",
        columns=["duration_ms"],
        results_dir=Path("my_fit_outputs"),
        families=["weibull_min", "lognorm", "gamma", "norm"],
        data_type="continuous",
        method="mle",
        criterion="aic",
        workers=1,
    )
    print(f"Custom output: {custom_report['artifacts']['directory']}")

    # 4. Fit an in-memory sample and render selective comparison plots
    sample_values = [0.42, 0.78, 1.15, 1.64, 2.09, 2.88, 3.74, 5.19, 6.41, 8.07]
    comparison = compare_distributions(
        sample_values,
        families=["lognorm", "gamma", "norm"],
        data_type="continuous",
        method="mle",
        criterion="aic",
        workers=1,
    )
    plot_output = plot_distributions(
        sample_values,
        "in_memory_sample",
        comparison,
        comparison["attempts"],
        results_dir=Path("my_fit_outputs"),
        image_format="png",
    )
    print(f"Selective plots written to: {plot_output['directory']}")


    # 5. Rank by a single discrepancy metric, a custom subset, or all metrics (rank consensus)
    ks_comparison = compare_distributions(
        sample_values,
        families=["lognorm", "gamma", "norm"],
        data_type="continuous",
        method="mle",
        metrics="ks",
        workers=1,
    )
    subset_comparison = compare_distributions(
        sample_values,
        families=["lognorm", "gamma", "norm"],
        data_type="continuous",
        method="mle",
        metrics=["aic", "ks", "ad"],
        workers=1,
    )
    consensus_report = analyze_dataset(
        "path/to/measurements.csv",
        columns=["duration_ms"],
        families=["weibull_min", "lognorm", "gamma", "norm"],
        data_type="continuous",
        method="mle",
        metrics="all",
        workers=1,
    )
    consensus_group = consensus_report["columns"]["duration_ms"]["comparison"]["rankings"][0]
    consensus_winner = consensus_group["fits"][0]
    print(
        f"Consensus rank-1: {consensus_winner['family']} | "
        f"mean rank={consensus_winner['mean_rank']:.2f} "
        f"({consensus_winner['evaluated_metric_count']}/{consensus_winner['expected_metric_count']})"
    )


if __name__ == "__main__":
    main()

For a complete runnable script that generates a documented Normal(loc=10.0, scale=2.5) demo sample when no input path is supplied—or analyzes your own CSV when --input and --column are passed—see examples/use_library.py:

python examples/use_library.py
python examples/use_library.py --metrics ks
python examples/use_library.py --metrics aic ks ad
python examples/use_library.py --metrics all
python examples/use_library.py --input path/to/measurements.csv --column duration_ms --metrics all

Public API Overview

Function Purpose Primary Arguments Return Value
analyze_dataset End-to-end CSV loading, fitting, ranking, and artifact persistence path, columns, file_name, results_dir, families, data_type, method, criterion, metrics Structured report dict and persisted output paths
compare_distributions In-memory univariate fitting, diagnostics, and ranking observations, families, data_type, method, criterion, metrics, workers, gof_replicates Comparison dict (attempts, rankings, configuration)
plot_distributions Selective multi-family PDF/PMF, CDF, and combined panel rendering observations, feature_name, comparison_or_type, attempts_or_families, results_dir Dict of paths (pdf, cdf, pdf_cdf, parameters.md, plot.json)
catalog_snapshot / list_available_families / get_distribution Inspect catalog metadata, parameter semantics, and frozen evaluators Optional data_type or family identifier Catalog metadata dict, family specs, or distribution instance
estimate_parameters / evaluate_model_adequacy / predict_quantiles / resample_parameter_uncertainty Direct closed-form inference, Kolmogorov distance, quantiles, and percentile bootstrap observations, family, criterion, probabilities, repetitions, seed InferenceResult, adequacy dict, quantile map, and 95% intervals

Generated Outputs Reference

Every call to analyze_dataset(..., save_artifacts=True) writes a self-contained, non-overwriting run directory:

fit_results_<dataset_name>/                     # Default <cwd> destination (or custom results_dir)
└── 20261130T124530-a1b2c3d4e5f6/               # Unique UTC timestamp + run identifier
    ├── manifest.json                           # Run-level metadata, input profile, and feature paths
    └── <column_name>-<hash>/                   # Isolated folder per analyzed column
        ├── report.md                           # Technical Markdown report with rankings and plot links
        ├── result.json                         # Machine-readable JSON payload with parameter metadata
        ├── results.csv                         # Semicolon-delimited table across all fitted candidates
        ├── density.png                         # Histogram / empirical PMF vs. top fitted curves + rug
        ├── cumulative.png                      # Empirical CDF + 95% DKW band + KS marker + residual panel
        ├── quantiles.png                       # Classical Q-Q plot and detrended Q-Q (worm) plot
        ├── probabilities.png                   # Classical P-P plot (with DKW guide) and detrended P-P plot
        ├── survival.png                        # Log-scale empirical vs. theoretical survival curve S(x)
        ├── criteria.png                        # Selected metric or consensus mean rank vs. KS and CvM distances
        ├── series.png                          # Observation-order trajectory, moving average, and boxplot
        ├── pdf.png                             # Standalone comparative PDF / PMF panel
        ├── cdf.png                             # Standalone comparative CDF and residual panel
        └── models/                             # Isolated folders for the winner and close alternatives
            └── <method>/                       # mle, moments, quantiles, distance, or spacings
                └── <data_type>/                # continuous or discrete
                    └── 01_<winner_family>/     # Rank-prefixed model directory
                        ├── pdf.png             # Individual PDF / PMF plot for this model alone
                        ├── cdf.png             # Individual CDF + max KS marker for this model alone
                        └── report.md           # Parameter estimates, bounds, meanings, and selection record
  • manifest.json: Top-level index mapping each analyzed column to its output directory and recording dataset profiling details.
  • report.md: Human-readable summary containing sample statistics, primary rankings (single metric or rank-based consensus), individual per-metric ranking tables and unavailable-metric notes when multiple metrics are selected, parameter interpretations, and links to all diagnostic plots.
  • result.json: Structured payload suitable for downstream pipelines, containing fitted parameters, bounds, convergence statuses, per-metric rankings, and goodness-of-fit diagnostics.
  • results.csv: Semicolon-delimited (;) flat table with one row per candidate attempt, including criterion scores, $\Delta$, Akaike weights, log-likelihood, parameter counts, KS, CvM, AD, $\chi^2$, optimizer evaluations, duration, and additive consensus columns (evaluated_metrics, missing_metrics, mean_rank, first_place_count, populated in multi-metric consensus mode).
  • 9 Feature-Level Diagnostic Plots: Full-width comparative visuals (density.png, cumulative.png, quantiles.png, probabilities.png, survival.png, criteria.png, series.png, pdf.png, cdf.png) rendered at publication resolution with the colorblind-safe Okabe–Ito palette.
  • Individual Model Plots (models/<method>/<data_type>/): Dedicated single-model pdf.png, cdf.png, and report.md files for the rank-1 winner and any qualifying close alternatives.

Case Study 1: NIST Simulated Weibull (RANDWEIB.DAT)

This example fits 10 continuous distributions via Maximum Likelihood Estimation (mle) to the public NIST/SEMATECH simulated Weibull sample (RANDWEIB.DAT, column valor, n = 500, generated from Weibull(c = 2, loc = 0, scale = 1)).

Runnable Code

from fitcdf import analyze_dataset

report = analyze_dataset(
    "dataset/nist_weibull_simulada/dados.csv",  # Replace with your own CSV path
    columns=["valor"],
    data_type="continuous",
    families=[
        "weibull_min",
        "weibull_2p_left_trunc",
        "gamma",
        "lognorm",
        "norm",
        "expon",
        "fatiguelife",
        "burr12",
        "fisk",
        "rayleigh",
    ],
    method="mle",
    criterion="aic",
    seed=20261028,
    workers=1,
)

Sample Summary & Observed Ranking

Column n Mean Median Std. Dev. Min Q1 Q3 Max
valor 500 0.8991 0.8423 0.4487 0.005674 0.5749 1.1996 2.3209
Rank Family AIC $\Delta\text{AIC}$ Akaike Weight BIC KS ($D$) CvM ($W^2$) Free Params Estimated Parameters
1 rayleigh 584.76 0.00 40.5% 588.97 0.0311 0.0874 1 loc=0.0, scale=0.7104
2 weibull_min 585.03 0.27 35.4% 593.45 0.0234 0.0301 2 c=2.0962, loc=0.0, scale=1.0138
3 weibull_2p_left_trunc 587.01 2.25 13.2% 599.65 0.0234 0.0301 3 c=2.0959, trunc_left=0.005674, scale=1.0138
4 burr12 587.38 2.62 10.9% 600.02 0.0242 0.0321 3 c=2.1075, d=100.0, scale=8.9848
5 gamma 613.51 28.76 <0.1% 621.94 0.0514 0.3076 2 a=3.2757, loc=0.0, scale=0.2745
6 norm 620.45 35.69 <0.1% 628.87 0.0586 0.3543 2 loc=0.8991, scale=0.4482
7 fisk 662.01 77.26 <0.1% 670.44 0.0597 0.3809 2 c=2.9506, loc=0.0, scale=0.8146
8 lognorm 717.57 132.81 <0.1% 726.00 0.0810 1.2233 2 s=0.6449, loc=0.0, scale=0.7659
9 expon 895.60 310.84 <0.1% 899.81 0.2303 10.0066 1 loc=0.0, scale=0.8991
10 fatiguelife 907.96 323.21 <0.1% 916.39 0.1844 5.9224 2 c=0.8203, loc=0.0, scale=0.6598

Rank-1 Parameter Summary (models/mle/continuous/01_rayleigh/report.md)

Parameter Estimate Status Search Bounds Statistical Meaning
loc 0 fixed [0; 0] Lower support endpoint of the Rayleigh distribution.
scale 0.7103543 free [2.3151936e-06; 232.0868] Mode displacement above loc; positive dispersion parameter.

Real results.csv Excerpt (Top 4 Rows)

rank;distribution_name;family;data_type;method;status;eligible;criterion;score;delta;akaike_weight;log_likelihood;parameter_count;aic;aicc;bic;ks;cvm;ad;chi2;evaluations;duration_seconds;parameters;reason
1;Rayleigh;rayleigh;continuous;mle;fitted;True;aic;584.7570277186096;0.0;0.4049762751371152;-291.3785138593048;1;584.7570277186096;584.7650598471237;588.9716358170318;0.031109701822733538;0.08743169138912257;0.5313783421218545;6.559999999999915;0;0.0021931009978288785;loc=0.0, scale=0.7103542983076149;Exact closed-form maximum likelihood solution.
2;Weibull Minimum;weibull_min;continuous;mle;fitted;True;aic;585.0251501227347;0.2681224041250516;0.35416655024832133;-290.51257506136733;2;585.0251501227347;585.04929499195;593.4543663195791;0.02340824250555862;0.030112355367573698;0.19779221722586726;7.920000000000018;405;0.04097736600670032;c=2.0961920780987904, loc=0.0, scale=1.0138095496123853;Numerical convergence confirmed by the optimizer.
3;2-Parameter Left-Truncated Weibull;weibull_2p_left_trunc;continuous;mle;fitted;True;aic;587.0061115081867;2.249083789577071;0.1315367908341654;-290.50305575409334;3;587.0061115081867;587.0544986049608;599.6499358034532;0.02343063532686529;0.030122325421878135;1.5577151409848398;7.920000000000035;669;0.04609012899163645;c=2.095911618449196, trunc_left=0.005674428, loc=0.0, scale=1.013773666148315;Numerical convergence confirmed by the optimizer.
4;Burr Type XII;burr12;continuous;mle;fitted;True;aic;587.3761232986986;2.619095580089038;0.10932014587429213;-290.6880616493493;3;587.3761232986986;587.4245103954728;600.0199475939652;0.02415898959163154;0.03213892841615452;0.21297891374877054;7.919999999999765;1458;0.14107553799112793;c=2.107455896579404, d=100.0, loc=0.0, scale=8.984801503325652;Numerical convergence confirmed by the optimizer.

Diagnostic Figures — NIST Simulated Weibull

Comparative Density (density.png)

NIST Weibull Comparative Density

Freedman–Diaconis histogram and marginal rug overlaid with the top five fitted densities; the Weibull/Rayleigh cluster matches both the mode near 0.7 and the right-skewed decay, while gamma shifts the peak too far left.

Empirical CDF & Residual Deviation (cumulative.png)

NIST Weibull Cumulative Distribution

Empirical step CDF with its 95% Dvoretzky–Kiefer–Wolfowitz (DKW) simultaneous band, maximum KS distance callout (D_KS = 0.0234 for weibull_min), and bottom residual panel $F_n(x) - \hat{F}(x)$ staying well inside the confidence limits.

Quantile-Quantile & Detrended Worm Plot (quantiles.png)

NIST Weibull Q-Q Diagnostics

Classical Q-Q plot (left) and detrended Q-Q residual plot (right) confirming close agreement in original units across the lower and upper tails for the top four models.

Probability-Probability & Detrended P-P Plot (probabilities.png)

NIST Weibull P-P Diagnostics

Classical P-P plot with the 95% DKW band (left) and detrended P-P residuals (right), highlighting central probability-mass agreement and exposing the S-shaped misfit of gamma.

Log-Scale Survival Function (survival.png)

NIST Weibull Survival Function

Log-scale empirical survival curve $S(x) = 1 - F(x)$ with upper-tail reference percentiles ($P_{90}, P_{95}, P_{99}$) separating Weibull-like tail decay from heavier-tailed alternatives.

Information Criteria & Empirical Discrepancies (criteria.png)

NIST Weibull Selection Criteria

Side-by-side comparison of AIC scores, Akaike weights, and empirical KS / Cramér–von Mises distances showing the crisp gap between the top four models ($\text{AIC} \in [584.8, 587.4]$) and the remaining six candidates ($\text{AIC} \ge 613.5$).

Observation-Order Trajectory & Marginal Dispersion (series.png)

NIST Weibull Observation Series

Row-order trajectory with $\pm 1\text{ SD}$ band, moving average, and marginal boxplot verifying stability and absence of structural drift across all 500 observations.

Standalone Comparative PDF (pdf.png)

NIST Weibull Standalone PDF

Standalone comparative PDF panel formatted for direct inclusion in reports and slides.

Standalone Comparative CDF (cdf.png)

NIST Weibull Standalone CDF

Standalone comparative CDF and residual deviation panel isolating the top candidates.

Rank-1 Model PDF (models/mle/continuous/01_rayleigh/pdf.png)

NIST Weibull Rank-1 Model PDF

Dedicated single-model density plot for the rank-1 AIC winner (rayleigh) without competing curves.

Rank-1 Model CDF (models/mle/continuous/01_rayleigh/cdf.png)

NIST Weibull Rank-1 Model CDF

Dedicated single-model CDF plot for rayleigh pinning its maximum Kolmogorov–Smirnov discrepancy coordinate (D_KS = 0.0311).


Case Study 2: NIST Simulated Lognormal (LGN2.DAT)

This example fits 10 continuous distributions via Maximum Likelihood Estimation (mle) to the public NIST/Dataplot simulated lognormal sample (LGN2.DAT, Olsson 2005, column valor, n = 40, generated from Lognormal(s = 1, loc = 0, scale = exp(5) ≈ 148.413)).

Runnable Code

from fitcdf import analyze_dataset

report = analyze_dataset(
    "dataset/nist_lognormal/dados.csv",  # Replace with your own CSV path
    columns=["valor"],
    data_type="continuous",
    families=[
        "lognorm",
        "gamma",
        "weibull_min",
        "weibull_2p_left_trunc",
        "invgauss",
        "fisk",
        "burr12",
        "norm",
        "expon",
        "fatiguelife",
    ],
    method="mle",
    criterion="aic",
    seed=20261028,
    workers=1,
)

Sample Summary & Observed Ranking

Column n Mean Median Std. Dev. Min Q1 Q3 Max
valor 40 274.96 177.35 310.34 23.80 79.93 338.05 1568.30
Rank Family AIC $\Delta\text{AIC}$ Akaike Weight BIC KS ($D$) CvM ($W^2$) Free Params Estimated Parameters
1 invgauss 525.59 0.00 28.2% 528.97 0.0858 0.0193 2 mu=1.5478, loc=0.0, scale=177.6427
2 fatiguelife 525.67 0.08 27.0% 529.05 0.0610 0.0219 2 c=1.0920, loc=0.0, scale=173.2223
3 weibull_2p_left_trunc 526.10 0.51 21.8% 531.17 0.0579 0.0162 3 c=0.7807, trunc_left=23.8, scale=198.1872
4 lognorm 527.03 1.44 13.7% 530.41 0.0677 0.0246 2 s=0.9917, loc=0.0, scale=168.5438
5 fisk 529.19 3.61 4.6% 532.57 0.0781 0.0316 2 c=1.7133, loc=0.0, scale=165.8174
6 burr12 531.19 5.60 1.7% 536.26 0.0805 0.0319 3 c=1.7456, d=0.9490, scale=158.1327
7 expon 531.33 5.74 1.6% 533.02 0.1053 0.0733 1 loc=0.0, scale=274.9625
8 gamma 532.80 7.21 0.8% 536.18 0.1124 0.1017 2 a=1.1599, loc=0.0, scale=237.0655
9 weibull_min 533.28 7.69 0.6% 536.65 0.1031 0.0812 2 c=1.0274, loc=0.0, scale=278.4518
10 norm 575.52 49.93 <0.1% 578.89 0.2189 0.5933 2 loc=274.9625, scale=306.4389

Rank-1 Parameter Summary (models/mle/continuous/01_invgauss/report.md)

Parameter Estimate Status Search Bounds Statistical Meaning
mu 1.5478401 free [0.0001; 6273.2] Standardized mean-to-shape ratio of the Inverse Gaussian (Wald) distribution.
loc 0 fixed [0; 0] Lower support endpoint of the Inverse Gaussian distribution.
scale 177.6427 free [0.0015445; 156830] Positive scale factor of the Inverse Gaussian distribution.

Real results.csv Excerpt (Top 4 Rows)

rank;distribution_name;family;data_type;method;status;eligible;criterion;score;delta;akaike_weight;log_likelihood;parameter_count;aic;aicc;bic;ks;cvm;ad;chi2;evaluations;duration_seconds;parameters;reason
1;Inverse Gaussian;invgauss;continuous;mle;fitted;True;aic;525.587579571478;0.0;0.281615132825007;-260.793789785739;2;525.587579571478;525.9119038958024;528.9653384797059;0.0857928449905816;0.019325336877722508;0.12980804659098055;1.0999999999999972;649;0.04872052698920015;mu=1.5478401294347972, loc=0.0, scale=177.64269747856298;Numerical convergence confirmed by the optimizer.
2;Birnbaum-Saunders;fatiguelife;continuous;mle;fitted;True;aic;525.6712394777719;0.08365990629386033;0.2700781626548883;-260.83561973888595;2;525.6712394777719;525.9955638020963;529.0489983859998;0.061028145087960506;0.021900516414203125;0.1485640466166629;0.6999999999999961;637;0.049209962991881184;c=1.0919892124173214, loc=0.0, scale=173.2222846123733;Numerical convergence confirmed by the optimizer.
3;2-Parameter Left-Truncated Weibull;weibull_2p_left_trunc;continuous;mle;fitted;True;aic;526.0990082435392;0.511428672061129;0.21807237989157402;-260.0495041217696;3;526.0990082435392;526.7656749102058;531.165646605881;0.057903963432267884;0.016208052157442896;17.264997779385723;0.39999999999999925;1407;0.074415669994778;c=0.7807077710381518, trunc_left=23.8, loc=0.0, scale=198.18722777915838;Numerical convergence confirmed by the optimizer.
4;Log-Normal;lognorm;continuous;mle;fitted;True;aic;527.0274462333102;1.439866661832184;0.13708594030444526;-261.5137231166551;2;527.0274462333102;527.3517705576346;530.4052051415381;0.06768268971202862;0.024570591241194983;0.17380927349144315;1.5999999999999992;0;0.002779629998258315;s=0.99174327413845, loc=0.0, scale=168.5437813704128;Exact closed-form maximum likelihood solution.

Diagnostic Figures — NIST Simulated Lognormal

Comparative Density (density.png)

NIST Lognormal Comparative Density

Right-skewed empirical histogram (skewness = 2.34, excess kurtosis = 6.14) overlaid with the top five skewed candidates, capturing both the sharp lower concentration and the long right tail up to 1568.3.

Empirical CDF & Residual Deviation (cumulative.png)

NIST Lognormal Cumulative Distribution

Step ECDF with its wider small-sample 95% DKW confidence band ($\pm 0.215$), showing all top five skewed models staying close to the zero-residual line (D_KS = 0.0579 for weibull_2p_left_trunc, 0.0677 for lognorm).

Quantile-Quantile & Detrended Worm Plot (quantiles.png)

NIST Lognormal Q-Q Diagnostics

Classical and detrended Q-Q panels revealing how invgauss, fatiguelife, weibull_2p_left_trunc, and lognorm track the upper-tail order statistics above 800.

Probability-Probability & Detrended P-P Plot (probabilities.png)

NIST Lognormal P-P Diagnostics

Classical and detrended P-P panels confirming tight calibration across the full cumulative probability range [0, 1] inside the 95% DKW envelope.

Log-Scale Survival Function (survival.png)

NIST Lognormal Survival Function

Log-scale survival trajectories highlighting upper-tail behavior past $P_{90}$, $P_{95}$, and $P_{99}$, where lognorm, invgauss, and fatiguelife closely bound the extreme observations.

Information Criteria & Empirical Discrepancies (criteria.png)

NIST Lognormal Selection Criteria

Criteria summary quantifying the near-tie among the top four skewed laws ($\Delta\text{AIC} \le 1.44$) and the sharp separation from symmetric norm ($\Delta\text{AIC} = 49.93$).

Observation-Order Trajectory & Marginal Dispersion (series.png)

NIST Lognormal Observation Series

Row-order trajectory and marginal boxplot displaying the right-skewed upper outliers without systematic index drift across the 40 observations.

Standalone Comparative PDF (pdf.png)

NIST Lognormal Standalone PDF

Standalone comparative PDF panel summarizing the five highest-ranked skewed candidates.

Standalone Comparative CDF (cdf.png)

NIST Lognormal Standalone CDF

Standalone comparative CDF and residual deviation panel for the Lognormal case study.

Rank-1 Model PDF (models/mle/continuous/01_invgauss/pdf.png)

NIST Lognormal Rank-1 Model PDF

Dedicated single-model density plot for the rank-1 AIC candidate (invgauss) showing its fit across the heavy right tail.

Rank-1 Model CDF (models/mle/continuous/01_invgauss/cdf.png)

NIST Lognormal Rank-1 Model CDF

Dedicated single-model CDF plot for invgauss highlighting its maximum Kolmogorov–Smirnov discrepancy (D_KS = 0.0858).


Supported Families (56 Distributions)

fitcdf ships a versioned catalog of 56 univariate distributions (44 continuous and 12 discrete), organized by mathematical support and data nature:

Category Count Families
Standard Continuous 40 anglit, beta, burr12, cauchy, chi2, cosine, crystalball, erlang, expon, exponnorm, f, fatiguelife, fisk, gamma, genextreme, gennorm, genpareto, gompertz, gumbel_l, gumbel_r, halfcauchy, halfnorm, invgamma, invgauss, laplace, logistic, lognorm, lomax, maxwell, nakagami, norm, pareto, rayleigh, skewnorm, t, triang, tukeylambda, uniform, weibull_max, weibull_min
Truncated Weibull 4 weibull_2p_left_trunc, weibull_2p_right_trunc, weibull_3p_left_trunc, weibull_3p_right_trunc
Standard Discrete 11 bernoulli, betabinom, binom, geom, hypergeom, logser, nbinom, planck, poisson, randint, zipf
Poisson-Binomial 1 poisson_binomial (evaluated when trial probabilities or trial counts are supplied explicitly)

Estimation Methods & Diagnostics

Five Estimation Methods

Method Identifier Description
Maximum Likelihood mle Closed-form analytic MLE where available; bounded multi-start numerical log-likelihood maximization and discrete integer profile/coordinate ascent otherwise.
Method of Moments moments Matches theoretical moments (mean, variance, skewness, kurtosis) to empirical sample moments.
Quantile Matching quantiles Minimizes squared discrepancies between empirical and theoretical quantiles across symmetric probability grids.
Minimum Distance distance Minimizes empirical-to-theoretical CDF distance (Cramér–von Mises / Kolmogorov objectives).
Maximum Product of Spacings spacings Maximizes the geometric mean of CDF spacings between ordered continuous observations (Cheng & Amin).

Goodness-of-Fit & Uncertainty Diagnostics

  • Information Criteria & Relative Support: AIC, AICc, BIC, $\Delta_i$, and relative Akaike weights $w_i$ computed strictly within compatible data-nature and estimation-method groups.
  • Empirical Distribution Discrepancies: Kolmogorov–Smirnov ($D$), Cramér–von Mises ($W^2$), Anderson–Darling ($A^2$), and binned Pearson Chi-Square ($\chi^2$).
  • Multi-Metric Rank Consensus: When multiple metrics (or metrics="all") are requested, fitcdf ranks each evaluable metric independently and aggregates ordinal positions into a deterministic rank-based consensus (prioritizing complete coverage and listing any missing or unavailable metrics explicitly without combining incompatible raw scales).
  • Simultaneous Confidence Envelope: 95% Dvoretzky–Kiefer–Wolfowitz (DKW) band on ECDF and P-P diagnostic plots.
  • Bootstrap Calibration & Uncertainty: Optional parametric goodness-of-fit bootstrap replicates (gof_replicates) and nonparametric percentile bootstrap intervals via resample_parameter_uncertainty.

Scientific References

The probability definitions, parameterizations, estimation procedures, and diagnostic conventions in fitcdf are grounded in:

  • Balakrishnan, N., & Nevzorov, V. B. (2003). A Primer on Statistical Distributions. Wiley-Interscience.
  • Thomopoulos, N. T. (2017). Statistical Distributions: Applications and Parameter Estimates. Springer International Publishing.
  • NIST/SEMATECH (2012). e-Handbook of Statistical Methods. National Institute of Standards and Technology (source of the RANDWEIB.DAT and LGN2.DAT benchmark samples).
  • Additional bibliographic references on information criteria, goodness-of-fit diagnostics, and model selection are included inside each generated feature report.md.

Metadata

Release files for fitcdf 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fitcdf 0.6.1
File Size Uploaded Provenance Actions
fitcdf-0.6.1.tar.gz 148.1 kB With provenance Details for fitcdf-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fitcdf 0.6.1
File Interpreter ABI Platform Actions
fitcdf-0.6.1-py3-none-any.whl Python 3 none any Details for fitcdf-0.6.1-py3-none-any.whl

Total release size: 284.9 kB

Release files / fitcdf-0.6.1.tar.gz

Download URL fitcdf-0.6.1.tar.gz
Size 148.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8c553597236d15bfb544e09a970fc2c2a700f45273dc38dd45c4f80be6b6b1e5
BLAKE2b-256 checksum
How to use checksums
cd03b64d663e18240e1245349a1ee94a0de3385264852ebb9b075bbe6e2ac9a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / fitcdf-0.6.1-py3-none-any.whl

Download URL fitcdf-0.6.1-py3-none-any.whl
Size 136.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5490fabf63d3fb6376a202984d908c6b45d106bb78b4201830435cc341982147
BLAKE2b-256 checksum
How to use checksums
2c4afe8c8493da69c29c1b0e3bc067baf90b1b35ee9e75d546b272efe4ecf9dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for fitcdf 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fitcdf-0.6.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page