# Linear Regression Calculator

Free online Linear regression calculator – Calculate the line of best fit for your data with our simple linear regression calculator.

Enter number seperated by commas

## Linear Regression Formula

The formula for simple linear regression, which involves one independent variable(x) and one dependent variable(y), is represented as:

y = mx + b

• y = dependent variable
• x = independent variable
• m = slope of the line(representing the change in y for a unit change in x)
• b = y-intercept (the value of y when x is 0)

In multiple linear regression, where there are two or more independent variables (x1, x2, x3, …..xn), the formula becomes:

y = mx1 + bx1 + mx2 + bx2 + … + mn + bn

• y = dependent variable
• m1, m2, …, mn = slopes of the lines
• b1, b2, …, bn = y-intercepts
• x1, x2, …, xn = independent variables

## How to calculate linear regression?

Calculating linear regression involves finding the best-fitting line (in the case of simple linear regression) or hyperplane (in the case of multiple linear regression) that minimizes the sum of squared differences between the observed and predicted values.

• Calculate the slope with formula- m = (Σxy – ΣxΣy) / (Σx2 – (Σx)^2)
• second, calculate the Y-intercept: b = Σy – mΣx
• last, Predicted value: ŷ = mx + b
• Where,
• Σx = sum of the independent variable values
• Σy = sum of the dependent variable values
• Σxy = sum of the product of the independent and dependent variable values
• Σx2 = sum of the squared independent variable values

## What is linear regression?

Linear regression is a statistical method used to model the relationship between a dependent variable and one or more independent variables by fitting a linear equation to the observed data.