ŷ = 2.2000 + 0.6000 × x
| n (pairs) | 5 |
| Mean of x, x̄ = Σx / n | 3.0000 |
| Mean of y, ȳ = Σy / n | 4.0000 |
| Sxx = Σ(x − x̄)² | 10.0000 |
| Syy = Σ(y − ȳ)² | 6.0000 |
| Sxy = Σ(x − x̄)(y − ȳ) | 6.0000 |
| Slope, b₁ = Sxy / Sxx | 0.600000 |
| Intercept, b₀ = ȳ − b₁x̄ | 2.200000 |
| Pearson r = Sxy / √(Sxx·Syy) | 0.774597 |
| r², share of variance explained | 0.600000 |
| Residual SS = Syy − b₁Sxy | 2.400000 |
| s = √(SSE / (n − 2)) | 0.894427 |
| SE(b₁) = s / √Sxx | 0.282843 |
| t = b₁ / SE(b₁), df = n − 2 | 2.1213, df 3 |
| Two-tailed p for slope = 0 | 0.124027 |
ŷ = 2.2000 + 0.6000 × 6 = 5.8000. Predictions far outside the range of your x values are extrapolation, and the line may not hold there.
Least squares chooses the slope and intercept that make the sum of squared vertical distances from the points to the line as small as possible. The slope is b₁ = Sxy / Sxx, and the line always passes through (x̄, ȳ), which is why the intercept is b₀ = ȳ − b₁x̄. The t test on the slope asks whether the true slope could be zero; it uses n − 2 degrees of freedom because two parameters were estimated from the data.
Fit a least-squares line and see every step. Linear regression fits the straight line y = b0 + b1·x that comes closest to a set of paired points, by minimizing the sum of squared vertical distances. This calculator computes the slope, intercept, Pearson r, r², the residual standard error and a t test for the slope, and it shows the sums that produce each number so you can check the work by hand.
Read r² and the slope test together. A large r² from a small sample can still be a weak result, and a significant slope does not show that x causes y. The line describes the linear association in the data you entered and nothing more. 100% free, no registration, and complete privacy — everything runs locally in your browser, so your data never touches a server.
b1 = Sxy / Sxx and b0 = ȳ − b1·x̄. The fitted line always passes through the point of means (x̄, ȳ).
r = Sxy / √(Sxx·Syy) gives direction and strength. r² is the share of the variation in y that the line explains.
SE(b1) = s / √Sxx and t = b1 / SE(b1), with n − 2 degrees of freedom, give a two-tailed p-value for H0: slope = 0.
Enter an x value to get the fitted ŷ, with the equation written out using the calculated coefficients.
Pearson r, r² and a significance test for the same paired data.
One-sample, Welch and paired t tests with the p-value.
Sample and population standard deviation and variance for a list.
Z score, percentile and probabilities for a value in a normal distribution.
The slope is the average change in y for a one-unit increase in x, along the fitted line. If x is in hours and y in kilograms, a slope of 0.6 means about 0.6 kg more per extra hour, on average, within the range of your data.
r is the Pearson correlation, between −1 and +1, and it carries the sign of the slope. r² is its square, between 0 and 1, and gives the share of the variation in y that the line accounts for. With r = 0.77, r² is about 0.60, so about 60% of the variation in y is linearly associated with x.
The fitted line estimates two parameters, the slope and the intercept, so two degrees of freedom are used up. The residual variance is divided by n − 2 for that reason, and the t statistic follows a t distribution with n − 2 degrees of freedom when the errors are independent and roughly normal.
A line through two points fits perfectly and says nothing about the scatter, so the calculator asks for at least three pairs. With three or more pairs, the residual error and the slope test become meaningful.
We use cookies for analytics and personalized ads to help keep these tools free. Until you accept, ads stay non-personalized and analytics cookies are off. See our Privacy Policy.