Linear Regression Calculator

Enter your data points to calculate the regression line, slope, intercept, and R² instantly.

Results

Slope (β₁):

Intercept (β₀):

R²:

Regression Plot

What is Linear Regression?

Linear regression is a statistical method used to model the relationship between two variables by fitting a linear equation to observed data. The equation of a simple linear regression line is:

y = β₀ + β₁x

Where β₁ is the slope and β₀ is the intercept.

How to Use This Linear Regression Calculator

  1. Enter your X values separated by commas.
  2. Enter your Y values separated by commas.
  3. Click the Calculate button.
  4. The slope, intercept, and R² value will be displayed instantly.

Regression Formula

The slope is calculated as:

$$ \beta_1 = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})} {\sum (x_i - \bar{x})^2} $$

The intercept is calculated as:

$$ \beta_0 = \bar{y} - \beta_1 \bar{x} $$

The regression equation is:

$$ y = \beta_0 + \beta_1 x $$