Linear Regression Calculator

Calculate regression line, correlation, R-squared, and make predictions

Data Points

Enter your X and Y values (minimum 2 points)

Load Example

Make Prediction

Enter X value to predict Y

Predicted Y Value
5.8000

Regression Equation

Best fit line equation

y = 0.6000x + 2.2000

Regression Coefficients

Slope (m)
0.600000
Rate of change
Intercept (b)
2.200000
Y value when X = 0

Correlation Analysis

Correlation (r)
0.774597
Strong Positive Correlation
R-Squared (R²)
0.600000
60.00% of variance explained

Data Statistics

Sample Size (n)5
Mean of X3.0000
Mean of Y4.0000

Interpretation Guide

R² Value:
Good fit - model is useful
Slope:
For every 1 unit increase in X, Y changes by 0.6000 units

About Linear Regression Calculator

What is Linear Regression?

Linear regression is a statistical method used to model the relationship between a dependent variable (Y) and one or more independent variables (X). It finds the best-fitting straight line through the data points using the least squares method, minimizing the sum of squared differences between observed and predicted values.

The Regression Equation

The linear regression equation is: y = mx + b

  • m (slope): Rate of change in Y for each unit change in X
  • b (intercept): Value of Y when X equals zero

Understanding Correlation (r)

  • r = 1: Perfect positive correlation
  • r = -1: Perfect negative correlation
  • r = 0: No linear correlation
  • |r| > 0.7: Strong correlation
  • 0.3 < |r| < 0.7: Moderate correlation
  • |r| < 0.3: Weak correlation

R-Squared (R²)

R-squared represents the proportion of variance in the dependent variable that is predictable from the independent variable. An R² of 0.80 means 80% of the variance in Y can be explained by X. Higher R² values indicate better model fit.

Applications

  • Predicting sales based on advertising spend
  • Forecasting stock prices or economic indicators
  • Analyzing relationships between variables in research
  • Quality control and process optimization
  • Real estate price prediction
  • Medical research and epidemiology
  • Climate and weather forecasting

Important Notes

  • Correlation does not imply causation
  • Linear regression assumes a linear relationship between variables
  • Outliers can significantly affect the regression line
  • Extrapolation beyond the data range may be unreliable
  • Minimum of 2 data points required (more is better)
  • Check residual plots to validate model assumptions