ECON3150/4150 Spring 2016

Similar documents
ECON3150/4150 Spring 2015

ECON3150/4150 Spring 2016

ECON2228 Notes 2. Christopher F Baum. Boston College Economics. cfb (BC Econ) ECON2228 Notes / 47

Essential of Simple regression

ECON Introductory Econometrics. Lecture 7: OLS with Multiple Regressors Hypotheses tests

Empirical Application of Simple Regression (Chapter 2)

Economics 113. Simple Regression Assumptions. Simple Regression Derivation. Changing Units of Measurement. Nonlinear effects

Econometrics I KS. Module 1: Bivariate Linear Regression. Alexander Ahammer. This version: March 12, 2018

THE MULTIVARIATE LINEAR REGRESSION MODEL

Lecture 4: Multivariate Regression, Part 2

The Simple Linear Regression Model

Applied Statistics and Econometrics

ECON Introductory Econometrics. Lecture 5: OLS with One Regressor: Hypothesis Tests

Lecture 5. In the last lecture, we covered. This lecture introduces you to

Statistical Inference with Regression Analysis

ECON Introductory Econometrics. Lecture 4: Linear Regression with One Regressor

Lab 6 - Simple Regression

Econometrics I KS. Module 2: Multivariate Linear Regression. Alexander Ahammer. This version: April 16, 2018

Wooldridge, Introductory Econometrics, 4th ed. Chapter 2: The simple regression model

Linear Regression with Multiple Regressors

ECO220Y Simple Regression: Testing the Slope

ECON The Simple Regression Model

5. Let W follow a normal distribution with mean of μ and the variance of 1. Then, the pdf of W is

Lecture 4: Multivariate Regression, Part 2

ECON Introductory Econometrics. Lecture 6: OLS with Multiple Regressors

1: a b c d e 2: a b c d e 3: a b c d e 4: a b c d e 5: a b c d e. 6: a b c d e 7: a b c d e 8: a b c d e 9: a b c d e 10: a b c d e

Problem Set #3-Key. wage Coef. Std. Err. t P> t [95% Conf. Interval]

The Simple Regression Model. Part II. The Simple Regression Model

1 Warm-Up: 2 Adjusted R 2. Introductory Applied Econometrics EEP/IAS 118 Spring Sylvan Herskowitz Section #

2. Linear regression with multiple regressors

Review of Econometrics

Section Least Squares Regression

Chapter 6: Linear Regression With Multiple Regressors

Econometrics I Lecture 3: The Simple Linear Regression Model

Econometrics Midterm Examination Answers

Applied Statistics and Econometrics

Economics 326 Methods of Empirical Research in Economics. Lecture 14: Hypothesis testing in the multiple regression model, Part 2

Homoskedasticity. Var (u X) = σ 2. (23)

Simple Linear Regression: The Model

Multiple Regression Analysis: Estimation. Simple linear regression model: an intercept and one explanatory variable (regressor)

ECON Introductory Econometrics. Lecture 17: Experiments

ECON Introductory Econometrics. Lecture 13: Internal and external validity

Week 3: Simple Linear Regression

General Linear Model (Chapter 4)

Econometrics Homework 1

The Classical Linear Regression Model

Chapter 2: simple regression model

Basic econometrics. Tutorial 3. Dipl.Kfm. Johannes Metzler

Linear Regression with 1 Regressor. Introduction to Econometrics Spring 2012 Ken Simons

Question 1a 1b 1c 1d 1e 2a 2b 2c 2d 2e 2f 3a 3b 3c 3d 3e 3f M ult: choice Points

Section I. Define or explain the following terms (3 points each) 1. centered vs. uncentered 2 R - 2. Frisch theorem -

Intermediate Econometrics

Applied Statistics and Econometrics

LECTURE 6. Introduction to Econometrics. Hypothesis testing & Goodness of fit

1. The shoe size of five randomly selected men in the class is 7, 7.5, 6, 6.5 the shoe size of 4 randomly selected women is 6, 5.

Multiple Linear Regression CIVL 7012/8012

ECON Introductory Econometrics. Lecture 16: Instrumental variables

Lab 07 Introduction to Econometrics

MAT2377. Rafa l Kulik. Version 2015/November/26. Rafa l Kulik

