User:Expert345555

Simple Linear Regression The bets way to find out the relation between a single input variable and output variable, providing the continuous nature of both the variables. Where input being predictor, independent variable, input feature, input parameter and output variable being predicted, dependent variable, output feature, output parameter. To find out the correlation of how an input variable is related to the output variable and how it is shown with a single line.

Example of the concept let us have a look at scatter plots. This scatter illustration gives a graphic interpretation of the correlation of two continuous variables. Photo-1 This is what we see in the above picture. 1.	The direction 2.	The strength 3.	The linearity The above attributes are between factor Y and X. The dissipate plot gives us that Y and X have a solid positive linear relationship. Thus, we can extend a straight line which can define the data in the most accurate way possible. If the relationship between variable X and Y is strong and linear, then we conclude that independent variable X is the effective input variable to predict dependent variable Y. To check further collinearity between variable X and Y, we have correlation coefficient (r), With which we can find the numeric value of correlation between two variables. We can witness strong, moderate, or weak correlation between two. Higher the value of “r”, higher the preference given for particular input variable X for predicting output variable Y. Few properties of “r” are listed as follows: 1.	Range of r: -1 to +1 2.	Perfect positive relationship: +1 3.	Perfect negative relationship: -1 4.	No Linear relationship: 0 5.	Strong correlation: r > 0.85 (depends on business scenario) Command used for calculation “r” in RStudio is: > cor(X, Y) where, X: independent variable & Y: dependent variable Now, if the result of the above command is greater than 0.85 then choose simple linear regression. If r < 0.85 then use transformation of data to increase the value of “r” and then build a simple linear regression model on transformed data. How to Implement Simple Linear Regression: 1.	Analyze data. 2.	Get sample data for model building. 3.	Then design to explain information. 4.	And use the same developed model on the whole population to make predictions. The equation that represents how an independent variable X is related to a dependent variable Y. Photo-2&3 Example: Let see an example for a better understanding. Suppose we want to examine the weight gain based upon calorie intake only based upon given data. Photo-4 Presently, if we need to foresee weight gain when you devour 2500 calories. Right off the bat, we must envision information by drawing a scatter plot of the information. To conclude that calories intake is the best independent variable X to foresee dependent variable Y. We can also calculate “r” as follows:5 As, r = 0.9910422 which is greater than 0.85, we shall consider calories consumed as the best independent variable(X) and weight gain(Y) as the predict dependent variable. Now, try to envision a straight line draw a way that ought to be near each data point in the scatter outline.6 To predict the weight gain for consumption of 2500 calories, you can simply extend the straight line further to the y-axis at a value of 2,500 on x-axis. This projected value of y-axis gives you the rough weight gain. This straight line is a regression line. Similarly, if we substitute the x value in equation of regression model such as:7 y value will be predicted. Following is the command to build a linear regression model.8 We obtain the following values9 Substitute these values in the equation to get y as shown below.00 So, weight gain predicted by our simple linear regression model is 4.49Kgs after consumption of 2500 calories.