# Linear Regression

## Linear Regression :

Linear regression is a statistical method used to model the relationship between a dependent variable and one or more independent variables. In other words, it is used to predict the value of a dependent variable based on the values of one or more independent variables.
For example, let’s say we want to predict the price of a house based on its size. In this case, the dependent variable would be the price of the house and the independent variable would be the size of the house. We could use linear regression to model the relationship between these two variables and then use the model to predict the price of a house based on its size.
Another example of linear regression might be predicting the grade point average (GPA) of a student based on the number of hours they spend studying. In this case, the dependent variable would be the GPA and the independent variable would be the number of hours spent studying. We could use linear regression to model the relationship between these two variables and then use the model to predict a student’s GPA based on the number of hours they spend studying.
In both of these examples, the relationship between the dependent and independent variables is assumed to be linear, meaning that the change in the dependent variable is directly proportional to the change in the independent variable. This is why the method is called “linear” regression.
To create a linear regression model, we first need to collect data on the variables we are interested in. For example, in the case of predicting house prices, we would need data on the sizes and prices of a number of houses. Once we have this data, we can use it to fit a linear regression model. This involves finding the line that best describes the relationship between the dependent and independent variables in the data.
Once we have fitted the model, we can use it to make predictions. For example, if we want to predict the price of a house with a size of 2,000 square feet, we can plug this value into our linear regression model and it will output a predicted price.
Linear regression is a powerful tool for making predictions, but it has some limitations. One limitation is that it assumes that the relationship between the dependent and independent variables is linear. This may not always be the case, and in situations where the relationship is non-linear, other methods such as polynomial regression or non-parametric regression may be more appropriate.
Overall, linear regression is a widely used statistical method that can be used to model and predict the relationship between two or more variables. It is particularly useful when the relationship is assumed to be linear, but it can also be used in other situations with the appropriate modifications.