Answer all questions from part I. Answer two question from part II.a, and one question from part II.b.

2. (3.5) (iii) Simply drop one of the independent variables, say leisure: GP A = β 0 + β 1 study + β 2 sleep + β 3 work + u.

sociology sociology Scatterplots Quantitative Research Methods: Introduction to correlation and regression Age vs Income

Final Exam. Question 1 (20 points) 2 (25 points) 3 (30 points) 4 (25 points) 5 (10 points) 6 (40 points) Total (150 points) Bonus question (10)

Measurement Error. Often a data set will contain imperfect measures of the data we would ideally like.

ECON Introductory Econometrics. Lecture 2: Review of Statistics

4 Instrumental Variables Single endogenous variable One continuous instrument. 2

Warwick Economics Summer School Topics in Microeconometrics Instrumental Variables Estimation

Nonlinear Regression Functions

Inference. ME104: Linear Regression Analysis Kenneth Benoit. August 15, August 15, 2012 Lecture 3 Multiple linear regression 1 1 / 58

Lab 10 - Binary Variables

4 Instrumental Variables Single endogenous variable One continuous instrument. 2

Linear Regression with Multiple Regressors

STATISTICS 110/201 PRACTICE FINAL EXAM

Motivation for multiple regression

Handout 11: Measurement Error

1 Linear Regression Analysis The Mincer Wage Equation Data Econometric Model Estimation... 11

Problem Set 10: Panel Data

Ch 2: Simple Linear Regression

Ordinary Least Squares Regression Explained: Vartanian

Regression Analysis with Cross-Sectional Data

The Simple Regression Model. Simple Regression Model 1

University of California at Berkeley Fall Introductory Applied Econometrics Final examination. Scores add up to 125 points

2.1. Consider the following production function, known in the literature as the transcendental production function (TPF).

Multiple Linear Regression

Multiple Regression Analysis: Heteroskedasticity

Can you tell the relationship between students SAT scores and their college grades?

Practical Econometrics. for. Finance and Economics. (Econometrics 2)

Handout 12. Endogeneity & Simultaneous Equation Models

sociology 362 regression

Multiple Linear Regression

Problem Set 1 ANSWERS

Quantitative Methods Final Exam (2017/1)

WISE MA/PhD Programs Econometrics Instructor: Brett Graham Spring Semester, Academic Year Exam Version: A

Lecture 3: Multivariate Regression

Statistical Modelling in Stata 5: Linear Models

Problem Set #5-Key Sonoma State University Dr. Cuellar Economics 317- Introduction to Econometrics

Econometrics. 9) Heteroscedasticity and autocorrelation

Specification Error: Omitted and Extraneous Variables

sociology 362 regression

1: a b c d e 2: a b c d e 3: a b c d e 4: a b c d e 5: a b c d e. 6: a b c d e 7: a b c d e 8: a b c d e 9: a b c d e 10: a b c d e

Transcription:

ECON3150/4150 Spring 2016 Lecture 4 - The linear regression model Siv-Elisabeth Skjelbred University of Oslo Last updated: January 26, 2016 1 / 49

Overview These lecture slides covers: The linear regression model with one regressor Deriving the OLS 2 / 49

Linear regression You may have different goals with the regression. The goal can be: To describe the data in a scatterplot and no substantive meaning is attached to the regression line. To make forecasts, or predictions, of the value of Y for an entity not in the data set, for which we know the value of X. To estimate the causal effect on Y of a change in X. 3 / 49

Deriving the Ordinary Least Squares Let ˆβ 0 and ˆβ 1 be some estimators of β 0 and β 1. These estimators predict Y i and gives the prediction mistake (û i ). Predicted value: Ŷ = ˆβ 0 + ˆβ 1 x i Residual: û = y i ŷ i 4 / 49

Deriving the Ordinary Least Squares The sum of squared prediction mistakes over all n observations is: n = û 2 = (Y i ˆβ 0 ˆβ 1 X i ) 2 i=1 And OLS finds the values of ˆβ 0 and ˆβ 1 that minimize this expression. 5 / 49

