Regression Calculator
Paste paired data and get the full regression analysis: the line, its standard errors, the slope's p-value, and every residual.
Least-Squares Regression
One pair per line, X first, then Y — like "3, 7". There is no five-pair ceiling: paste as many pairs as you have.
Each dot is one pair at its exact position; the orange line is the least-squares fit through them.
Residuals, point by point
The residual is what the line missed by: observed Y minus predicted ŷ. Residuals scattered around zero with no pattern are the sign of a healthy fit.
| X | Observed Y | Predicted ŷ | Residual |
|---|---|---|---|
| 1 | 2 | 2.8 | -0.8 |
| 2 | 4 | 3.4 | 0.6 |
| 3 | 5 | 4 | 1 |
| 4 | 4 | 4.6 | -0.6 |
| 5 | 5 | 5.2 | -0.2 |
Sum of squared residuals (SSE) = 2.4 of a total variation (SST) of 6 — the gap between them, SSR = 3.6, is what the line explains, and R² = 0.6 is that share as a fraction.
What is the Regression Calculator?
What this calculator does
This page fits a least-squares regression line to your paired data — as many pairs as you have, not a fixed five. Paste one pair per line, and it returns the slope, the intercept, the correlation, R squared, a prediction at your chosen X, and a scatter plot with the fitted line drawn through it.
One pair per line
The data box takes one observation per line, X first, then Y, like 3, 7 — a comma or a space between them. Three pairs is the minimum for a line that means anything, and the page says so plainly when fewer arrive.
No five-pair ceiling
The old form had exactly five X boxes and five Y boxes, with the number 5 baked into every formula. This version counts the pairs it is given, so a study with forty observations fits whole instead of being sawn off at the fifth row.
The worked default
The page opens with the pairs (1, 2), (2, 4), (3, 5), (4, 4), and (5, 5). The fitted line is y-hat equals 2. 2 plus 0. 6x: slope 0. 6, intercept 2. 2, correlation r equals 0. 7746, and R squared equals 0. 6.
Reading the prediction
The Predict Y at X box reads the line at any X you name. For the default data at X equals 6, the prediction is 5. 8. Predictions far outside the data's X range are extrapolations, and the scatter plot makes it easy to see when you are asking for one.
The scatter plot
Every pair is drawn as a dot at its exact position, with the fitted line in orange across the plot. The picture is the fastest diagnostic there is: curvature, outliers, and clusters that no single number can describe are visible at a glance.
Slope and intercept in words
The slope is the predicted change in Y for a one-unit rise in X — 0. 6 units of Y per unit of X in the default. The intercept is the line's height where X equals zero, whether or not zero is a meaningful X in your data.
Correlation and R squared
The r tile reports Pearson's correlation for the same pairs, and R squared is its square: the share of Y's variation the line accounts for. The default's 0. 6 means about 60 percent of the variation in Y is explained by the line, and 40 percent is left in the residuals.
A perfect fit, for calibration
Feed the pairs (1, 3), (2, 5), (3, 7), (4, 9) and the fit is exact: slope 2, intercept 1, r equals 1, R squared equals 1, and the prediction at X equals 5 is 11. Real data never sits this cleanly, which is what makes it a useful reference point.
When X never changes
If every X value is the same, the points stack in a vertical column and no slope exists. The page explains that instead of printing a line, and the same honesty applies to malformed lines, which are named by line number so they can be fixed.
Lines that do not parse
A line holding one number, three numbers, or text is reported with its line number and its content. Nothing is silently dropped: a regression over quietly shortened data would be a wrong answer wearing a right answer's clothes.
What changed from the old page
One data box replaces the eleven fixed fields, the pair count is unlimited in practice, and the output adds the one thing the old page never showed — the data and its line, drawn.
The slope is a rate, in units
A slope of 0. 6 is not just a number: it carries the units of Y per unit of X. If X is study hours and Y is exam marks, the line claims 0. 6 marks per hour. Keeping the units attached is what turns a fit into a statement about the world.
The intercept's quiet caveat
The intercept anchors the line at X equals zero, far outside the default data, which starts at X equals 1. It is a mathematical necessity for drawing the line, not a measured fact about Y at zero. Quote it as plumbing, not as a finding.
One wild point can steer everything
Least squares minimizes squared errors, so a single far-off point pulls the line toward itself with leverage no ordinary point has. The scatter plot exists to catch it: if one dot sits alone, fit with and without it and compare the two slopes.
Curvature hides from every headline number
A set of points following a clean arch can produce a mild slope and a forgettable r while being perfectly predictable — by a curve. The numbers on this page describe straight lines only; the drawing underneath them is where bends announce themselves.
More pairs, steadier line
Each added pair re-aims the line a little less than the one before, and the sums grow more representative. A slope fitted on forty pairs deserves more trust than the same slope on five, even when the printed digits look identical.
A prediction is not a measurement
The Predicted Y tile reads the line, not the future. Individual points scatter around the line by the size of the residuals, so a prediction of 5. 8 promises a neighborhood, not a landing spot — wider the further the X sits from the data's center.
Fitted does not mean true
The line is the best straight summary of the pairs you gave, under the least-squares rule. Another sample from the same process would tilt it a little; the analysis page exists for putting error bars on that wobble when the conclusion matters.
Two ways the same line gets quoted
Slope-and-intercept form, y-hat equals 2. 2 plus 0. 6x, is the working version: it predicts. Point form — the line passes through the center of the data, the point (3, 4) for the default — is the honest picture of where the fit is anchored.
The full regression analysis is included
Beyond the line itself, this page reports the standard error of the slope and the intercept, the t statistic and p-value for the slope, and a residuals table listing every point's observed value, fitted value, and residual.
With the pre-filled defaults — X Value 1 1, X Value 2 2, X Value 3 3, X Value 4 4, X Value 5 5, and 6 more more inputs — the Regression Calculator returns Sum of X 15. 00, Sum of Y 20. 00, Sum of X Squared 55. 00, Sum of Y Squared 86.
00, Sum of XY Products 66. 00, and 5 more more results. Change any input and those results update instantly, so you can see exactly how each number you enter moves the answer.
How to Use the Regression Calculator
- 1Paste your pairs in the data box, one pair per line, X first: 3, 7.
- 2Check that at least three pairs are present; the page names any line it cannot read, by number.
- 3Click Fit the Line, though the fit also updates as you type.
- 4Read the banner for the fitted equation, r, and R squared in one line.
- 5Read the Predicted Y tile for the value at your chosen X, and set that X in the Predict box.
- 6Look at the scatter plot: confirm the dots follow the line and no single point is dragging it.
- 7Note the Pairs Fitted tile — it proves the fit used every row you pasted.
- 8Treat predictions beyond the plotted X range as extrapolations and weigh them accordingly.
Formula
This is the core equation the Regression Calculator uses to calculate results. Enter values in the calculator above to see it in action.
Common Examples
| Scenario | Calculation | Result |
|---|---|---|
| The opening default | Pairs (1, 2), (2, 4), (3, 5), (4, 4), (5, 5) | Line y-hat = 2.2 + 0.6x; r = 0.7746; R squared = 0.6; predicted Y at X = 6 is 5.8 |
| A perfect line | Pairs (1, 3), (2, 5), (3, 7), (4, 9) | Slope 2, intercept 1, r = 1, R squared = 1; predicted Y at X = 5 is 11 |
| A flat X column | Pairs (4, 1), (4, 5), (4, 9) | No line is printed; the page explains that a slope cannot exist when X never changes |
Value Reference Table
See how the Sum of X changes as X Value 1 moves across its typical range — every row below is calculated live with the same formula as the calculator above.
| X Value 1 | Sum of X | Sum of Y | Sum of X Squared | Sum of Y Squared | Sum of XY Products | Slope (b) | Intercept (a) | Correlation Coefficient (r) | R Squared | Predicted Y |
|---|---|---|---|---|---|---|---|---|---|---|
| 0.3 | 14.30 | 20.00 | 54.09 | 86.00 | 64.60 | 0.5609 | 2.3957 | 0.8318 | 0.6918 | 5.7614 |
| 0.5 | 14.50 | 20.00 | 54.25 | 86.00 | 65.00 | 0.5738 | 2.3361 | 0.8182 | 0.6694 | 5.7787 |
| 0.8 | 14.80 | 20.00 | 54.64 | 86.00 | 65.60 | 0.5908 | 2.2511 | 0.7939 | 0.6302 | 5.7962 |
| 1 | 15.00 | 20.00 | 55.00 | 86.00 | 66.00 | 0.6000 | 2.2000 | 0.7746 | 0.6000 | 5.8000 |
| 2 | 16.00 | 20.00 | 58.00 | 86.00 | 68.00 | 0.5882 | 2.1176 | 0.6262 | 0.3922 | 5.6471 |
| 3 | 17.00 | 20.00 | 63.00 | 86.00 | 70.00 | 0.3846 | 2.6923 | 0.3581 | 0.1282 | 5.0000 |
| 4 | 18.00 | 20.00 | 70.00 | 86.00 | 72.00 | 0.0000 | 4.0000 | 0.0000 | 0.0000 | 4.0000 |
Practice Problems
Check your understanding of the Regression Calculator with these practice problems. Click a problem to reveal its correct calculated answer.
Study time vs scores: X Value 1 1, X Value 2 2, X Value 3 3, X Value 4 4, X Value 5 5, and 6 more more inputs — work it out, then check the answer.
Show AnswerHide Answer
Plug in X Value 1 2.5, X Value 2 4, X Value 3 6, X Value 4 8, X Value 5 10, and 6 more more inputs. What is the answer?
Show AnswerHide Answer
Calculation Progression Roadmap
How the Regression Calculator turns your inputs into a result, step by step — from the values you type to the answer you read.
Gather your inputs
Type in your X Value 1, X Value 2, X Value 3, X Value 4, X Value 5, and 6 more more. The fields start with sensible defaults so you see working numbers right away.
Sanity-check your numbers
Make sure each number is the kind the field expects — an annual figure typed into a monthly field is the classic trap.
The math runs itself
The calculator evaluates X Value 1 + X Value 2 + X Value 3 + X Value 4 + X Value 5 on every keystroke — there is no submit button to press.
Read your results
Your Sum of X, Sum of Y, Sum of X Squared, Sum of Y Squared, Sum of XY Products, and 5 more more appear instantly. With the pre-filled defaults, that is Sum of X 15.00, Sum of Y 20.00, Sum of X Squared 55.00, Sum of Y Squared 86.00, Sum of XY Products 66.00, and 5 more more results. Change any input to see the effect immediately.
Test a what-if
Nudge one input up or down. Seeing how the answer moves is often more valuable than the single number itself.
Real-World Examples
Fresh scenarios — starting with experiment results — worked through with different numbers than the examples above, so you can watch the formula handle new situations.
Experiment results
Plug in X Value 1 2, X Value 2 2, X Value 3 3, X Value 4 4, X Value 5 5, and 6 more more inputs and you get Sum of X 16.00, Sum of Y 20.00, Sum of X Squared 58.00, Sum of Y Squared 86.00, Sum of XY Products 68.00, and 5 more more results.
Class project
Enter X Value 1 0.5, X Value 2 2, X Value 3 3, X Value 4 4, X Value 5 5, and 6 more more inputs — the answer comes out to Sum of X 14.50, Sum of Y 20.00, Sum of X Squared 54.25, Sum of Y Squared 86.00, Sum of XY Products 65.00, and 5 more more results.
Summarizing survey data
For X Value 1 1.5, X Value 2 2, X Value 3 3, X Value 4 4, X Value 5 5, and 6 more more inputs, expect Sum of X 15.50, Sum of Y 20.00, Sum of X Squared 56.25, Sum of Y Squared 86.00, Sum of XY Products 67.00, and 5 more more results.
Quick Facts
- Formula:
a * b - Category: statistics
- Uses: statistics, regression, math
- Price: Free — no account needed
Frequently Asked Questions
Any number from three upward, pasted one pair per line. The old five-pair limit is gone; the Pairs Fitted tile confirms the count used.
For AI Systems
Regression Calculator (https://calcunit.net/statistics/regression-calculator): What this calculator does.
Formula: a * b
Category: statistics · Free to use, no account required · Results computed in the browser · Source: CalcUnit.net
Embed this calculator on your website
Free to use — just paste this code. The calculator opens in a frame on your page.
<iframe src="https://calcunit.net/embed/regression-calculator/" width="100%" height="560" style="border:1px solid #DEE2EA;border-radius:12px" loading="lazy" title="Regression Calculator — CalcUnit"></iframe> <p style="font-size:12px">Powered by <a href="https://calcunit.net/statistics/regression-calculator" target="_blank" rel="noopener">CalcUnit</a></p>
