For the given data, x and y x: 1 2 4 3 5 y :1 3 3 2 5 Draw a Scatter plot of x versus y. Model the data using simple linear regression. Find the best estimates for the coefficients and also calculate an error score for the predictions.
Answers
Answer:
A line of best fit is a straight line that is the best approximation of the given set of data.
It is used to study the nature of the relation between two variables. (We're only considering the two-dimensional case, here.)
A line of best fit can be roughly determined using an eyeball method by drawing a straight line on a scatter plot so that the number of points above the line and below the line is about equal (and the line passes through as many points as possible).
A more accurate way of finding the line of best fit is the least square method .
Use the following steps to find the equation of line of best fit for a set of ordered pairs (x1,y1),(x2,y2),...(xn,yn) .
Step 1: Calculate the mean of the x -values and the mean of the y -values.
X¯¯¯=∑i=1nxinY¯¯¯=∑i=1nyin
Step 2: The following formula gives the slope of the line of best fit:
m=∑i=1n(xi−X¯¯¯)(yi−Y¯¯¯)∑i=1n(xi−X¯¯¯)2
Step 3: Compute the y -intercept of the line by using the formula:
b=Y¯¯¯−mX¯¯¯
Step 4: Use the slope m and the y -intercept b to form the equation of the line.
Example:
Use the least square method to determine the equation of line of best fit for the data. Then plot the line.
x 8 2 11 6 5 4 12 9 6 1
y 3 10 3 6 8 12 1 4 9 14
Solution:
Plot the points on a coordinate plane .
Calculate the means of the x -values and the y -values.
X¯¯¯=8 + 2 + 11 + 6 + 5 + 4 + 12 + 9 + 6 + 110=6.4Y¯¯¯=3 + 10 + 3 + 6 + 8 + 12 + 1 + 4 + 9 + 1410=7
Now calculate xi−X¯¯¯ , yi−Y¯¯¯ , (xi−X¯¯¯)(yi−Y¯¯¯) , and (xi−X¯¯¯)2 for each i .