Deriving the Ordinary Least Squares OLS finds the values of that minimize the sum of the squared prediction mistakes (the OLS estimator). 1 Use calculus to obtain the following first order conditions for this minimization problem. 2 2 n (Y i ˆβ 0 + ˆβ 1 X i ) = 0 (1) i=1 n X i (Y i ˆβ 0 + ˆβ 1 X i ) = 0 (2) i=1 6 / 49

2 Solve the first order conditions for the unknown ˆβ 0 and ˆβ 1 The resulting OLS estimates of β 0 and β 1 are ˆβ 0 = Ȳ ˆβ 1 X = ˆµ y ˆβ 1ˆµ x (3) and ˆβ 1 = n (X i X )(Y i Ȳ ) i=1 = n (X i X ) 2 i=1 ˆσ xy ˆσ 2 x (4) 7 / 49

Properties of OLS n û i = 0 i=1 n û i X i = 0 i=1 The point ( X, Ȳ ) is always on the regression line 8 / 49

Estimating OLS - example A sample of ACT scores (American College testing) and GPA (Grade point average) for eight college students Student GPA ACT 1 2.8 21 2 3.4 24 3 3.0 26 4 3.5 27 5 3.6 29 6 3.0 25 7 2.7 25 8 3.7 30 Calculate: ˆ GPA = ˆβ 0 + ˆβ 1 ACT 9 / 49

Estimating OLS - example Remember that: ˆβ 0 = Ȳ + ˆβ 1 X ACT = x = 1 n x i = 25.875 n GPA = ȳ = 1 n i n u i = 3.2125 ˆβ 0 3.2125 + ˆβ 1 25.875 i 10 / 49

Estimating OLS - example ˆβ 1 = n i=1 (X i X )(Y i Ȳ ) n i=1 (X i X ) 2 1) 2) Obs GPA ACT (x i x) (y i ȳ) 1*2 (x i x) 2 1 2.8 21-4.875-0.4125 2.01 23.77 2 3.4 24-1.875 0.1875-0.35 3.52 3 3.0 26 0.125-0.2125-0.03 0.02 4 3.5 27 1.125 0.2875 0.32 1.27 5 3.6 29 3.125 0.3875 1.21 9.77 6 3.0 25-0.875-0.2125 0.19 0.77 7 2.7 25-0.875-0.5125 0.45 0.77 8 3.7 30 4.125 0.4875 2.01 17.02 Av. 3.2125 25.875 Sum: 5.8125 56.875 11 / 49

Estimating OLS - example ACT = x = 1 n GPA = ȳ = 1 n n x i = 25.875 i n u i = 3.2125 ˆβ 1 = 5.8125/56.875 0.1022 ˆβ 0 3.2125 (0.1022) 25.875 0.5681 GPA ˆ = 0.5681 + 0.1022ACT ˆ i 12 / 49

Output from Stata. reg gpa act Source SS df MS Number of obs = 8 F( 1, 6) = 8.20 Model.594024707 1.594024707 Prob > F = 0.0287 Residual.434725292 6.072454215 R-squared = 0.5774 Adj R-squared = 0.5070 Total 1.02875 7.146964286 Root MSE =.26917 gpa Coef. Std. Err. t P> t [95% Conf. Interval] act.1021978.035692 2.86 0.029.0148626.189533 _cons.5681319.9284214 0.61 0.563-1.703633 2.839897 13 / 49

Properties of OLS Given ˆβ 0 and ˆβ 1 we can obtain the predicted value Ŷ i for each observation. By definition each predicted value is on the OLS regression line. The OLS residuals (û i ) is the difference between Y i and its predicted value. If û i is positive(negative) the line underpredicts (overpredicts) Y i. The ideal case is û i = 0, but in most cases this is not true. 14 / 49

OLS Different samples from the population may give different OLS lines: 15 / 49

Sampling distributions of the OLS estimators The OLS estimators are random variables with a probability distribution because they are computed from a randomly drawn sample. We assume that the unobserved error is normally distributed in the population. 16 / 49

Choosing estimator We learned that the best linear estimator is: Unbiased Consistent Efficient 17 / 49

Unbiased Unbiased means that the expected value of the estimator is equal to the population parameter. Which means that the estimated coefficients on repeated samples are centered around the true parameter. The mean of its frequency distribution is the true value 18 / 49

Illustration bias The OLS estimator thus has a distribution with a mean, variance and a shape. 19 / 49

