CalcUnit Logo

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.

Fitted line: ŷ = 2.2 + 0.6x · r = 0.7745966692 · R² = 0.6
Slope (b)
0.6
Intercept (a)
2.2
Correlation (r)
0.7745966692
R Squared (R²)
0.6
Pairs Fitted
5
Std. Error of Slope
0.2828427125
Std. Error of Intercept
0.938083152
t Statistic (slope)
2.121320344
p-value (slope)
0.124
SSE (residual)
2.4
SST (total)
6
Predicted Y at X = 6
5.8
x: 0.76 to 5.24y: 1.7 to 5.3

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.

XObserved YPredicted ŷResidual
122.8-0.8
243.40.6
3541
444.6-0.6
555.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

  1. 1Paste your pairs in the data box, one pair per line, X first: 3, 7.
  2. 2Check that at least three pairs are present; the page names any line it cannot read, by number.
  3. 3Click Fit the Line, though the fit also updates as you type.
  4. 4Read the banner for the fitted equation, r, and R squared in one line.
  5. 5Read the Predicted Y tile for the value at your chosen X, and set that X in the Predict box.
  6. 6Look at the scatter plot: confirm the dots follow the line and no single point is dragging it.
  7. 7Note the Pairs Fitted tile — it proves the fit used every row you pasted.
  8. 8Treat predictions beyond the plotted X range as extrapolations and weigh them accordingly.

Formula

a * b

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

ScenarioCalculationResult
The opening defaultPairs (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 linePairs (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 columnPairs (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 1Sum of XSum of YSum of X SquaredSum of Y SquaredSum of XY ProductsSlope (b)Intercept (a)Correlation Coefficient (r)R SquaredPredicted Y
0.314.3020.0054.0986.0064.600.56092.39570.83180.69185.7614
0.514.5020.0054.2586.0065.000.57382.33610.81820.66945.7787
0.814.8020.0054.6486.0065.600.59082.25110.79390.63025.7962
115.0020.0055.0086.0066.000.60002.20000.77460.60005.8000
216.0020.0058.0086.0068.000.58822.11760.62620.39225.6471
317.0020.0063.0086.0070.000.38462.69230.35810.12825.0000
418.0020.0070.0086.0072.000.00004.00000.00000.00004.0000

Practice Problems

Check your understanding of the Regression Calculator with these practice problems. Click a problem to reveal its correct calculated answer.

Q1

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 Answer
With 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 results are 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.
Q2

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 Answer
Entering 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 gives Sum of X 30.50, Sum of Y 29.00, Sum of X Squared 222.25, Sum of Y Squared 195.00, Sum of XY Products 205.50, and 5 more more results.

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.

1

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.

2

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.

3

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.

4

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.

5

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.

1

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.

2

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.

3

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

Share this Calculator

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>