Question

In: Statistics and Probability

Find the 'least square linear regression line' for the following cases: (x,y)coordinates (-1,0), (0,2), (1,4), (2,5)...

Find the 'least square linear regression line' for the following cases:

(x,y)coordinates (-1,0), (0,2), (1,4), (2,5)

(However, use the gradient descent method and use cost function to get it)

(Explain the changing process of cost functuon, gradient, and intercept together)

Solutions

Expert Solution

In statistics, linear regression is a linear approach to modelling the relationship between a dependent(or regressand) variable and one or more independent (predictor)variables. Let X be the independent variable and Y be the dependent variable. We will define a linear relationship between these two variables as follows:

y = mx +c

This is the equation for a line that you studied already in school life . m is the slope of the line and c is the y intercept. We will use this equation to train our model with a given dataset and predict the value of Y for any given value of X. Our challenge is to determine the value of m and c, such that the line corresponding to those values is the best fitting line or gives the minimum error.

First of all calculate the difference between the actual y and predicted y value(y = mx + c), for a given x and square this difference and then calculate the mean of the squares for every value in X.

error = (1/n) { y -(mx+c)}^2

So we square the error and find the mean which is called  Mean Squared Error. Now that we have defined the loss function, lets get into the interesting part — minimizing it and finding m and c.

The Gradient Descent Algorithm

Gradient descent is an iterative optimization algorithm to find the minimum of a function. Here that function is our loss function.

.D is equivalent to the steepness of the slope and L can be the speed with which he moves. Now the new value of m that we calculate using the above equation will be his next position, and L×D will be the size of the steps he will take. When the slope is more steep (D is more) he takes longer steps and when it is less steep (D is less), he takes smaller steps. Finally he arrives at the bottom of the valley which corresponds to our loss = 0.


Related Solutions

Data were collected on two variable x, and y and a least-square regression line were fitted...
Data were collected on two variable x, and y and a least-square regression line were fitted to the data. The resulting regression equation is ^y= 2.29-1.70x. a. interpretation for the slope b. calculate the residual for the point (5,6) c. if the correlation between x and y is r= -0.32, what percentage of the variation in y is explained by the least-squares regression line based on x?
Linear Regression When we use a least-squares line to predict y values for x values beyond...
Linear Regression When we use a least-squares line to predict y values for x values beyond the range of x values found in the data, are we extrapolating or interpolating? Are there any concerns about such predictions?
Find the linear regression line for the following table of values, where x represents the number...
Find the linear regression line for the following table of values, where x represents the number of employees a manager supervises and y represents average percentage of incomplete tasks. You will need to use a calculator, spreadsheet, or statistical software. Round your final answers to two decimal places.
Find the equation of the least-squares regression line ŷ and the linear correlation coefficient r for...
Find the equation of the least-squares regression line ŷ and the linear correlation coefficient r for the given data. Round the constants, a, b, and r, to the nearest hundredth. {(0, 10.8), (3, 11.3), (5, 11.2), (−4, 10.7), (1, 9.3)}
1. The coefficients of the least squares regression line, Y = M*X + B, are determined...
1. The coefficients of the least squares regression line, Y = M*X + B, are determined by minimizing the sum of the squares of the a) x‐coordinates. b) y‐coordinates. c) residuals ----------------------- 2 . Which of the following statements are true about overfitting and underfitting? a) Models that do not do well on training or test data are said to underfit the data. b) They lack enough independent variables to predict the response variable. c) A model’s generalization ability refers...
Find the equation of the line goes through (1,0,-1) that is perpendicular to the lines x...
Find the equation of the line goes through (1,0,-1) that is perpendicular to the lines x = 3+2t,y = 3t,z = −4t and x = t,y = t,z = −t. Write it in parametric and the vector equation form.
D. Find a linear (regression) equation with following data. x     y 70   25 65   20 60  ...
D. Find a linear (regression) equation with following data. x     y 70   25 65   20 60   30 50   35 45   40 Ans.: y = ( ) + ( ) * x.   Show your work.
In simple linear regression analysis, the least squares regression line minimizes the sum of the squared...
In simple linear regression analysis, the least squares regression line minimizes the sum of the squared differences between actual and predicted y values. True False
Find the linear regression line for the following table of values. You will need to use...
Find the linear regression line for the following table of values. You will need to use a calculator, spreadsheet, or statistical software. Enter your answer in the form y=mx+b, with m and b both rounded to two decimal places. x y 3 6.03 4 9.65 5 11.49 6 11.57 7 12.96 8 14.97 9 16.31 10 17.43 11 18.55
For the following data, find the regression equation for predicting Y from X X Y 1...
For the following data, find the regression equation for predicting Y from X X Y 1 2 4 7 3 5 2 1 5 8 3 7 1a. Group of answer choices a. Ŷ = -2X + 8 b. Ŷ =2X + 8 c. Ŷ =1.8X - 0.4 d. Ŷ =1.8X + 0.4 1b. For the following scores, find the regression equation for predicting Y from X X Y 3 8 6 4 3 5 3 5 5 3
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT