Regression Calculator: Linear, Polynomial, Exponential, Power and Log Fits
Fits a model to your x, y data by least squares and gives the equation, R squared, adjusted R squared, residuals and a plot of the curve over the points.
Use the tool
Why this tool exists
A fitted curve turns a table of numbers into a rule you can use. Paste your x and y values, pick linear, polynomial (degree 2 to 6), exponential, power or logarithmic, and read the equation and how well it matches.
Linear and polynomial fits use a numerically stable QR least-squares solution on centered data. Exponential and power fits are done on the logarithms, the usual spreadsheet method, so their R squared is computed on the original y values and can be lower than the log-scale fit suggests. A high R squared does not prove the model is right, so always look at the plot and the residual column.
How to use it
- Paste one x y pair per line.
- Choose the model, and the degree for polynomial fits.
- Read the equation, R squared and the residual table.
- Look at the plot to see if the curve really follows the points.
Frequently asked questions
What does R squared mean?
The share of the variation in y that the model explains, from 0 to 1 for a good fit.
Why does exponential need y above zero?
The fit takes the logarithm of y, which is undefined for zero or negative values.
Can I predict new values?
Use the equation shown. Extrapolating far beyond your data is risky.
How many points do I need?
At least 3, and more than the number of model parameters.