Home / Statistics Tools / Linear Regression Calculator

Linear Regression Calculator

Calculate linear regression equation, R², correlation coefficient, slope, intercept, and prediction values. Free online statistics tool.

Enter your X and Y data points below (one per line, or comma-separated pairs).

Advertisement

What Is Linear Regression?

Linear regression finds the best-fitting straight line (ŷ = b₁x + b₀) through your data points using the least squares method. It minimizes the sum of squared differences between actual Y values and predicted Y values on the line. It's one of the most fundamental techniques in statistics and machine learning.

Understanding R² and Correlation

R² (R-squared) ranges from 0 to 1 and tells you what proportion of the variance in Y is explained by X. An R² of 0.85 means 85% of the variation in Y can be explained by the linear relationship with X. The correlation coefficient (r) ranges from -1 to 1, where values close to ±1 indicate a strong linear relationship, and 0 indicates no linear relationship.

Interpreting Slope and Intercept

The slope (b₁) tells you how much Y changes for each unit increase in X. The intercept (b₀) is the predicted Y value when X equals 0. For example, if the equation is ŷ = 2.1x + 3.5, then each unit increase in X is associated with a 2.1 unit increase in Y, and the baseline Y value (when X = 0) is 3.5.

Assumptions of Linear Regression

Linear regression assumes a linear relationship between X and Y, independence of observations, constant variance of residuals (homoscedasticity), and approximately normal distribution of residuals. Always examine your scatter plot to verify that a linear model is appropriate for your data.