Models
Overview
Curve fitting is the process of constructing a mathematical function that best describes the relationship between independent and dependent variables in experimental or observational data. While general-purpose regression techniques can approximate any smooth relationship, domain-specific models encode physical laws, chemical kinetics, biological mechanisms, or engineering principles directly into the functional form. This approach reduces the number of free parameters, improves interpretability, and often yields more reliable extrapolation beyond the measured range.
The models in this section leverage scipy.optimize.curve_fit, which implements non-linear least squares optimization via the Levenberg–Marquardt algorithm. Each function wraps a collection of related model equations, exposing a consistent interface that accepts xdata, ydata, and a model selector string. The output includes fitted parameter values, their standard errors, and the parameter names—ready for immediate use in Excel dashboards and further analysis.
Adsorption Isotherms
Adsorption describes the accumulation of molecules at a solid–gas or solid–liquid interface. Predicting adsorption capacity as a function of concentration or pressure is essential in catalysis, environmental remediation, and gas storage. The ADSORPTION function implements six isotherm models:
- Langmuir isotherm variants capture monolayer adsorption on homogeneous surfaces with finite binding sites.
- BET (Brunauer–Emmett–Teller) multilayer models extend Langmuir to describe multilayer physisorption, common in gas adsorption measurements for surface area determination.
- Freundlich isotherm uses a power-law form to represent heterogeneous surfaces where binding energy varies continuously.
- Gunary phosphate and other specialized forms address specific systems like soil chemistry and cooperative adsorption.
These models are widely used in environmental engineering (e.g., contaminant removal), materials science (e.g., pore size characterization), and chemical engineering (e.g., catalyst design).
Agricultural and Ecological Models
The AGRICULTURE function provides growth and yield response models tailored to crop science and soil fertility studies. These include:
- Nutrient response curves that relate fertilizer application rates to yield, often exhibiting diminishing returns or saturation.
- Soil moisture retention functions that describe water-holding capacity versus soil matric potential.
- Crop growth models that track biomass accumulation over time under varying environmental conditions.
These models support precision agriculture, irrigation management, and sustainable intensification strategies.
Binding and Receptor Models
Receptor–ligand interactions are central to pharmacology, biochemistry, and molecular biology. The BINDING_MODEL function fits equilibrium binding data to equations derived from mass action kinetics:
- One-site specific binding quantifies receptor occupancy as a function of ligand concentration.
- Two-site models distinguish high- and low-affinity binding populations.
- Competitive binding curves determine inhibition constants when a labeled ligand competes with an unlabeled compound.
- Cooperative binding captures positive or negative cooperativity using Hill-like exponents.
These models are essential for drug discovery, enzyme assays, and understanding signal transduction pathways.
Chromatography Peak Shapes
Chromatographic separations produce peaks whose shapes encode column efficiency, diffusion, and retention mechanisms. The CHROMA_PEAKS function fits common peak models:
- Gaussian peaks represent ideal chromatography with symmetric elution profiles.
- Exponentially modified Gaussian (EMG) models peaks with tailing caused by slow desorption or extra-column dispersion.
- Asymmetric Gaussian and bi-Gaussian forms handle leading or tailing asymmetry.
- Polynomial baseline corrections account for drift or baseline curvature.
Accurate peak fitting improves quantification precision and enables deconvolution of overlapping components in complex mixtures.
Dose–Response Curves
Dose–response relationships quantify how a biological system responds to varying concentrations of a drug, toxin, or stimulus. The DOSE_RESPONSE function includes ten sigmoidal and saturation models:
- Four-parameter logistic (4PL) is the industry standard for immunoassays and high-throughput screening.
- Five-parameter logistic (5PL) introduces asymmetry to accommodate skewed transitions.
- Hill equation describes cooperative ligand binding and enzyme activation.
- Biphasic dose–response models capture dual mechanisms (e.g., activation followed by inhibition at higher doses).
- Generalized hyperbola and single-site binding forms provide saturation kinetics for simpler systems.
These models are foundational in pharmacology (EC₅₀/IC₅₀ determination), toxicology (LD₅₀ estimation), and clinical diagnostics (calibration curves).
Electrochemistry and Ion Transport
The ELECTRO_ION function fits models specific to electrochemical systems:
- Butler–Volmer equation relates electrode current to overpotential, accounting for activation barriers in electron transfer.
- Nernst equation variants describe equilibrium potentials as a function of ion concentration.
- Diffusion-limited current models (e.g., Cottrell equation) predict transient or steady-state mass transport.
These are critical for battery modeling, corrosion studies, and sensor development.
Enzyme Kinetics
Enzyme-catalyzed reactions follow well-established kinetic laws. The ENZYME_BASIC and ENZYME_INHIBIT functions implement classical and advanced enzyme models:
- Michaelis–Menten kinetics quantifies reaction velocity as a function of substrate concentration, yielding V_{\max} and K_m.
- Lineweaver–Burk plots linearize the reciprocal form to estimate kinetic parameters.
- Dual Michaelis–Menten systems model parallel pathways or multiple substrates.
- Competitive, non-competitive, and uncompetitive inhibition models distinguish mechanisms by which inhibitors reduce enzyme activity.
- Substrate activation and inhibition curves describe non-Michaelian behavior.
These models are indispensable in enzymology, metabolic engineering, and pharmaceutical enzyme assays.
Exponential Growth and Decay
Exponential processes appear across natural and engineered systems. The EXP_ADVANCED, EXP_DECAY, and EXP_GROWTH functions fit:
- Simple exponential growth (y = a e^{bx}) for unconstrained population expansion or radioactive decay.
- Multi-exponential decay for systems with multiple time constants (e.g., fluorescence lifetimes, pharmacokinetic compartment models).
- Stretched exponential (Kohlrausch function) for relaxation in disordered materials.
- Exponential rise to plateau for charging capacitors, heating curves, or drug accumulation.
These models are ubiquitous in physics, chemistry, biology, and finance (compound interest, growth rates).
Growth and Saturation Models
Biological and economic systems often exhibit growth that accelerates initially and then saturates. The GROWTH_POWER and GROWTH_SIGMOID functions provide:
- Logistic growth: The canonical S-shaped curve with carrying capacity, used for population dynamics and market penetration.
- Gompertz function: Asymmetric sigmoid common in tumor growth and microbial cultures.
- Richards growth curve: Generalizes logistic growth with a shape parameter for flexible asymmetry.
- Weibull growth: Captures delayed onset and adjustable curvature.
- Chapman–Richards model: Developed for forestry, it describes tree height and biomass.
- Power-law growth for systems without saturation (e.g., allometric scaling in biology).
Miscellaneous and Piecewise Models
Not all systems follow smooth, continuous laws. The MISC_PIECEWISE function handles:
- Piecewise linear models (e.g., broken-stick regression for threshold detection).
- Step functions for abrupt transitions in control systems or phase changes.
- Hockey stick curves for economic break-even analysis or environmental tipping points.
- Bilinear models for joined linear segments with a change point.
These are essential when the underlying process changes regime at a critical value.
Asymmetric and Complex Peak Shapes
Many spectroscopic and chromatographic techniques produce asymmetric peaks. The PEAK_ASYM function offers:
- Lorentzian and Gaussian profiles with asymmetry corrections.
- Voigt profile: Convolution of Gaussian and Lorentzian, used in spectroscopy when both Doppler and pressure broadening are significant.
- Pseudo-Voigt: Faster approximation via linear combination.
- Exponentially modified Gaussian (EMG) for peak tailing.
- Bi-Gaussian for peaks with different left and right widths.
Polynomial and Rational Functions
The POLY_BASIC function fits polynomials and rational functions (ratios of polynomials):
- Linear, quadratic, cubic, quartic, quintic polynomials for smooth trend fitting.
- Rational functions (e.g., Padé approximants) for efficient approximation of complex functions with fewer parameters than high-order polynomials.
- Orthogonal polynomials (Chebyshev, Legendre) for numerical stability in high-degree fits.
Polynomials are general-purpose but should be used cautiously for extrapolation; rational functions offer better asymptotic behavior.
Rheological Models
Rheology studies how materials deform and flow. The RHEOLOGY function fits constitutive equations for viscosity and shear stress:
- Bingham plastic: Materials with yield stress (e.g., toothpaste, drilling mud).
- Herschel–Bulkley model: Extends Bingham with power-law flow.
- Carreau–Yasuda model: Describes shear-thinning with low- and high-shear plateaus.
- Cross model: Simpler shear-thinning with fewer parameters.
- Vogel–Fulcher–Tammann (VFT) and MYEGA: Temperature-dependent viscosity for glass-forming liquids.
These models are critical in polymer processing, food engineering, and materials characterization.
Spectroscopic Peak Fitting
Spectroscopy (UV-Vis, IR, Raman, NMR, ESR) produces peaks whose shapes reveal molecular and electronic structure. The SPECTRO_PEAKS function implements:
- Gaussian line shape: Doppler broadening in gas-phase spectra.
- Lorentzian line shape: Pressure or natural broadening.
- Voigt profile: True convolution for simultaneous Doppler and pressure effects.
- Pseudo-Voigt: Weighted sum approximation.
- Pearson VII: Flexible tail weight for empirical fitting.
- Inverse polynomial peak: Flat-topped or boxy absorption features.
Accurate peak fitting enables quantitative analysis, deconvolution of overlapping bands, and identification of chemical species.
Statistical Distribution Fitting
Many phenomena follow well-known probability distributions. The STAT_DISTRIB and STAT_PARETO functions fit:
- Normal (Gaussian): Central limit theorem, measurement error.
- Log-normal: Particle sizes, income distributions.
- Weibull: Reliability analysis, survival times.
- Exponential: Time between events, radioactive decay.
- Gamma: Waiting times, rainfall.
- Pareto: Power-law tails in economics, network science.
These models underpin statistical inference, risk assessment, and quality control.
Waveform and Oscillatory Models
Periodic and oscillatory data require trigonometric and wave-like functions. The WAVEFORM function fits:
- Sinusoidal waves with amplitude, frequency, and phase.
- Damped oscillations (e.g., RLC circuits, mechanical vibrations).
- Fourier series for periodic signals with harmonic content.
- Gaussian pulse and Lorentzian pulse for transient signals.
- Chirp signals with time-varying frequency.
These are essential in signal processing, communications, and physics.
Native Excel capabilities
Excel provides limited built-in curve-fitting functionality:
- Trendlines in charts support linear, polynomial (up to 6th order), exponential, logarithmic, and power-law fits. They are convenient for quick visual analysis but lack parameter uncertainty estimates and do not support domain-specific models.
- LINEST and LOGEST functions perform linear and exponential regression with uncertainty quantification but cannot handle non-linear models like Michaelis–Menten or dose–response curves.
- Solver Add-in enables custom non-linear least squares fitting by manually defining the sum-of-squared-residuals objective, but requires tedious setup and lacks automated parameter error estimation.
The Python-based model functions in this section offer:
- Direct access to 100+ domain-specific models without manual equation entry.
- Automatic parameter uncertainty via covariance matrix estimation.
- Robust optimization algorithms (Levenberg–Marquardt, Trust Region Reflective) from SciPy.
- Consistent, documented interfaces for rapid prototyping and reproducibility.
Third-party Excel add-ins
- TableCurve 2D/3D (Systat Software): Commercial software offering automated fitting of thousands of equations. It ranks models by goodness-of-fit and provides comprehensive diagnostics. Suitable for exploratory data analysis when the functional form is unknown.
- DMFit (NIST): Specialized for fitting powder X-ray diffraction patterns and other materials science data. Integrates with Igor Pro and MATLAB.
- OriginLab: Full-featured scientific graphing and analysis software with extensive non-linear curve-fitting libraries, including built-in pharmacology, enzyme kinetics, and spectroscopy models. Supports custom user-defined functions.
- NLREG: Stand-alone non-linear regression tool with scripting capabilities. It can export fitted parameters to Excel for further analysis.
Tools
| Tool | Description |
|---|---|
| ADSORPTION | Fits adsorption models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| AGRICULTURE | Fits agriculture models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| BINDING_MODEL | Fits binding_model models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| CHROMA_PEAKS | Fits chroma_peaks models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| DOSE_RESPONSE | Fits dose_response models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| ELECTRO_ION | Fits electro_ion models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| ENZYME_BASIC | Fits enzyme_basic models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| ENZYME_INHIBIT | Fits enzyme_inhibit models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| EXP_ADVANCED | Fits exp_advanced models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| EXP_DECAY | Fits exp_decay models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| EXP_GROWTH | Fits exponential growth models to data using scipy.optimize.curve_fit. |
| GROWTH_POWER | Fits growth_power models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| GROWTH_SIGMOID | Fits growth_sigmoid models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| MISC_PIECEWISE | Fits misc_piecewise models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| PEAK_ASYM | Fits peak_asym models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| POLY_BASIC | Fits poly_basic models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| RHEOLOGY | Fits rheology models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| SPECTRO_PEAKS | Fits spectro_peaks models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| STAT_DISTRIB | Fits stat_distrib models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| STAT_PARETO | Fits stat_pareto models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |
| WAVEFORM | Fits waveform models to data using scipy.optimize.curve_fit. See https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html for details. |