Linear Regression Calculator

Free simple linear regression calculator: paste paired data to get the slope, intercept, R-squared, the regression equation, significance and a fitted-line plot. Matches R’s lm().

Paste two columns of paired data and get the least-squares regression line — slope, intercept, R², the equation, significance, and a plot with the fitted line. Results match R’s lm().

How to use it

Reading the output

Simple linear regression fits the straight line y = a + b·x that minimises the squared vertical distances to your points.

  • Slope (b): how much y changes for a one-unit increase in x. Its p-value tests whether the slope differs from zero (i.e., whether x predicts y).
  • Intercept (a): the predicted y when x = 0 (often not meaningful on its own).
  • R²: the share of variation in y explained by x — 0 is none, 1 is a perfect line.

Two reminders the numbers won’t give you: look at the scatter plot (a straight-line fit is only sensible if the relationship is roughly linear), and a good fit is not causation. If the pattern is curved or has outliers, a straight line will mislead.

Do it in R

fit <- lm(y ~ x)
summary(fit)      # slope, intercept, R², p-values

See Linear regression in R: how to read the output.

FAQ

Frequently asked questions

What’s the difference between correlation and regression?

Correlation measures the strength of a linear association (a single number, symmetric in x and y). Regression fits a predictive line and gives you a slope and intercept — it treats one variable as the outcome. R² here equals the correlation squared.

Can I trust the line if the data isn’t linear?

No. Least-squares always draws a line, even through curved data. Check the scatter plot first; if it bends, a straight line is the wrong model.


Regression with multiple predictors, confounders and a report? That’s our work.