Unbiasedness of OLS It can be shown that E( ˆβ 1 ) = β 1 (appendix 4.3) thus β 1 is unbiased. Note: this is a property of the estimator and says nothing about whether an estimate for a given sample is equal to the population parameter. ˆβ 1 is unbiased if the following assumptions hold: Zero conditional mean E(u i X i )) = 0. Linear in parameters Random sample of size n σ 2 x > 0 20 / 49

Consistency of ˆβ 1 Consistency A variable is consistent if the spread around the true parameter approaches zero as n increases. The spread is measured by the variance: ( 1 n n i=1 var( ˆβ 1 ) = var (X i X )(Y i Ȳ ) ) 1 n n i=1 (X i X ) 2 = Var(Y i) nsx 2 21 / 49

Consistency Biased, but consistent estimator. 22 / 49

Consistency of ˆβ 1 var( ˆβ 1 ) = Var(Y i) ns 2 x Consistent as the larger n the smaller the variance The larger the sample variance of X the lower the variance of ˆβ 1 Lower variance of Y lower variance of ˆβ 1 23 / 49

Spread in X 24 / 49

Spread in X 25 / 49

Spread in X 26 / 49

Efficient For the OLS estimator to be best (most efficient) it needs to have a lower variance than all the other estimators within the class. OLS is efficient in the class of unbiased, linear estimators. There might be unbiased nonlinear estimators that have smaller variance. There might be biased estimators that are better. 27 / 49

BLUE BLUE The OLS estimator is the best linear unbiased estimator (BLUE) if The population model is linear in parameters. The zero conditional mean assumption holds. Homoskedasticity: The conditional variance of the error term is constant in all x and over time. The error term is independently distributed and not correlated. 28 / 49

Interpretation The size of β 1 gives you the size of the effect that variable is having on your dependent variable. The sign of the coefficient gives you the direction of the effect. In SLRM the coefficient tells you how much the dependent variable will increase/decrease when the independent variable increases by one unit. 29 / 49

Example If we are interested in the effect of education on wages the model is: wages = β 0 + β 1 years of education + other factors It measures the increase in wage per unit increase in education: β 1 = change in wages change in education = wages education 30 / 49

Interpretation of previous example ˆ GPA = 0.5681 + 0.1022ACT A one unit higher ACT score is predicted to increase GPA by approximately 0.1 points. 31 / 49

Another interpretation example Given a sample of 526 individuals the following OLS regression line can be estimated: wage ˆ = 0.90 + 0.54educ β 1 indicates that one more year of education increase hourly wage by 54 cent. Intercept indicates that a person with zero education pay 90 cents per hour to work. The regression line does poor at low levels of education because only 18 people have less than 8 years of education. use wage1.dta 32 / 49

Unit of measurement The interpretation of the coefficients depend on the unit of measurement. Example: wage = β 0 + β 1 education + u Wage can be measured in dollars or cents. It can be hourly, monthly and yearly. Education can be measured in degree, years or months. With dollars and years then if β 1 = 0.54: one more year of education is predicted to give $0.54 higher wages. With monthly wage measured in thousands of dollars and education years then one more year of education is predicted to give 540 dollars more in monthly wage. 33 / 49

Change the unit of measurement If the dependent variable is multiplied by the constant c, the OLS intercept and slope estimates are also multiplied by c. If the independent variable is multiplied by som nonzero constant c, then the OLS slope coefficient is divided by c. 34 / 49

Multiply dependent variable with a constant. gen wage_cents=wage*100. reg wage_cents educ Source SS df MS Number of obs = 526 F( 1, 524) = 103.36 Model 11797320.4 1 11797320.4 Prob > F = 0.0000 Residual 59806822.5 524 114135.158 R-squared = 0.1648 Adj R-squared = 0.1632 Total 71604143 525 136388.844 Root MSE = 337.84 wage_cents Coef. Std. Err. t P> t [95% Conf. Interval] educ 54.13593 5.324804 10.17 0.000 43.67534 64.59651 _cons -90.48516 68.49678-1.32 0.187-225.0472 44.07687 β N 0 = c βo 0, βn 1 = c βo 1 thus: 54.135=100*0.54135 35 / 49

