Skip to main content
v2026.11,858 entries · CC-BY 4.0

What Is a Regression Coefficient? Formula and Worked Example

A regression coefficient is the predicted change in the outcome per one-unit change in a predictor. Formula, worked example, reading output, and code.

Written and maintained by CASRAI Editorial Board

Last updated

A regression coefficient is the number a regression model attaches to a predictor. In a straight-line model it is the slope: the predicted change in the outcome for a one-unit increase in the predictor. This guide gives the formula with every symbol explained, a fully worked example you can check by hand, a table for reading regression output, and code to reproduce the numbers in Excel, R and Python.

What is a regression coefficient?

A regression coefficient is an estimated parameter of a regression equation. For each predictor, the coefficient states how much the outcome is predicted to change when that predictor increases by one unit. The intercept is a separate coefficient: the predicted outcome when the predictor equals zero. The UCLA Advanced Research Computing annotated Stata output describes the Coef. column as the amount of increase in the outcome for a one-unit increase in the predictor.

Because the coefficient is expressed in the units of the outcome per unit of the predictor, its size depends on how both variables are measured. A slope of 0.8 points per hour of study is a different claim from 0.8 points per week of study.

Regression coefficient formula

The NIST/SEMATECH e-Handbook of Statistical Methods (section 4.3.1) writes the straight-line model as y = β0 + β1x + ε and gives the least-squares estimates below. In the formulas, a hat marks an estimate and a bar marks a mean.

  • Slope: β̂1 = Σ(xi − x̄)(yi − ȳ) / Σ(xi − x̄)²
  • Intercept: β̂0 = ȳ − β̂1x̄

Symbols: yi is the observed outcome for case i; xi is the predictor value for case i; x̄ and ȳ are the sample means of the predictor and outcome; ε is the error term, the part of y the line does not explain; Σ sums over all cases. The numerator measures how x and y vary together; the denominator measures how much x varies on its own. The slope is their ratio.

Worked example with real numbers

Take five cases with x = 1, 2, 3, 4, 5 and y = 2, 4, 5, 4, 6.

  1. Means: x̄ = 15 / 5 = 3 and ȳ = 21 / 5 = 4.2.
  2. Deviations of x: −2, −1, 0, 1, 2. Deviations of y: −2.2, −0.2, 0.8, −0.2, 1.8.
  3. Numerator: (−2)(−2.2) + (−1)(−0.2) + (0)(0.8) + (1)(−0.2) + (2)(1.8) = 4.4 + 0.2 + 0 − 0.2 + 3.6 = 8.0.
  4. Denominator: 4 + 1 + 0 + 1 + 4 = 10.
  5. Slope: β̂1 = 8.0 / 10 = 0.8.
  6. Intercept: β̂0 = 4.2 − 0.8 × 3 = 1.8.

The fitted line is ŷ = 1.8 + 0.8x. The fitted values are 2.6, 3.4, 4.2, 5.0 and 5.8, so the residuals (y − ŷ) are −0.6, 0.6, 0.8, −1.0 and 0.2. Their squares sum to 0.36 + 0.36 + 0.64 + 1.00 + 0.04 = 2.4. With n − 2 = 3 degrees of freedom the residual variance is 2.4 / 3 = 0.8, so the standard error of the slope is √(0.8 / 10) = √0.08 ≈ 0.283. Then t = 0.8 / 0.283 ≈ 2.83, and the two-sided p-value on 3 degrees of freedom is about 0.066. The 95% confidence interval is 0.8 ± 3.182 × 0.283, or roughly −0.10 to 1.70. (The critical value 3.182 is the 97.5th percentile of the t distribution with 3 degrees of freedom.)

How to interpret a regression coefficient

In the example, each one-unit increase in x is associated with a predicted increase of 0.8 in y. The sign gives the direction (positive: y rises with x; negative: y falls). The magnitude is read in the units of the variables. The UCLA OARC guide to regression output explains the columns that surround the coefficient:

