Chapter2 Econometrics Old

37
The Simple Regression Model Võ Đøc Hoàng Vũ University of Economics HCMC June 2015 Võ Đøc Hoàng Vũ (UEH) Applied Econometrics June 2015 1/1

description

Simple Regression

Transcript of Chapter2 Econometrics Old

Page 1: Chapter2 Econometrics Old

The Simple Regression Model

Võ Đức Hoàng Vũ

University of Economics HCMC

June 2015

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 1 / 1

Page 2: Chapter2 Econometrics Old

Some Terminology

In the simple linear regression model, where y = β0 + β1x + u,we typically refer to y as the

depedent variable, or

left-hand side variable, or

explained variable, or

regressand

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 2 / 1

Page 3: Chapter2 Econometrics Old

Some Terminology (cont)

In the simple linear regression of y on x , we typically refer x asthe

independent varialbe, or

right-hand side variable, or

explanatory variable, or

regressor, or

covariate, or

control variable.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 3 / 1

Page 4: Chapter2 Econometrics Old

A Simple Assumption

The average value of u, the error term, in the population is 0.That is,

E (u) = 0

This is not a restrictive assumption, since wa can always use β0

to normalize E (u) to 0.

We need to make a crucial assumption about how u and x arerelated.

We want it to be the case that knowing something about x doesnot give us any information about u, so that they are completelyunrelated. That is, that

E (u|x) = E (u) = 0, which implies

E (y |x) = β0 + β1x .

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 4 / 1

Page 5: Chapter2 Econometrics Old

E (y |x) as a linear function of x , where for any x the distribution of yis centered about E (y |x).

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 5 / 1

Page 6: Chapter2 Econometrics Old

Ordinary Least Squares

Basic idea of regression is to estimate the population parametersfrom a sample.

Let {xi , yi)”i = 1, . . . , n} denote a random sample of size n fromthe population.

For each observation in this sample, it will be the case thatyi = β0 + β1xi + uu

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 6 / 1

Page 7: Chapter2 Econometrics Old

Population regression line, sample data points and the associatederror terms.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 7 / 1

Page 8: Chapter2 Econometrics Old

Deriving OLS Estimates

to derive the OLS estimates we need to realize that our mainassumption of E (u|x) = E (u) = 0 also implies that

Cov(x , u) = E (xu) = 0

Why? Remenber from basic probability thatCov(X ,Y ) = E (XY )− E (X )E (Y )

We can write our 2 restrictions just in terms ofx , y , β0, andβ1, since u = y − β0 + β1x

E (y − β0 − β1x) = 0, and

E [x(y − β0 − β1x)] = 0

These are called moment restrictions.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 8 / 1

Page 9: Chapter2 Econometrics Old

Deriving OLS using M.O.M

The method of moments approach to estimation impliesimposing the population moment restrictions on the samplemoments.

What does this mean? Recall that for E (X ), the mean of apopulation distribution, a sample estimator of E (X ) is simplythe arithmetic mean of the sample.

We want to choose values of the parameters that will ensurethat the sample versions of our moment restrictions are true1

n

∑ni=1(yi − β0 − β1xi) = 0

1

n

∑ni=n xi(yi − β0 − β1xi) = 0

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 9 / 1

Page 10: Chapter2 Econometrics Old

More Derivation of OLS

Given the definition of a sample mean, and properties ofsummation, we can rewrite the first condition as follows

y = β0 + β1x or

β0 = y − β1x

n∑i=1

xi(yi − (y − β1x)− β1xi) = 0

n∑i=1

xi(yi − y) = β1

n∑i=1

xi(xi − x)

n∑i=1

(xi − x)(yi − y) = β1

n∑i=1

(xi − x)2

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 10 / 1

Page 11: Chapter2 Econometrics Old

Solve for the OLS estimated slope is

β1 =

∑ni=1(xi − x)(yi − y)∑n

i=1(xi − x)2

provided that∑n

i=1(xi − x)2 > 0

β0 = y − β1x

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 11 / 1

Page 12: Chapter2 Econometrics Old

Summary of OLS slope estimate

The slope estimate is the sample covariance between x and ydivided by the sample variance of x .

If x and y are positively correlated, the slope will be positive.

If x and y are negatively correlated, the slope will be negative.

Only need x to vary in our sample.

Intuitively, OLS is fitting a line through the sample points suchthat the sum of squared residuals is as small as possible, hencethe term least squares.

The residual, u, is an estimate of the error term, u, and is thedifference between the fitted line (sample regression function)and the sample point.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 12 / 1

Page 13: Chapter2 Econometrics Old

