Linear Regression Calculator

Calculate the best-fit line for your data points.

Regression Line
Enter data points and calculate
Slope (m)
Y-Intercept (b)
Correlation (r)
R-Squared (r²)
Mean X
Mean Y
Std Error
Predict Y

Linear Regression

Linear regression finds the best-fitting straight line through a set of data points by minimizing the sum of squared residuals.

Regression Equation

ŷ = mx + b

Where m is the slope and b is the y-intercept.

Formulas

m = Σ(x-x̄)(y-ȳ) / Σ(x-x̄)²
b = ȳ - m·x̄

Interpreting Results

  • Slope (m): Change in Y for each unit increase in X
  • R (correlation): Strength and direction of linear relationship (-1 to 1)
  • R²: Proportion of variance in Y explained by X (0 to 1)

Correlation Guidelines

|r| ValueInterpretation
0.90 - 1.00Very strong
0.70 - 0.90Strong
0.50 - 0.70Moderate
0.30 - 0.50Weak
0.00 - 0.30Very weak/none

Frequently Asked Questions

What is the difference between correlation and regression?
Correlation measures the strength of the relationship between two variables. Regression describes that relationship with a mathematical equation, allowing predictions.
When is linear regression appropriate?
Linear regression is appropriate when there's a linear relationship between variables, residuals are normally distributed, and there's constant variance (homoscedasticity).