Linear regression is an approach in modeling that helps model the scalar linear relationship between a scalar dependent variable, Y, and an independent variable, X, which can be one or more in value:
Let's try to understand this using an example. The following table shows the list of height and weight of students in a class:
Height (inches) |
Weight (pounds) |
---|---|
50 |
125 |
58 |
135 |
63 |
145 |
68 |
144 |
70 |
170 |
79 |
165 |
84 |
171 |
75 |
166 |
65 |
160 |
If we run this through a simple linear regression function, which will be covered in a later chapter, with the weight as a dependent variable, y, and the independent variable, x, which is the height, we get the following equation:
y = 1.405405405 x + 57.87687688
If you plot the preceding equation as a line with 57.88
as the intercept and the slope of the line being 1.4
on top of a scatter plot with Weight
in the y axis and Height
in the x axis, then the following plot is obtained:
In this example, the regression algorithm tries to create the...