Regression Calculator
The Regression Calculator fits a least-squares straight line to your paired X and Y value lists, then reports the line equation y = mx + b, the R-squared value, and a predicted Y at an X value you choose.
What this calculator does
The Regression Calculator estimates your result instantly from the values you enter, using standard statistics formulas. The Regression Calculator fits a least-squares straight line to your paired X and Y value lists, then reports the line equation y = mx + b, the R-squared value, and a predicted Y at an X value you choose. Calculations run in your browser, so nothing you type is sent to a server, and the output is an estimate rather than a certified or official figure.
Result
About Regression Calculator
Paste a list of X values and a matching list of Y values, and this tool fits the best straight line through them using ordinary least squares. It returns the slope-intercept equation, the R² goodness-of-fit value, and a prediction for any X you enter.
Both lists must have the same length and at least two points, and the X values need some variation for a line to be defined.
Formula & Mathematical Calculation
Calculation Method
- Compute } d=n × sx2-sx × sx
- Compute } m=(n × sxy-sx × sy) ÷ d, b=(sy-m × sx) ÷ n
- Compute den=Math.sqrt((n × sx2-sx × sx) × (n × sy2-sy × sy)), r=den===0?0:(n × sxy-sx × sy) ÷ den
Calculation Example
With X = 1, 2, 3, 4 and Y = 2, 4, 5, 8, the tool computes n = 4, Σx = 10, Σy = 19, Σxy = 57, Σx² = 30. The slope is m = (4×57 − 10×19) ÷ (4×30 − 10²) = 38 ÷ 20 = 1.9, and the intercept b = (19 − 1.9×10) ÷ 4 = 0.
The equation shown is y = 1.9x + 0. Predicting at X = 5 gives y = 1.9×5 + 0 = 9.5, and R² = 38² ÷ (20×75) = 0.9627.
Key Benefits
- Fits a least-squares regression line to any paired X and Y data you enter
- Shows the slope-intercept equation, R-squared, and a point prediction together
- Lets you forecast Y at a specific X value without a spreadsheet
- Reports R-squared so you can judge how well the line fits the data
How to Use this Calculator
-
Enter X values
Type your independent-variable values into the X values field, separated by commas. -
Enter Y values
Type the matching dependent-variable values into the Y values field, using the same count as X. -
Set the prediction point
Enter the X value at which you want a predicted Y in the Predict Y at X field. -
Calculate
Press Calculate and read the Equation, Predicted Y, and R-squared result boxes.
Assumptions & Limitations
What the calculation assumes
- Every value you enter is treated as an exact, known amount.
- Any rate or interval you enter is assumed to hold for the whole period unless the form asks for it separately.
- Results use standard published formulas and account only for the values entered above.
- Rounding is applied for display; the underlying calculation uses your full precision.
- Results are returned in the same units you enter, unless the tool states the output unit.
What it does not cover
- Regression Calculator produces a calculated result for reference and learning, not a certified or official measurement.
- Real-world outcomes differ when tolerances, rounding rules or local standards apply.
- Definitions and standards vary by region and change over time; verify the convention that applies to your case.
- Figures are only as accurate as the inputs you supply — check them before acting on the result.
- For work where the result carries real consequences, confirm it against an authoritative source.
Frequently Asked Questions
Free to use, no account needed. Calculations run in your browser, so nothing you type is sent to a server. Results are estimates — how we build and check our calculators.