Premium apps Part of Proofline
Curve Fitter & Regression Calculator
Fit lines, polynomials, exponentials or your own model: parameters, R², errors, residuals.
Try an example: Straight line with prediction · NIST Norris calibration data (certified line) · NIST Misra1a: y = b1·(1 − e^(−b2·x)) · Exponential decay · Quadratic polynomial · Natural cubic spline interpolation
How it works
Paste x/y data (CSV, tabs or spaces) and fit a straight line, polynomial, exponential, power-law, logarithmic, multiple linear or your own nonlinear model, or interpolate with a natural cubic spline. You get the parameters with standard errors, t and p values and confidence intervals, R² and adjusted R², an ANOVA table, a residual plot and predictions with confidence intervals. Verified against the NIST StRD reference datasets; part of the Proofline math notebook.
- Models that are linear in their parameters (line, polynomial, multiple, logarithmic) are solved by Householder QR of the column-scaled design matrix — never by the normal equations, which square the condition number.
- Exponential, power and custom models use Levenberg–Marquardt: each damped step solves [J; √λ·D]·δ ≅ [r; 0] by QR with D the column norms of the central-difference Jacobian. Exponential and power fits start from the log-linear fit but minimise the residuals of y itself.
- Standard errors are √diag(s²·(RᵀR)⁻¹) with s² = SSE/(n − p); t and p values and confidence intervals use Student’s t with n − p degrees of freedom. For nonlinear models these are the usual linearised (asymptotic) values.
- R² = 1 − SSE/SST (centred); without an intercept R² is uncentred, as in the NIST datasets. The F test compares the model with a constant.
- Verified against NIST StRD certified values: Norris, Pontius, NoInt1, Longley, Wampler1 and Filip (linear) and Misra1a, Thurber, DanWood, Chwirut2 and MGH09 (nonlinear, both start points) — at least 7 matching digits for the parameters.
- Splines: natural cubic spline (second derivative zero at both ends) from a tridiagonal system; outside the data the end cubics are continued and flagged as extrapolation.
Regression statistics assume independent errors with constant variance. A high R² does not prove that the model is right — check the residual plot for patterns.
Sources
- NIST Statistical Reference Datasets (StRD): linear and nonlinear regression (NIST)
- G. H. Golub, C. F. Van Loan: Matrix Computations, 4th ed., §5.3 (least squares by Householder QR) (Johns Hopkins University Press)
- D. W. Marquardt: An Algorithm for Least-Squares Estimation of Nonlinear Parameters, J. SIAM 11 (1963) 431–441 (SIAM)
- C. de Boor: A Practical Guide to Splines (Springer, 2001), chapter IV (Springer)
Part of Proofline
-
Proofline Math notebook
Solve, graph, test and visualise in one notebook — with data, findings and a report.
Related tools
- Probability & Statistics Studio – Distributions, descriptive stats, confidence intervals and t, chi-square and z tests with p-values.
- Graphing Calculator – Plot up to 6 functions or parametric curves with roots, extrema, intersections and SVG/PNG export.
- Numerical Equation Solver & Optimizer – Every root of f(x) = 0 in an interval, Newton or bisection steps, systems and minima.
- Time-Series Explorer – Resample, smooth and decompose date/value data: trend, R², seasonality, YoY change and anomalies.
Fit a curve to your data with standard errors and residuals
Fit a line, polynomial, exponential, power law or your own formula to x/y data and read parameters, R², confidence intervals and the residual plot.
What it is for
You have measurements and a model in mind: a calibration line, an exponential decay, a dose–response curve. This tool finds the parameters that make the model fit best in the least-squares sense and tells you how well they are determined.
Paste your data (CSV, tabs or spaces, header row optional), choose the x column and y column, and pick a Model: straight line, polynomial, exponential, power law, logarithmic, multiple linear regression, or a Custom model such as Emax*x/(EC50 + x) with start values. For data you want to pass through exactly, choose the natural cubic spline or linear interpolation instead of a regression.
The numerics are checked against the NIST Statistical Reference Datasets, the standard test set for regression software.
Worked example
A dose–response series: doses 0.5, 1, 2, 4, 8 and 16 with responses 12, 21, 35, 52, 66 and 74. Choose Custom model, enter Emax*x/(EC50 + x) with parameters Emax=80, EC50=2, and evaluate at x = 3.
Levenberg–Marquardt converges in 7 iterations to Emax = 89.618 (standard error 1.904, 95 % CI 84.33 to 94.91) and EC50 = 3.060 (SE 0.183, CI 2.55 to 3.57). R² is 0.99803 and the residual standard deviation is 1.232. The prediction at dose 3 is 44.36 with a 95 % confidence interval of 42.45 to 46.28 for the mean response.
The built-in example with NIST's Norris data reproduces the certified line y = −0.262323 + 1.00212·x, with slope SE 0.000429797 and R² = 0.999993746, matching the published values to more than ten digits.
How to read the result
- Equation and R²: the fitted model with its numbers. Adjusted R² penalises extra parameters, which matters when you compare polynomial degrees.
- Parameters: estimate, standard error, t, p-value and the confidence interval. A large p-value (0.82 for the intercept of the 5-point line example) means the data cannot tell that parameter apart from zero.
- Analysis of variance (linear models): the F test of the model against a constant.
- Residual plot: data minus fit. Random scatter around zero is good. A curve or a funnel shape means the model or the constant-variance assumption is wrong, however high R² is.
- Predictions: fitted values with confidence intervals. Values outside the data range are flagged as extrapolation.
- The CSV download holds every point with its fitted value and residual.
Tips and common mistakes
- Use a decimal point (1.5). A comma separates values.
- Exponential and power fits minimise the residuals of y itself. Spreadsheet trendlines fit ln y instead, so their numbers differ slightly. Neither is wrong; they weight the data differently.
- Custom models need sensible start values. If the fit does not converge, start closer, for example read a plateau off the plot.
- Higher polynomial degrees always raise R² but often worsen predictions. Watch adjusted R² and the residuals.
- Without an intercept, R² is uncentred and not comparable with the usual R².
- Splines pass through every point, so they report no R² or standard errors.
FAQ
How do I fit several x variables at once?
Choose Multiple linear regression and list the predictor columns in x column, for example 2,3,4. Leave it empty to use every column except y.
Why are there no confidence intervals for the spline?
A spline is interpolation, not a statistical model. It has as many free coefficients as the data allow, so there is nothing left to estimate an error from.
Are the standard errors exact for nonlinear models?
They are the usual linearised values from the Jacobian at the solution, as reported by statistics packages and NIST. For strongly curved models with little data, treat them as approximate.
How is this different from the statistics tool?
The probability and statistics studio covers distributions and hypothesis tests. This tool fits models to x/y data.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://prooflinecurvefit.usefulweb.app/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://prooflinecurvefit.usefulweb.app/mcp· tool nameproofline_curve_fit
Example request
curl -s -X POST https://prooflinecurvefit.usefulweb.app/api/v1/calculate \
-H 'content-type: application/json' \
-d '{"data":"x,y\n1,2.1\n2,3.9\n3,6.2\n4,7.8\n5,10.1","model":"linear","evaluateAt":"6"}'