Understanding Simple Linear Regression Concepts

simple linear regression n.w
1 / 31
Embed
Share

Explore the fundamentals of simple linear regression, a statistical technique used to analyze relationships between variables and make forecasts. Learn about the model components, estimating coefficients, and the least squares regression line to achieve a good fit for your data.

  • Regression
  • Linear
  • Forecasting
  • Relationships
  • Variables

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Simple Linear Regression

  2. Introduction In Chapters 17 to 19, we examine the relationship between interval variables via a mathematical equation. The motivation for using the technique: Forecast the value of a dependent variable (Y) from the value of independent variables (X1, X2, Xk.). Analyze the specific relationships between the independent variables and the dependent variable.

  3. The Model The model has a deterministic and a probabilistic components House Cost Most lots sell for $25,000 House size

  4. However, house cost vary even among same size houses! Since cost behave unpredictably, we add a random component. House Cost Most lots sell for $25,000 House size

  5. The first order linear model Y = 0+ 1X + Y = dependent variable X = independent variable 0 = Y-intercept 1 = slope of the line = error variable 0 and 1 are unknown population parameters, therefore are estimated from the data. Y Rise = Rise/Run Run 0 X

  6. Estimating the Coefficients The estimates are determined by drawing a sample from the population of interest, calculating sample statistics. producing a straight line that cuts into the data. Y Question: What should be considered a good line? X

  7. The Least Squares (Regression) Line A good line is one that minimizes the sum of squared differences between the points and the line.

  8. Sum of squared differences = (2 - 1)2 +(4 - 2)2 +(1.5 - 3)2 + Sum of squared differences = (2 -2.5)2 + (4 - 2.5)2 +(1.5 - 2.5)2 + (3.2 - 2.5)2 = 3.99 (3.2 - 4)2 = 6.89 Let us compare two lines The second line is horizontal (2,4) 4 (4,3.2) 3 2.5 2 (1,2) (3,1.5) 1 The smaller the sum of squared differences the better the fit of the line to the data. 1 2 3 4

  9. The Estimated Coefficients The regression equation that estimates the equation of the first order linear model is: To calculate the estimates of the line coefficients, that minimize the differences between the data points and the line, use the formulas: b1=cov(X,Y) =sXY Y =b0+b1X 2 2 sX sX b0=Y b1X

  10. The Simple Linear Regression Line Example 17.2 (Xm17-02) A car dealer wants to find the relationship between the odometer reading and the selling price of used cars. A random sample of 100 cars is selected, and the data recorded. Find the regression line. Car Odometer 1 37388 2 44758 3 45833 4 30862 5 31705 6 34010 Independent variable X Price 14636 14122 14016 15590 15568 14718 . . . . . . . . . Dependent variable Y

  11. Solution Solving by hand: Calculate a number of statistics (Xi X )2 n 1 X = 36,009.45; 2= = 43,528,690 sX (Xi X )(Yi Y ) n 1 Y =14,822.823; cov(X,Y) = = 2,712,511 where n = 100. b1=cov(X,Y) = 1,712,511 43,528,690= .06232 2 sX b0=Y b1X =14,822.82 ( .06232)(36,009.45) =17,067 Y =b0+b1X =17,067 .0623X

  12. Solution continued Using the computer (Xm17-02) Tools > Data Analysis > Regression > [Shade the Y range and the X range] > OK

  13. Xm17-02 SUMMARY OUTPUT Regression Statistics Multiple R R Square Adjusted R Square Standard Error Observations 0.8063 0.6501 0.6466 303.1 100 Y =17,067 .0623X ANOVA df SS 16734111 9005450 25739561 MS F Significance F Regression Residual Total 1 16734111 91892 182.11 0.0000 98 99 Coefficients Standard Error t Stat 100.97 -13.49 P-value Intercept Odometer 17067 -0.0623 169 0.0000 0.0000 0.0046

  14. Interpreting the Linear Regression - Equation 17067 Odometer Line Fit Plot 16000 15000 Price 14000 No data 0 13000 Odometer Y =17,067 .0623X The intercept is b0 = $17067. This is the slope of the line. For each additional mile on the odometer, the price decreases by an average of $0.0623 Do not interpret the intercept as the Price of cars that have not been driven

  15. Error Variable: Required Conditions The error is a critical part of the regression model. Four requirements involving the distribution of must be satisfied. The probability distribution of is normal. The mean of is zero: E( ) = 0. The standard deviation of is for all values of X. The set of errors associated with different values of Y are all independent.

  16. The Normality of E(Y|X3) The standard deviation remains constant, 0 + 1 X3 E(Y|X2) 0 + 1 X2 E(Y|X1) but the mean value changes with X 0 + 1X1 X1 X2 X3 From the first three assumptions we have: Y is normally distributed with mean E(Y) = 0 + 1X, and a constant standard deviation

  17. Assessing the Model The least squares method will produces a regression line whether or not there are linear relationship between X and Y. Consequently, it is important to assess how well the linear model fits the data. Several methods are used to assess the model. All are based on the sum of squares for errors, SSE.

  18. Sum of Squares for Errors This is the sum of differences between the points and the regression line. It can serve as a measure of how well the line fits the data. SSE is defined by n (Yi Y i)2 SSE= . i=1 A shortcut formula 2 2 cov(X,Y) SSE= (n 1)sY 2 sX

  19. Standard Error of Estimate The mean error is equal to zero. If is small the errors tend to be close to zero (close to the mean error). Then, the model fits the data well. Therefore, we can, use as a measure of the suitability of using a linear model. An estimator of is given by s Standard Error of Estimate SSE n 2 s =

  20. Example 17.3 Calculate the standard error of estimate for Example 17.2, and describe what does it tell you about the model fit? Solution = ) Y i 2 ( Y Calculated before i = 2 Y 259 996 , s 1 n , 2 2 2 [cov( , )] ( 712 511 , ) X Y = ) 1 = = 2 Y SSE ( 99 ( 259 996 , ) , 9 005 , 450 n s 2 X 43 528 , 690 , s SSE n , 9 005 , 450 It is hard to assess the model based on s even when compared with the mean value of Y. y 1 . 303 s = = = = = 303 13 . s 2 98 14 823 ,

  21. Testing the Slope When no linear relationship exists between two variables, the regression line should be horizontal. Linear relationship. Linear relationship. Linear relationship. Linear relationship. No linear relationship. Different inputs (X) yield the same output (Y). The slope is equal to zero Different inputs (X) yield different outputs (Y). The slope is not equal to zero

  22. We can draw inference about 1 from b1 by testing H0: 1 = 0 H1: 1 0 (or < 0,or > 0) The test statistic is t =b1 1 s sb1= where sb1 (n 1)sX 2 If the error variable is normally distributed, the statistic has Student t distribution with d.f. = n-2. The standard error of b1.

  23. Example 17.4 Test to determine whether there is enough evidence to infer that there is a linear relationship between the car auction price and the odometer reading for all three-year-old Tauruses, in Example 17.2. Use = 5%.

  24. Solving by hand To compute t we need the values of b1 and sb1. b1= .0623 s (n 1)sX t =b1 1 sb1 303.1 sb1= 2= (99)(43,528,690)=.00462 = .0623 0 .00462 = 13.49 The rejection region is t > t.025 or t < -t.025 with = n-2 = 98. Approximately, t.025 = 1.984

  25. Xm17-02 Using the computer Price Odometer SUMMARY OUTPUT 37388 44758 Regression Statistics 45833 Multiple R 30862 R Square 31705 Adjusted R Square 34010 Standard Error 45854 Observations 19057 40149 ANOVA 40237 32359 Regression 43533 Residual 32744 Total 34470 37720 41350 Intercept 24469 Odometer 14636 14122 14016 15590 15568 14718 14470 15690 15072 14802 15190 14660 15612 15610 14634 14632 15740 0.8063 0.6501 0.6466 303.1 100 There is overwhelming evidence to infer that the odometer reading affects the auction selling price. df SS 16734111 9005450 25739561 MS F Significance F 1 16734111 91892 182.11 0.0000 98 99 Coefficients Standard Error 17067 -0.0623 t Stat 100.97 -13.49 P-value 169 0.0000 0.0000 0.0046

  26. Coefficient of Determination To measure the strength of the linear relationship we use the coefficient of determination: cov(X,Y) sX 2 or, = rXY ( ); R2= 2 2sY 2 SSE (Yi Y )2 or, R2=1 (see p. 18 above)

  27. To understand the significance of this coefficient note: The regression model Overall variability in Y The error

  28. y2 Two data points (X1,Y1) and (X2,Y2) of a certain sample are shown. y Variation in Y = SSR + SSE y1 x1 x2 Variation explained by the regression line Total variation in Y = + Unexplained variation (error) ( Y 1 Y )2+( Y 2 Y )2 +(Y1 Y 1)2+(Y2 Y 2)2 (Y1 Y )2+(Y2 Y )2=

  29. R2 measures the proportion of the variation in Y that is explained by the variation in X. (Yi Y )2 (Yi Y )2 SSE SSE (Yi Y )2 SSR (Yi Y )2 R2=1 = = R2 takes on any value between zero and one. R2 = 1: Perfect match between the line and the data points. R2 = 0: There are no linear relationship between X and Y.

  30. Example 17.5 Find the coefficient of determination for Example 17.2; what does this statistic tell you about the model? Solution Solving by hand; R2=[cov(X,Y)]2 [ 2,712,511]2 (43,528,688)(259,996)=.6501 = 2sY 2 sX

  31. Using the computer From the regression output we have SUMMARY OUTPUT 65% of the variation in the auction selling price is explained by the variation in odometer reading. The rest (35%) remains unexplained by this model. Regression Statistics Multiple R R Square Adjusted R Square Standard Error Observations 0.8063 0.6501 0.6466 303.1 100 ANOVA df SS MS 16734111 91892 F Significance F Regression Residual Total 1 16734111 9005450 25739561 182.11 0.0000 98 99 CoefficientsStandard Error 17067 -0.0623 t Stat 100.97 -13.49 P-value Intercept Odometer 169 0.0000 0.0000 0.0046

More Related Content