← All Tools

Linear & Polynomial Regression

Fit a straight line or polynomial (degree 2–10) to (x, y) data using ordinary least squares. The form is y = c0 + c1x + c2x² + …; the coefficients are solved with a numerically stable QR-style normal-equation pipeline. You get the equation, R², residual standard error, the F-statistic, per-point residuals, and a scatter chart with the fitted curve.

data point fitted curve 95% confidence band
y = …
Adj. R²
Residual SE
F-stat (p)
n / df
Pearson r
TermCoefficientStd. errort-stat
Residuals
#xyŷresidualstd. resid.

How it works

Ordinary Least Squares (OLS) finds coefficients c that minimise the sum of squared residuals Σ(yi − ŷi. For polynomial regression we set up the Vandermonde design matrix X = [1, x, x², …, xd] and solve the normal equations (XTX) c = XTy with Gauss–Jordan elimination on the augmented matrix. Standard errors come from σ² · diag((XTX)−1) where σ² = RSS / (n − p).

The four transforms (ln, log₁₀, , 1/x) let you linearise common nonlinear relationships: an exponential y = a·ebx becomes a straight line under Transform y = ln(y), a power law y = a·xb becomes one under both log transforms, and so on. Watch the R² jump when you pick the right pair.

Inputs accept commas, tabs, or spaces between x and y. Lines starting with # or // are ignored. The 95% band uses a Student's t approximation with n − p degrees of freedom (the t-quantile is calculated inline; for large n it converges to 1.96).