statistics calculators

Linear Regression Slope Calculator

Calculate the slope of a least-squares linear regression line from summary statistics of your dataset. Use this in data analysis, forecasting, and whenever you need to quantify how much y changes per unit increase in x.

About this calculator

The slope of a linear regression line (b) tells you how much the dependent variable y changes for each one-unit increase in x. The least-squares formula is: b = (n·Σxy − Σx·Σy) / (n·Σx² − (Σx)²), where n is the number of data points, Σxy is the sum of each x multiplied by its paired y, Σx is the sum of all x values, and Σx² is the sum of squared x values. Note that this calculator uses sum_x in place of Σy in the numerator as labeled — ensure your inputs match the field definitions provided. The denominator (n·Σx² − (Σx)²) measures total variability in x; if this equals zero (all x values are identical), the slope is undefined. Once you have the slope, the y-intercept is found as a = ȳ − b·x̄, completing the line equation ŷ = a + bx.

How to use

Suppose you have 4 data points: (1,2), (2,4), (3,5), (4,4). Compute: n = 4, Σx = 10, Σxy = 1×2+2×4+3×5+4×4 = 2+8+15+16 = 41, Σx² = 1+4+9+16 = 30. Slope b = (4×41 − 10×10) / (4×30 − 10×10) = (164 − 100) / (120 − 100) = 64 / 20 = 3.2. Enter n = 4, sum of XY = 41, sum of X = 10, sum of X² = 30. The calculator returns a slope of 3.2, meaning y increases by 3.2 units for every 1-unit increase in x.

Frequently asked questions

What does a negative slope mean in linear regression?

A negative slope means that as the independent variable x increases, the predicted value of y decreases — the two variables have an inverse relationship. For example, a negative slope in a regression of temperature on heating costs would indicate that higher temperatures predict lower energy bills. The magnitude of the slope tells you the rate of decrease: a slope of −4 means y drops by 4 units for every 1-unit rise in x. A negative slope does not imply a causal relationship; it only describes the direction of the linear association in your data.

How is the regression slope different from the correlation coefficient?

The slope (b) and the correlation coefficient (r) are related but measure different things. The correlation coefficient is dimensionless and always falls between −1 and +1, measuring the strength and direction of a linear relationship. The slope has units (units of y per unit of x) and measures the rate of change. They are linked by b = r × (SD_y / SD_x). You can have a strong correlation (r close to ±1) with a very small or very large slope depending on the relative scales of x and y. Use r to assess how tightly the data follows the line; use b to understand the practical size of the effect.

Why do I need to provide summary statistics instead of raw data for this calculator?

This calculator uses pre-computed summary statistics — n, Σxy, Σx, and Σx² — because they are sufficient to determine the slope without storing every raw data point. This approach is computationally efficient and useful when you have already summarized your data or are working from published tables. If you have raw data, you can calculate these sums manually or with a spreadsheet: sum each x value, each x², and each x×y product, then enter the totals here. The result is mathematically identical to what you would get by running a full regression on the raw data.