Multiply independent variable with a constant. gen educmonth=educ/12. reg wage educmonth Source SS df MS Number of obs = 526 F( 1, 524) = 103.36 Model 1179.73204 1 1179.73204 Prob > F = 0.0000 Residual 5980.68226 524 11.4135158 R-squared = 0.1648 Adj R-squared = 0.1632 Total 7160.41429 525 13.6388844 Root MSE = 3.3784 wage Coef. Std. Err. t P> t [95% Conf. Interval] educmonth 6.496311.6389764 10.17 0.000 5.241041 7.751581 _cons -.9048516.6849678-1.32 0.187-2.250472.4407688. display 0.54135*12 6.4962 36 / 49

Causality Causality A causal effect is defined to be the effect measured in an ideal randomized controlled experiment. Very hard to determine in a non-experimental setting. Will the zero conditional mean assumption hold for. Maternal smoking and infant birth weight Wages and labor supply Temperature and CO2 37 / 49

Regression and causality I Regression and causality Three possible theoretical causal relationships between X and Y. Our regression is cau I is true, and II (join causality) and III are true r XY = 0 in all three Can also be that a t variable (Z) causes b Y and X (spurious correlation) The regression is causal if I is true and II and III are not true. II is joint causality. III is reversed causality. Spurious correlation occurs if a third variable causes both Y and X. 38 / 49

Measures of fit How well does the OLS regression line fit the data? The equation for prediction error can be rewritten into: Y i = Ŷ i + û i Ŷ i = ˆβ 0 + ˆβ 1 x is the systematic part - the part of Y explained by X. û i is the unsystematic part, the part of Y not explained by X. 39 / 49

Total sum of squares Total sum of squares TSS = SST n (y i ȳ) 2 i=0 Total sum of squares, the sum of squared deviations of Y i from its average SST is a measure of the total sample variation in the Y i, that is it measures how spread out the Y i are in the sample. 40 / 49

Explained sum of squares Explained sum of squares ESS n (Ŷ i Ȳ ) 2 i=0 Explained sum of squares is the sum of squared deviations of the predicted value from its average. It measures the sample variation in Ŷ i 41 / 49

Sum of squared residuals Sum of squared residuals SSR n i=0 û 2 i Sum of squared residuals measures the sample variation in û 42 / 49

Terminology There is no uniform agreement about the abbreviations or the names of the measures of fit: Some textbooks denote total sum of squares SST and not TSS Some textbooks use SSE instead of ESS Stata used model sum of squares to denote ESS. Some say regression sum of squares for explained sum of squares. Some say error sum of squares instead of sum of squared residuals. 43 / 49

Decomposition of TSS TSS TSS = ESS + SSR 44 / 49

R-squared The regression R 2 is the fraction of the sample variance of Y i explained by X i. R 2 = ESS TSS = 1 SSR TSS The R 2 ranges between 0 and 1 R 2 = 0 - none of the variation in Y i is explained by X i R 2 = 1 - all the variation is explained by X i, all the data points lie on the OLS line. A high R 2 means that the regressor is good at predicting Y i (not necessarily the same as a good regression) 45 / 49

Standard error of the regression The standard error of the regression (SER) is an estimator of the standard deviation of the regression error u i. It measures the spread of the observation around the regression line. SER = sû where s 2 û = 1 n 2 n i=1 û 2 i = SSR n 2 46 / 49

Example Thursday January 22 15:16:17 2015 Page 1 (R) / / / / / / / / / / / / Statistics/Data Analysis 1. reg wage educ Source SS df MS Number of obs = 526 F( 1, 524) = 103.36 Model 1179.73204 1 1179.73204 Prob > F = 0.0000 Residual 5980.68225 524 11.4135158 R-squared = 0.1648 Adj R-squared = 0.1632 Total 7160.41429 525 13.6388844 Root MSE = 3.3784 wage Coef. Std. Err. t P> t [95% Conf. Interval] educ.5413593.053248 10.17 0.000.4367534.6459651 _cons -.9048516.6849678-1.32 0.187-2.250472.4407687 47 / 49

Next week: Multiple regressions model More on properties of OLS 48 / 49

Still left to learn: Is it possible to generalize the regression results for the sample under observation to the population? Can you draw conclusions for individuals, countries beyond those in your data set? The sample must match the characteristics of the population. 49 / 49