curvefit-stats
Statistical inference for SciPy-style nonlinear models, plus shared-parameter
fitting and errors-in-variables regression. Use ordinary functions written as
model(x, *parameters) with NumPy arrays.
The package contains exactly two functional modules:
-
curvefit_stats.inference:- bands, likelihood diagnostics, parameter summaries
- profile likelihood, bootstrap covariance, collinearity diagnostics,
- bound-aware covariance, and derived-quantity propagation.
-
curvefit_stats.estimators:GlobalFitGroupeiv_curve_fit.
Run from this checkout
Runtime dependencies are NumPy >=1.26.4,<3 and SciPy >=1.12,<1.19, plus Python's standard library.
python -m venv .venv
# Activate .venv (Windows: .venv\Scripts\activate).
source .venv/bin/activate
python -m pip install .
python examples/workflows.py
python examples/workflows.py profile
The SciPy upper limit applies to the EIV backend: scipy.odr is deprecated in
SciPy 1.17 and removed in 1.19. EIV calls on deprecated versions emit a
FutureWarning; calls outside the supported range fail explicitly. See the
ODR compatibility notes.
Quick start: concentration decay
Fit concentration in mg/L against time in hours with
C(t) = amplitude * exp(-rate * t). This example assumes independent Gaussian
measurement errors with an unknown common variance.
import numpy as np
from scipy.optimize import curve_fit
from curvefit_stats import generate_error_bands, fit_summary, audit_fit
def decay(time, amplitude, rate):
return amplitude * np.exp(-rate * time)
rng = np.random.default_rng(2026)
time = np.linspace(0, 5, 45)
concentration = decay(time, 3.0, 0.7) + rng.normal(0, 0.08, time.size)
popt, pcov = curve_fit(decay, time, concentration, p0=[2.5, 0.5])
grid = np.linspace(0, 5, 101)
lower, upper = generate_error_bands(
decay, grid, popt, pcov, concentration, x_fit=time,
)
print(fit_summary(decay, time, concentration, popt, pcov))
print(audit_fit(decay, time, concentration, popt))
The bands have approximate pointwise 95% confidence coverage for the mean.
They do not cover an entire curve simultaneously or include the noise of a new
measurement. The original fitting sample determines degrees of freedom, not
grid. For known absolute Gaussian errors, fit with absolute_sigma=True and
choose reference="normal" for bands.
Executable workflows
examples/workflows.py provides seeded, independently
selectable examples. Run PYTHONPATH=src python examples/workflows.py NAME.
| Name | Workflow | Main feature |
|---|---|---|
confidence |
Nonlinear decay fitting and mean-concentration bands | generate_error_bands |
intervals |
Mean confidence versus future-observation prediction | generate_error_bands |
diagnostics |
Gaussian fit diagnostics and AIC/BIC comparison | audit_fit |
summary |
R-inspired approximate nonlinear parameter table | fit_summary |
profile |
Asymmetric Michaelis–Menten profile errors | profile_likelihood_errors |
bootstrap |
Residual-bootstrap covariance and percentile interval | bootstrap_curve_fit |
collinearity |
Unsaturated kinetics and local parameter dependence | collinearity_diagnostics |
bounds |
Decay baseline at an active lower bound | robust_bounded_pcov |
propagation |
Concentration and half-life uncertainty | propagate_uncertainty |
global |
Shared decay rate, separate initial concentrations | GlobalFitGroup |
eiv |
Uncertain time and concentration measurements | eiv_curve_fit |
The collinearity and bounds examples intentionally emit statistical warnings; EIV also emits its compatibility warning on SciPy 1.17–1.18. Numerical output can vary slightly across NumPy/SciPy versions. Fixed seeds make each experiment reproducible within an environment, without requiring bit-for-bit agreement across platforms.
Choose the statistical convention explicitly
sigma supplies standard deviations, not variances, for scalar/vector errors.
A two-dimensional sigma supplies the full observation covariance. With
absolute_sigma=True, these are known absolute error scales. With False, they
supply relative weighting, and one unknown common variance multiplier is fitted.
These choices affect covariance scaling and likelihood parameter counting.
A covariance array does not retain its estimator, noise model, constraints, or reference distribution. Preserve that context. Ordinary response-only likelihood methods cannot automatically become ODR methods; conditional covariance at active bounds is not full marginal uncertainty; and empirical bootstrap covariance does not establish a Student-t pivot.
Read the user guide for equations, assumptions, failure handling, and workflow choices. The API reference is generated directly from Python source and NumPy-style docstrings on every site build. A generated offline snapshot is retained for repository readers. The integration guide explains covariance projection between modules, and the stress-test report records independent numerical validation and remaining scientific limitations.
Reproducible development and packaging
The development guide describes the hash-locked Python
3.12 development environment, strict quality checks, compatibility matrix,
wheel/source builds, and isolated installation checks. py.typed is included
in both distributions. Development tools live in optional extras and are not
base runtime dependencies. CI tests built wheels and direct source-distribution
installation; it does not publish releases.
The pre-release scientific review records independently reproduced defects, regression fixes, scientific limitations, and release gates.
Author and Maintainer
Abhinav Mishra — Computational Biologist & Scientific Software Developer
curvefit-stats was conceived and developed by Abhinav Mishra to make statistical inference and uncertainty quantification more accessible, reproducible, and reliable for scientists using SciPy's nonlinear optimization tools.
- GitHub: @bibymaths
- Contact: mishraabhinav36@gmail.com
Contributions, bug reports, and scientific discussions are welcome.
Acknowledgments
curvefit-stats is built on the scientific Python ecosystem, particularly NumPy for numerical computing and SciPy for nonlinear optimization, statistical distributions, and numerical linear algebra.
We gratefully acknowledge the NumPy and SciPy developers and contributors for their foundational open-source work.
curvefit-stats is an independent project and is not officially affiliated with or endorsed by NumPy or SciPy.
License
The Python source code and executable examples in curvefit-stats
are licensed under the MIT License.
Original documentation and illustrations are licensed under CC BY 4.0, unless otherwise noted.
Copyright © 2026 Abhinav Mishra.
Third-party materials retain their respective licenses. See THIRD_PARTY_NOTICES.md.
Metadata
Release files for curvefit-stats 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| curvefit_stats-0.1.0.tar.gz | 1.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| curvefit_stats-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.2 MB
Release files / curvefit_stats-0.1.0.tar.gz
| Download URL | curvefit_stats-0.1.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b76fc3706d038ae19020a2eb818db1c91c60d12402f94da6509c57170aa3b40c
|
|
BLAKE2b-256 checksum How to use checksums |
63c00cca748e2d66028a33ad529acbde29d6e4f7629a69b8d0edb55858590e11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 13, 2026.
Transparency logRelease files / curvefit_stats-0.1.0-py3-none-any.whl
| Download URL | curvefit_stats-0.1.0-py3-none-any.whl |
|---|---|
| Size | 49.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66c7e606a16fedb2c2b696c7004b52a06575aa838320bbe25762c3b5f6a9705b
|
|
BLAKE2b-256 checksum How to use checksums |
1d482f87cdc9c1b7dffa4c47743549c474836136a0e79187f38de0a6cd557053
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 13, 2026.
Transparency log