You are on page 1of 41

The Simple Regression Model

y = β0 + β1x + u

Dr Jin Hongfei 1
Some Terminology
In the simple linear regression model,
where y = β0 + β1x + u, we typically refer
to y as the
„ Dependent Variable, or
„ Left-Hand Side Variable, or
„ Explained Variable, or
„ Regressand

Dr Jin Hongfei 2
Some Terminology, cont.
In the simple linear regression of y on x,
we typically refer to x as the
„ Independent Variable, or
„ Right-Hand Side Variable, or
„ Explanatory Variable, or
„ Regressor, or
„ Covariate, or
„ Control Variables

Dr Jin Hongfei 3
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


we can always use β0 to normalize E(u) to 0

Dr Jin Hongfei 4
Zero Conditional Mean
We need to make a crucial assumption
about how u and x are related
We want it to be the case that knowing
something about x does not give us any
information about u, so that they are
completely unrelated. That is, that
E(u|x) = E(u) = 0, which implies
E(y|x) = β0 + β1x

Dr Jin Hongfei 5
E(y|x) as a linear function of x, where for any x
the distribution of y is centered about E(y|x)
y
f(y)

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

x1 x2
Dr Jin Hongfei 6
Ordinary Least Squares
Basic idea of regression is to estimate the
population parameters from a sample
Let {(xi,yi): i=1, …,n} denote a random
sample of size n from the population
For each observation in this sample, it will
be the case that
y i = β 0 + β 1 xi + ui

Dr Jin Hongfei 7
Population regression line, sample data points
and the associated error terms
y E(y|x) = β0 + β1x
y4 .{
u4

y3 .} u3
y2 u2 {.

y1 .} u1

x1 x2 x3 x4 x
Dr Jin Hongfei 8
Deriving OLS Estimates
To derive the OLS estimates we need to
realize that our main assumption of E(u|x) =
E(u) = 0 also implies that

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

Why? Remember from basic probability


that Cov(X,Y) = E(XY) – E(X)E(Y)

Dr Jin Hongfei 9
Deriving OLS continued
We can write our 2 restrictions just in terms
of x, y, β0 and β1 , since u = y – β0 – β1x

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

These are called moment restrictions

Dr Jin Hongfei 10
Deriving OLS using M.O.M.
The method of moments approach to
estimation implies imposing the population
moment restrictions on the sample moments

What does this mean? Recall that for E(X),


the mean of a population distribution, a
sample estimator of E(X) is simply the
arithmetic mean of the sample

Dr Jin Hongfei 11
More Derivation of OLS
We want to choose values of the parameters that
will ensure that the sample versions of our
moment restrictions are true
The sample versions are as follows:

∑ (y )
n
n −1
i − βˆ 0 − βˆ 1 x i = 0
i =1

( )
n
n −1

i =1
x i y i − βˆ 0 − βˆ 1 x i = 0
Dr Jin Hongfei 12
More Derivation of OLS
Given the definition of a sample mean, and
properties of summation, we can rewrite the first
condition as follows

y = βˆ0 + βˆ1 x ,
or
βˆ0 = y − βˆ1 x
Dr Jin Hongfei 13
More Derivation of OLS

( ( ) )
n

∑ i i
x
i =1
y − y − β
ˆ x − βˆ x = 0
1 1 i

n n
x (
∑ i iy − y ) = β
ˆ
1 ∑ xi ( xi − x )
i =1 i =1
n n

∑ (xi − x )( yi − y ) = β1 ∑ (xi − x )
ˆ 2

i =1 i =1

Dr Jin Hongfei 14
So the OLS estimated slope is
n

∑ (x − x )( y
i i − y)
βˆ1 = i =1
n

∑ (x − x )
2
i
i =1
n
provided that ∑ ( xi − x ) > 0
2

i =1

Dr Jin Hongfei 15
Summary of OLS slope estimate
The slope estimate is the sample covariance
between x and y divided 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

