Linear Regression Calculator

Perform simple linear regression analysis. Find the best-fit line equation, R-squared, correlation coefficient, and make predictions.

EQUATION
--
Slope (b)
--
Intercept (a)
--
--
Predicted Y
--

What Is Linear Regression?

Linear regression is a statistical method for modeling the relationship between a dependent variable (y) and an independent variable (x) by fitting a linear equation y = a + bx to the data. The method of least squares finds the line that minimizes the sum of squared residuals.

It is one of the most widely used statistical techniques in science, engineering, economics, and social sciences. Applications include trend analysis, forecasting, and determining the strength and direction of relationships between variables.

Formulas

b = [nΣxy - ΣxΣy] / [nΣx² - (Σx)²]
a = ȳ - b×x̄
R² = 1 - Σ(yi - ŷi)² / Σ(yi - ȳ)²

Interpreting Results

R² RangeInterpretation
0.90 - 1.00Very strong linear relationship
0.70 - 0.89Strong relationship
0.40 - 0.69Moderate relationship
0.00 - 0.39Weak or no relationship

Frequently Asked Questions

What does R-squared tell me?

R-squared (coefficient of determination) indicates the proportion of variance in the dependent variable that is explained by the independent variable. An R² of 0.85 means 85% of the variation in y is explained by x.

What is the difference between correlation and regression?

Correlation measures the strength and direction of a linear relationship (r), while regression provides an equation to predict one variable from another. Regression gives you the specific line equation.

When is linear regression not appropriate?

Linear regression is inappropriate when the relationship is non-linear, when there are significant outliers, when residuals are not normally distributed, or when the data violates assumptions of homoscedasticity and independence.