Sample regression line, sample data points and the associatedestimated error terms.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 13 / 1

Page 14: Chapter2 Econometrics Old

Alternative approach to derivationGiven the intuitive idea of fitting a line, we can set up a formalminimize problemThat is, we want to choose our parameters such that weminimize the following:∑n

i=1(u2) =∑n

i=1(yi − β0 − ˆβ1xi)2

If one uses calculus to solve the minimization problem for thetwo parameters you obtain the following first order condtions,which are the same as we obtained before, multiplied by n.

n∑i=1

(yi − β0 − ˆβ1xi) = 0

n∑i=1

xi(yi − β0 − β1xi) = 0

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 14 / 1

Page 15: Chapter2 Econometrics Old

Algebraic Properties of OLS

The sum of the OLS residuals is zero

Thus, the sample average of the OLS residuals is zero as well

The sample covariance between the regressors and the OLSresiduals is zero

The OLS regression line always goes through the mean of thesample.∑n

i=1 ui = 0 and thus

∑ni=1 uin

= 0∑ni=1 xi ui = 0

y = β0 + β1x

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 15 / 1

Page 16: Chapter2 Econometrics Old

More terminology

We can think of each observation as being made up of anexplained part, and an unexplained part, yi = yi + ui . We thendefine the following:∑n

i=1(yi − y)2 is the total sum of squares (SST)∑ni=1(yi − y)2 is the explained sum of squares (SSE)∑ni=1 ui

2 is the residual sum of squares (SSR)

Then SST = SSE + SSR

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 16 / 1

Page 17: Chapter2 Econometrics Old

Proof that SST = SSE + SSR

∑(yi − y)2 =

∑[(yi − yi) + (yi − y)]2

=∑

[ui + (yi − y)]2

=∑

ui2 + 2

∑ui

2(yi − y) +∑

(yi − y)2

= SSR + 2∑

ui2(yi − y) + SSE

and we know that∑

ui(yi − y) = 0

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 17 / 1

Page 18: Chapter2 Econometrics Old

Goodness-of-fit

How do we think about how well our sample regression line fitour sample data?

Can compute the fraction of the total sum of squares (SST) thatis explained by the model, call this the R-squared of regression

R2 =SSE

SST= 1− SSR

SST

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 18 / 1

Page 19: Chapter2 Econometrics Old

Unbiasedness of OLS

Assume the population model is linear in parameters asy = β0 + β1x + u

Assume we can use a random sample of size n,{(xi , yi) : i = 1, 2, . . . , n}, from the population model. Thus wecan write the sample model yi = β0 + β1xi + ui

Assume E (u|x) = 0 and thus E (ui |xi) = 0

Assume there is variation in the xi

In order to think about unbiasedness, we need to rewrite ourestimator in term of the population parameters.

Start with a simple rewrite of the formula as

β1 =

∑(xi − x)yi

s2x

, where

s2x =

∑(xi − x)2

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 19 / 1

Page 20: Chapter2 Econometrics Old

Unbiasedness of the OLS

∑(xi − x)yi =

∑(xi − x)(β0 + β1xi + ui)

=∑

(xi − x)β0 +∑

(xi − x)β1xi +∑

(xi − x)ui

= β0

∑(xi − x) + β1

∑(xi − x)xi +

∑(xi − x)ui

∑(xi − x) = 0∑(xi − x)xi = 0

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 20 / 1

Page 21: Chapter2 Econometrics Old

Unbiasedness of OLS (cont)

so, the numerator can be written as β1s2x +

∑(xi − x)ui , and

thus

β1 = β1 +

∑(xi − x)ui

s2x

let di = (xi − x), so that

β1 = β1 + (1

s2x

)∑

diui , then

E (β1) = β1 + (1

s2x

)∑

diE (ui) = β1

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 21 / 1

Page 22: Chapter2 Econometrics Old

Unbiasedness Summary

The OLS estimates of β1 and β0 are unbiased

Proof of unbiasedness depends on our 4 assumptions - if anyassumption fails, then OLS is not neccessarily unbiased

Remember unbiasedness is a description of the estimator - in agiven sample we may be "hear" or "far" from the trueparameter.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 22 / 1

Page 23: Chapter2 Econometrics Old

Variance of the OLS Estimators

Now we know that sampling distribution of our estimate iscentered around the true parameter

We want to think about how spead out this distribution is

much easier to think about this variance under an additionalassumption, so

Assume Var(u|x |) = σ2 (Homoskedasticity)

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 23 / 1

Page 24: Chapter2 Econometrics Old

Variance of OLS (cont)

Var(u|x) = E (u2|x)− [E (u|x)]2

