Econ 140 Lecture 81 Classical Regression II Lecture 8.

Presentation on theme: "Econ 140 Lecture 81 Classical Regression II Lecture 8."— Presentation transcript:

Econ 140 Lecture 81 Classical Regression II Lecture 8

Econ 140 Lecture 82 The story so far... We learned how to compute least squares estimates We talked about the assumptions underlying the CLRM: 1) Y and e are random variables 2) X i is nonrandom (it’s given) 3)E(e i ) = E(e i |X i ) = 0 4)V(e i )= V(e i |X i ) =  2 5)Covariance (e i e j ) = 0 Clear about difference of e i and  i. Note that  and  (also denoted a^ and b^) are estimates of a and b; they are also random variables and have sampling distributions.

Econ 140 Lecture 83 Today’s Plan Inference with the classical linear regression model –Calculating the standard error –Calculating the t-ratio –Root-mean square error –95% confidence intervals –ANOVA tables –ANOVA table: ANOVA stands for analysis of variance

Econ 140 Lecture 84 Variation around the regression line iid, and assumed normal: X X1X1 X2X2 X3X3 Y1Y1 Y2Y2 Y3Y3

Econ 140 Lecture 85 Sum of Squares Identity Let’s take one point, X 1 and look at it graphically: Y X1X1

Econ 140 Lecture 86 Sum of Squares Identity (2) The Sum of Squares Identity is Total = Explained + Unexplained or

Econ 140 Lecture 87 Sum of Squares Identity (3) reveals how much of the variation is explained by the regression line reveals how much of the variation is not explained by the regression line, or is left over –Notice that this is also equal to   2 reveals how much total variation there is –remember in a previous lecture we said that

Econ 140 Lecture 88 How to calculate sum of squares We can write the total sum of squares as –We’re given the Y values so we can compute We can write the explained sum of squares as –Calculating the ESS:   xy

Econ 140 Lecture 89 How to calculate sum of squares (4) We can calculate the unexplained variation (the unexplained sum of squares) as the difference between the total and the explained sum of squares: Because we have to consider degrees of freedom when calculating each variance term, we divide the SSI by the corresponding degrees of freedom:

Econ 140 Lecture 810 How to calculate sum of squares (5) The residual variance of the regression line is If we take the square root we get the root mean square error (root MSE):

Econ 140 Lecture 811 Calculating test statistics We can calculate test statistics from the sum of squares statistics The variance of , the slope coefficient is –Where

Econ 140 Lecture 812 Calculating test statistics (2) The standard error of  is The variance of the intercept  is The standard error of  is

Econ 140 Lecture 813 Confidence intervals Once we have the standard errors, we can do two things: –form a confidence interval –perform a hypothesis test A confidence interval for b: –Where df in a bi-variate model is 2 As with univariate cases, we can calculate a confidence interval for b in a bi-variate case

Econ 140 Lecture 814 Hypothesis testing Set up your null hypothesis and alternative Determine the critical region - choose a significance level (  ) Using the relevant distribution, determine your critical (tabled) value (Z  /2, or t  /2 for the moment; F df1,df2 and  n soon). For a given sample, compute the numeric value of the test statistic: Z*, t*, F* or  *. Given the decision rule, determine whether to reject or not the null hypothesis.

Econ 140 Lecture 815 Hypothesis testing (2) For standard statistical packages, the null hypothesis is that the population parameter is zero, or H o : b = 0 Most of the time we only have a sample and an estimate , –we don’t know the actual population value Sometimes the value of b is dictated by economic theory –in that case, a value will be imposed on b, such as b=1: H o : b = 1

Econ 140 Lecture 816 Hypothesis testing (3) The standard t-ratio or t statistic is So if the null hypothesis dictates b= 0, the t-ratio becomes

Econ 140 Lecture 817 Example Data on female earnings in Illinois {spreadsheet L8.xls} The variables include earnings, earnings weights, and years of education In this example, the first three columns represent the ‘population’. Select two samples of 30 at random from that population. First sample, create log earnings (ln Y). Note you can create means of X and Y. Multiply (ln Y) by years of education (XY). Square years of education (X 2 ). Sum (XY) and Sum (X 2 ). Provides all the statistics you need to calculate the least squares line

Econ 140 Lecture 818 Example (2) I have also included an example of how to use Excel’s LINEST to calculate the regression line On the web you’ll find some output from Stata using the population and sample regressions from the Illinois data. Try the LINEST function and check that your output agrees with the output from Stata Let’s look at a graph of the sample and popluation regression lines

Econ 140 Lecture 819 Example (3) From the spreadsheet we calculated the following: Sample size : n=30 We use these numbers to calculate 

Econ 140 Lecture 820 Example (4) And to calculate  Compare our estimates with the Stata output Now let’s use the numbers from the spreadsheet to calculate the regression line variance

Econ 140 Lecture 821 Example (5) The variance of  is Thus the standard error of  is

Econ 140 Lecture 822 Example (6) We can calculate a confidence interval for b: For a 95% confidence interval, b is bounded between 0.120 < b < 0.350

Econ 140 Lecture 823 Example (7) Now the hypothesis test: The Stata output gives a t-ratio of 4.06. Our null and alternative hypotheses are H o : b = 0H o : b  0 Our t statistic: Since |t| > t  /2df,, we reject the null hypothesis. Thus, at a 95% confidence interval, the estimate does not equal zero

Econ 140 Lecture 824 A word on modeling The model we’ve been using is Y = a+bX In our spreadsheet example, our model is lnY = a + bX This suggests an underlying model of Y = e a+bX Sometimes it is better to take logs of variables to make the relationship between Y and X linear Because of outliers, the underlying relationship will sometimes look more like an upward sloping curve Logging the earnings and then comparing it it years of education gives you a far more linear relationship - it does not change your conclusions

Econ 140 Lecture 825 A word on modeling (2) We are asking the question: What is the increase in earnings for an additional year of education? It is the differential More simply we can write

Econ 140 Lecture 826 A word on modeling (3) The difference between X 1 and X 2 is a discreet change in years of education, so the difference will be one So we can write: On the spreadsheet, calculate an additional year of school: % of Y = e 0.235 - 1 = approximately 26% Enter into Excel: =exp(0.235)-1 So  in a semi-log equation is lnY =  +  X  % of Y