All About Linear Regression Formula

# All About Linear Regression Formula

4 mins read552 Views Comment
Vikram Singh
Assistant Manager - Content
Updated on Jan 27, 2023 13:03 IST

The linear regression formula gives the relationship between the dependent and independent variables. There are two types of linear regression: simple and multiple linear regression. This article will briefly discuss all about simple and multiple linear regression with the help of exmaples.

Linear Regression models a linear relationship between two or more continuous variables (dependent and independent variables) with the line of regression.

• In linear regression, linear refers to a line, and regression refers to a relation in continuous variables.
• There are two types of linear regression:
• Simple Linear Regression
• It has only one dependent and independent variable.
• Equation:
• Y = mX + C
• Multiple Linear Regression
• It has only one dependent variable but more than one independent variable.
• Equation:
• Y = C0 + C1X1 + C2X2 + …….+ CnXn

In the linear regression algorithm, the goal is to find the formula (or equation) of a line (or a plane) to predict the value of the output (dependent/response/outcome) variable based on the input (independent/predictor/explanatory) variable with maximum accuracy or minimum error.

This article will discuss the linear regression formula for both cases, i.e., Simple Linear Regression and Multiple Linear Regression.

## Simple Linear Regression

Simple Linear Regression models the linear relationship between only one independent and one dependent variable.

Example: Relation between Fahrenheit and degree Celsius

F = (9/5)*C + 32,

where

F: dependent variable

C: Independent variable

### Simple Linear Regression Formula

The formula of simple linear regression is given by:

Y = mX + c,

Where

Y: dependent variable

m: slope or regression coefficient

c: y-intercept

Now, the question is: How to find the value of m and c in the above equation:

In linear regression, we use ordinary Least Square Method to find the value of m and c.

### Ordinary Least Square Method:

OLS method is used for estimating the value of unknown parameters by creating a model that will minimize the sum of squared error between the actual and predicted data.

In the OLS method, the value of m and c is given by:

Least Square Regression in Machine Learning
This article discusses the concept of linear regression. We have also covered least square regression in machine learning. Let’s begin! The article covers the concept of Least Square Regression...read more
R-Squared vs. Adjusted R-Squared
Adjusted r squared is similar to r-squared and measures the variation in the target variable. Still, unlike r-squared, it takes only those independent variables with some significance and penalizes you...read more
How to Calculate R squared in Linear Regression
In this article we focussed on R-squared in Linear Regression in which explain the procedure of calculating R squared value in step by step way and with example.

Example: Find the linear regression equation for the given set of data.

Now, firstly we will find the value of

Now, substituting the value of m in (ii), we get:

## Multiple Linear Regression

It is a statistical technique used to predict the value of one variable using one or more independent variables. In simple terms, MLR analyses how multiple independent variables are related to one dependent variable.
Let’s take an example to get a better understanding:

Here, if you look the above data closely, the price of the
House depends on the area of the house, the number of years it builds, and on which floor it is.

### Multiple Linear Regression Formula

Y = C0 + C1X1 + C2X2 + …….+ CnXn,

where

y: dependent variable

xi: independent variable/ explanatory variable

C0: y-intercept

Ci: slope coefficient/regression coefficient

## Conclusion

Linear regression is one of the most important algorithms that are used to predict the machine learning model. This article briefly discusses the linear regression formula for both the cases (simple and multiple linear regression) with the help of examples.

Hope this article will gives a clear understanding of Linear Regression Formula.

Top Trending Article

Interview Questions

About the Author
Vikram Singh
Assistant Manager - Content

Vikram has a Postgraduate degree in Applied Mathematics, with a keen interest in Data Science and Machine Learning. He has experience of 2+ years in content creation in Mathematics, Statistics, Data Science, and Mac... Read Full Bio