What Is Linear Regression
What Is Linear Regression
What Is Linear Regression
Therefore, minimizing the error between the model’s predictions and the
actual data means performing the following steps for each x value in your
data set:
Use the linear regression equation, with values for A and B, to calculate predictions for
each value of x.
Calculate the error for each value of x by subtracting the prediction for that x from the
actual, known data.
Sum the error of all of the points to identify the total error from a linear regression
equation using values for A and B.
Keep in mind some errors will be positive while others will be negative.
Nevertheless, these errors will cancel each other out and bring the resulting error
closer to 0, despite errors in both readings.
Take for instance two points, one with an error of five and the other with an error
of -10. While we all know both points should be considered as causing 15 total
points of error, the method described above treats them as negative five points of
error. To overcome this problem, algorithms developing linear regression models
use the squared error instead of simply the error. In other words, the formula for
calculating error takes the form: Error = (Actual — Prediction)²
Linear Regression Model Representation
Linear Regression representation consists of a linear equation that
combines a specific set of input values (x), the solution to which is
the predicted output (y) for that set of input values (y).
y = B0 + B1*x, where
Solution:
The simple linear regression equation to be fitted for the given data is
Here, the estimates of a and b can be calculated using their least squares estimates
From the given data, the following calculations are made with n=9
Substituting the column totals in the respective places in the of the
Type equation here .estimates aˆ and bˆ , their values can be calculated as
follows:
Thus, b = 1.5373.
a = y − b x
= 13.40 – 10.607
Hence, a =
Therefore, the required simple linear regression equation fitted to the given
data is
ŷ = 2.837 +1.537 x
It should be noted that the value of Y can be estimated using the above fitted
equation for the values of x in its range i.e., 3.6 to 10.7.
St = ∑ ( y i− y )2 = 153.42
i=1
Sr = ∑ ( y i− ŷ ) =57.756
2
i=1
S t−S r 153.422−57.75 6
R2= St
= 153.42 2
= 0.62354905