Academic managers online nowFree quote in 3 minutes. Assignments from $19.Submit assignment →
Free, no account, nothing storedThe arithmetic runs in your browser. Nothing you type is sent to us.All 100 calculators →

Statistics & Data Science · pattern F, Dataset

Least-squares line, with the working shown.

Paste x and y pairs for the fitted line, its slope and intercept, r and r², and the step-by-step substitution into the least-squares formulas.

Inputs

Sample or population

Divide by n − 1 for a sample drawn from a wider population; by n only when the data is the entire population.

The formula used

b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², a = ȳ − b·x̄

The fitted line always passes through the point of means, which is a useful check: substitute x̄ and you should get ȳ.

Fitted line

y = 1.9321x + 0.3429

n = 7 pairs · r = 0.9984 · r² = 0.9967 — strong linear association

Slope, b
1.93214
Intercept, a
0.34286
r
0.99835
0.99671
Mean of x
4.000
Mean of y
8.071
Σ(x−x̄)(y−ȳ)
54.100
Σ(x−x̄)²
28.000

Your data — accent bars sit beyond one deviation

2.3013.60

Worked steps

  1. 1b = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)² = 54.100 ÷ 28.000 = 1.93214

    the slope is the covariance of x and y over the variance of x

  2. 2a = ȳ − b·x̄ = 8.071 − 1.93214·4.000 = 0.34286

    the line passes through the point of means

  3. 3r = 0.99835, r² = 0.99671

    r² is the share of variation in y explained by x

Least squares minimises vertical distance, which is why direction matters.

The method minimises the squared vertical distances from the points to the line, so it treats x as known and y as uncertain. Regressing y on x and x on y therefore produce different lines, and they are not inverses of each other. Choose the direction that matches your question: the variable you would predict goes on the y axis.

Questions about regression

Why do y-on-x and x-on-y differ?
Because each minimises errors in a different direction. They coincide only when r is exactly ±1, and the gap between them widens as the correlation weakens.
What does the intercept mean?
The predicted y at x = 0, which is often outside the data and physically meaningless. Report it because the equation needs it, and interpret it only if x = 0 is genuinely in range.
Do I need to check residuals?
For any serious use, yes. Plot residuals against x: structure, a fan shape or a curve all indicate the linear model is the wrong one, and r² will not tell you.

A calculator handles the arithmetic. It cannot teach you the method.

If the number is not the part you are stuck on, that is what the service is for — a specialist who explains the working, not just the answer.

Statistical output here is for coursework and learning. Reported p-values and intervals assume the conditions stated on the page; nothing here checks whether those conditions hold for your data.