Dr Jin Hongfei 16
More OLS
Intuitively, OLS is fitting a line through the
sample points such that the sum of squared
residuals is as small as possible, hence the
term least squares
The residual, û, is an estimate of the error
term, u, and is the difference between the
fitted line (sample regression function) and
the sample point
Dr Jin Hongfei 17
Sample regression line, sample data points
and the associated estimated error terms
y
y4 .
û4 {
yˆ = βˆ0 + βˆ1 x
y3 .} û3
y2 û2 { .

} û1
y1 .
x1 x2 x3 x4 x
Dr Jin Hongfei 18
Alternate approach to derivation
Given the intuitive idea of fitting a line, we can
set up a formal minimization problem
That is, we want to choose our parameters such
that we minimize the following:

( )
n n

∑ (uˆi ) = ∑ yi − βˆ0 − βˆ1 xi


2 2

i =1 i =1

Dr Jin Hongfei 19
Alternate approach, continued
If one uses calculus to solve the minimization
problem for the two parameters you obtain the
following first order conditions, which are the
same as we obtained before, multiplied by n

∑ (y )
n

i − βˆ 0 − βˆ1 x i = 0
i =1

( )
n

∑i =1
x i y i − βˆ 0 − βˆ1 x i = 0
Dr Jin Hongfei 20
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 OLS residuals is zero
The OLS regression line always goes
through the mean of the sample

Dr Jin Hongfei 21
Algebraic Properties (precise)
n

n ∑ uˆ i

∑ uˆi = 0 and thus,


i =1
i =1
n
=0
n

∑ x uˆ
i =1
i i =0

y = βˆ 0 + βˆ1 x
Dr Jin Hongfei 22
More terminology
We can think of each observation as being made
up of an explained part, and an unexplained part,
yi = yˆ i + uˆi We then define the following :
∑ ( y − y ) is the total sum of squares (SST)
2
i

∑ ( yˆ − y ) is the explained sum of squares (SSE)


2
i

∑ uˆ is the residual sum of squares (SSR)


2
i

Then SST = SSE + SSR


Dr Jin Hongfei 23
Proof that SST = SSE + SSR

∑ ( y − y ) = ∑ [( y − yˆ ) + ( yˆ − y )]
2 2
i i i i

= ∑ [uˆ + ( yˆ − y )]
2
i i

= ∑ uˆ + 2∑ uˆ ( yˆ − y ) + ∑ ( yˆ − y )
2 2
i i i i

= SSR + 2∑ uˆ ( yˆ − y ) + SSE
i i

and we know that ∑ uˆ ( yˆ − y ) = 0 i i

Dr Jin Hongfei 24
Goodness-of-Fit
How do we think about how well our
sample regression line fits our sample data?

Can compute the fraction of the total sum


of squares (SST) that is explained by the
model, call this the R-squared of regression

R2 = SSE/SST = 1 – SSR/SST

Dr Jin Hongfei 25
Using Stata for OLS regressions
Now that we’ve derived the formula for
calculating the OLS estimates of our
parameters, you’ll be happy to know you
don’t have to compute them by hand
Regressions in Stata are very simple, to run
the regression of y on x, just type
reg y x

Dr Jin Hongfei 26
Unbiasedness of OLS
Assume the population model is linear in
parameters as y = β0 + β1x + u
Assume we can use a random sample of
size n, {(xi, yi): i=1, 2, …, n}, from the
population model. Thus we can 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

Dr Jin Hongfei 27
Unbiasedness of OLS (cont)
In order to think about unbiasedness, we need to
rewrite our estimator in terms of the population
parameter
Start with a simple rewrite of the formula as

∑ (x − x ) y
βˆ
1 = i
2
i
, where
s x

s ≡ ∑ ( xi − x )
2 2
x

Dr Jin Hongfei 28
Unbiasedness of OLS (cont)

∑ (x − x )y =∑ (x − x )(β + β x
i i i 0 1 i + ui ) =
∑ (x − x )β + ∑ (x − x )β x
i 0 i 1 i

+ ∑ ( x − x )u =
i i

β ∑ (x − x ) + β ∑ (x − x )x
0 i 1 i i

+ ∑ ( x − x )u
i i

Dr Jin Hongfei 29
Unbiasedness of OLS (cont)
∑ (x − x ) = 0,
i

∑ (x − x )x = ∑ (x − x )
2
i i i

so, the numerator can be rewritten as


β s + ∑ (xi − x )ui , and thus
2
1 x

∑ (x − x )u
βˆ1 = β1 + i
2
i

s x
Dr Jin Hongfei 30
Unbiasedness of OLS (cont)

let d i = ( xi − x ), so that
⎛ 1 ⎞
β i = β1 + ⎜ 2 ⎟∑ d i ui , then
ˆ
⎝ sx ⎠

( )
E β1 = β1 + ⎜
ˆ ⎛ 1 ⎞
2 ⎟∑ d i E (ui ) = β1
⎝ sx ⎠

Dr Jin Hongfei 31
Unbiasedness Summary
The OLS estimates of β1 and β0 are
unbiased
Proof of unbiasedness depends on our 4
assumptions – if any assumption fails, then
OLS is not necessarily unbiased
Remember unbiasedness is a description of
the estimator – in a given sample we may be
“near” or “far” from the true parameter

Dr Jin Hongfei 32
Variance of the OLS Estimators
Now we know that the sampling
distribution of our estimate is centered
around the true parameter
Want to think about how spread out this
distribution is
Much easier to think about this variance
under an additional assumption, so
Assume Var(u|x) = σ2 (Homoskedasticity)

Dr Jin Hongfei 33
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 error variance
σ, the square root of the error variance is
called the standard deviation of the error
Can say: E(y|x)=β0 + β1x and Var(y|x) = σ2

Dr Jin Hongfei 34
Homoskedastic Case
y
f(y|x)

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

x1 x2
Dr Jin Hongfei 35
Heteroskedastic Case
f(y|x)

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

.
x1 x2 x3 x
Dr Jin Hongfei 36
Variance of OLS (cont)
( ) ⎛ ⎛ 1 ⎞
Var β 1 = Var ⎜⎜ β 1 + ⎜
ˆ ⎞
2 ⎟∑ d i ui ⎟
⎟ =
⎝ ⎝ sx ⎠ ⎠
2 2
⎛ 1 ⎞ ⎛ 1 ⎞
⎜ 2 ⎟ Var (∑ d i u i ) = ⎜ 2⎟ ∑ d Var (u )
2
i i
⎝ sx ⎠ ⎝ sx ⎠
2 2
⎛ 1 ⎞ ⎛ 1 ⎞
=⎜ 2⎟
⎝ sx ⎠
∑ d σ = σ ⎜⎝ s x2 ⎟⎠
i
2 2 2
∑ i =
d 2

( )
2
⎛ 1 ⎞ 2 σ2
σ ⎜2
2 ⎟ sx = 2 = Var β 1
ˆ
⎝ sx ⎠ sx
Dr Jin Hongfei 37
Variance of OLS Summary
The larger the error variance, σ2, the larger
the variance of the slope estimate
The larger the variability in the xi, the
smaller the variance of the slope estimate
As a result, a larger sample size should
decrease the variance of the slope estimate
Problem that the error variance is unknown

Dr Jin Hongfei 38
Estimating the Error Variance
We don’t know what the error variance, σ2,
is, because we don’t observe the errors, ui

What we observe are the residuals, ûi

We can use the residuals to form an


estimate of the error variance

Dr Jin Hongfei 39
Error Variance Estimate (cont)

uˆi = yi − βˆ0 − βˆ1 xi


= (β 0 + β1 xi + ui ) − βˆ0 − βˆ1 xi
i (
= u − βˆ − β − βˆ − β
0 0 ) ( 1 1 )
Then, an unbiased estimator of σ is 2

i = SSR / (n − 2 )
1
σˆ =
2

(n − 2) ∑ ˆ
u 2

Dr Jin Hongfei 40
Error Variance Estimate (cont)
σˆ = σˆ = Standard error of the regression
2

()
recall that sd βˆ = σ
sx
if we substitute σˆ for σ then we have
the standard error of βˆ1 ,

( ) (
se βˆ1 = σˆ / ∑ ( xi − x )
2
)
1
2

Dr Jin Hongfei 41

You might also like