E (u|x |) = 0, so σ2 = E (u2|x) = E (u2) = Var(u)

Thus σ2 is also the unconditional variance, called the errorvariance

σ, the square root of the error variance is called the standarddeviation of the error

Can say: E (y |x) = β0 + β1x and Var(y |x) = σ2

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 24 / 1

Page 25: Chapter2 Econometrics Old

Homoskedastic Case

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 25 / 1

Page 26: Chapter2 Econometrics Old

Heteroskedastic Case

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 26 / 1

Page 27: Chapter2 Econometrics Old

Variance of OLS (cont)

Var(β1) = Var(β1 +1

s2x

∑diui)

= (1

s2x

)2Var(∑

diui)

= (1

s2x

)2∑

d2i Var(ui)

= (1

s2x

)2∑

d2i σ

2 = σ2(1

s2x

)2∑

d2i

= σ2(1

s2x

)2 =σ2

s2x

= Var(β1)

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 27 / 1

Page 28: Chapter2 Econometrics Old

Variance of OLS Summary

The larger the error variance, σ2, the larger the variance of theslope estimate.

The larger the variability in the x , the smaller the variance of theslope estimate.

As a result, a larger sample size should decrease the variance ofthe slope estimate.

Problem that the error variance is unknown.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 28 / 1

Page 29: Chapter2 Econometrics Old

Estimating the Error Variance

We don’t know what the error variance, σ, is, because we don’tobserve the errors, ui .

What we observe are the residuals, ui .

We can use the residuals to form an estimate of the errorvariance.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 29 / 1

Page 30: Chapter2 Econometrics Old

Error Variance Estimate (cont)

ui = yi − β0 − β1xi

= (β0 + β1xi + ui)− β0 − β1xi

= ui − (β0 − β0)− (β1 − β1)

Then , an unbiased estimator of σ2 is

σ2 =1

(n − 2)

∑ui

2 = SSR/(n − 2)

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 30 / 1

Page 31: Chapter2 Econometrics Old

Error Variance Estimate (cont)

σ =√σ2: Standard error of the regression recall that sd(β) =

σ

sx

if we substitute σ for σ then we have the standard error of β1.

se(β1) = σ/√∑

(xi − x)2

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 31 / 1

Page 32: Chapter2 Econometrics Old

The Gauss-Markov Assumption (GM) for SimpleRegression

Assumption SLR. 1 Linear in Parameters

In the population model, the dependent variable, y , is related tothe independent variable, x , and the error (or disturbance), u, as

y = β0 + β1x + u

where β0 and β1 are the population intercept and slope param-eters, respectively.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 32 / 1

Page 33: Chapter2 Econometrics Old

The GM Assumption (cont)

Assumption SLR. 2 Random Sampling

We have a random sample of size n, {xi , i = 1, 2, . . . , n}, fol-lowing the population model in Assumption SLR. 1

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 33 / 1

Page 34: Chapter2 Econometrics Old

The GM Assumption (cont)

Assumption SLR. 3 Sample Variation in the Explanatory

The sample outcomes on x , namely, {xi , i = 1, 2, . . . , n}, arenot all the same value.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 34 / 1

Page 35: Chapter2 Econometrics Old

The GM Assumption (cont)

Assumption SLR. 4 Zero Conditional Mean

The error u has the same variance given any value of theexplanatory variable. In other words,

E (u|x) = 0.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 35 / 1

Page 36: Chapter2 Econometrics Old

The GM Assumption (cont)

Assumption SLR. 5 Homoskedasticity

The error u has the same variance given any value of theexplanatory variable. In other words,

Var(u|x) = σ2.

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 36 / 1

Page 37: Chapter2 Econometrics Old

Stata code

reg lwage exp wks occ

Source | SS df MS Number of obs = 4165

-------------+------------------------------ F( 3, 4161) = 266.12

Model | 142.774178 3 47.5913928 Prob > F = 0.0000

Residual | 744.130723 4161 .178834589 R-squared = 0.1610

-------------+------------------------------ Adj R-squared = 0.1604

Total | 886.904902 4164 .212993492 Root MSE = .42289

------------------------------------------------------------------------------

lwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]

-------------+----------------------------------------------------------------

exp | .0100694 .0006 16.78 0.000 .0088931 .0112456

wks | .0058775 .0012784 4.60 0.000 .0033711 .0083839

occ | -.311163 .0131532 -23.66 0.000 -.3369502 -.2853758

_cons | 6.360351 .062024 102.55 0.000 6.238751 6.481951

------------------------------------------------------------------------------

Võ Đức Hoàng Vũ (UEH) Applied Econometrics June 2015 37 / 1