Output column What it tells you Example value
Coef. Predicted change in the outcome per one-unit increase in the predictor 0.8
Std. Err. Precision of the estimate; used to build the confidence interval 0.283
t Estimate divided by its standard error; tests whether the coefficient is 0 2.83
P>|t| If below the chosen alpha (for example 0.05), the coefficient is statistically significant 0.066
95% Conf. Interval If the interval includes 0, the coefficient is not statistically significant −0.10 to 1.70

In this small example the interval includes 0 and p is above 0.05, so the slope is not statistically significant at the 0.05 level, even though the point estimate is 0.8. With only five cases the estimate is imprecise, which is exactly what the wide interval shows. See the CASRAI guide to confidence intervals for the general idea, and reading SPSS output for the same columns in another package.

Assumptions and common mistakes

  • Reading a coefficient as a causal effect. The coefficient describes association in your data. A predictor left out of the model can distort it; see omitted variable bias.
  • Ignoring units. Compare coefficients only when predictors are on the same scale, or rescale first.
  • Confusing the slope with fit. A coefficient says nothing about how well the line fits; that is the job of R², covered in the coefficient of determination formula. Here R² = 0.727.
  • Treating a non-significant coefficient as zero. A wide interval means the data are compatible with a range of slopes, not that the slope is zero.
  • Overlapping predictors. In a model with several predictors, correlated predictors make individual coefficients unstable; see variance inflation factor and multicollinearity. A predictor’s coefficient can even change sign when another is added; see suppressor variables.
  • Extrapolating. The intercept and slope describe the range of x that was observed.

How to report a regression coefficient

A clear report gives the unstandardised coefficient, its standard error or confidence interval, the test statistic with degrees of freedom, and the p-value, with the units named. For the example: “Each additional unit of x was associated with a 0.8-unit increase in y (b = 0.80, SE = 0.28, 95% CI [−0.10, 1.70], t(3) = 2.83, p = .066).” Check your target journal’s instructions for its required format for symbols, decimals and italics.

How to calculate a regression coefficient in Excel, R or Python

Excel

=SLOPE(B2:B6, A2:A6)      // 0.8
=INTERCEPT(B2:B6, A2:A6)  // 1.8

Here column A holds x and column B holds y. The Data Analysis ToolPak regression tool also returns standard errors, t and p.

R

x <- 1:5
y <- c(2, 4, 5, 4, 6)
fit <- lm(y ~ x)
summary(fit)   # Estimate, Std. Error, t value, Pr(>|t|)
confint(fit)   # 95% confidence intervals

Python

import statsmodels.api as sm
x = [1, 2, 3, 4, 5]
y = [2, 4, 5, 4, 6]
fit = sm.OLS(y, sm.add_constant(x)).fit()
print(fit.summary())   # coef 1.8 and 0.8, std err, t, P>|t|, CI

All three return a slope of 0.8 and an intercept of 1.8 for the example. For a quick browser-style calculation, see the CASRAI linear regression calculator guide.

FAQ

What is a regression coefficient?

It is the estimated weight a regression equation gives a predictor: the predicted change in the outcome for a one-unit increase in that predictor.

What is the regression coefficient formula?

For a straight line, the slope is β̂1 = Σ(xi − x̄)(yi − ȳ) / Σ(xi − x̄)² and the intercept is β̂0 = ȳ − β̂1x̄ (NIST/SEMATECH e-Handbook, section 4.3.1).

How do I know if a regression coefficient is significant?

Check whether its p-value is below your chosen alpha, or whether its confidence interval excludes 0. The two checks agree.

Is the intercept a regression coefficient?

Yes. It is the constant term of the equation, the predicted outcome when the predictor is 0.

Sources

The worked example was computed by hand and checked with scipy.stats.linregress.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · free to try

Ask about What Is a Regression Coefficient? Formula and Worked Example

Ask your first 2 questions free below. Subscribers get 150 a day for $29 a month.

An AI assistant specialized in research administration. It cites the sources behind every answer, labels web answers and says when it can't answer.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays free to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →