Two-Variable Regression Analysis
Two-Variable Regression Analysis
Week 2
Two-variable
Regression
Analysis
Gujarati(2003): Chapter 2
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
2.2
f(Y|X=80)
Y|X=80 Y
Y|x=80 Y|x=100 Y
E(Y|X)
E(Y|X) 2=
X
x slope
1{
Intercept X (income)
ui = Yi - E(Y|Xi)
or Yi = E(Y|Xi) + u i
Shochastic error or
or Yi = 1 + 2 X + u i Stochastic disturbance
^1 = 65 = ^
Y 1 + ^2 (80)
Estimated average: ^2 = 65 = ^
Y 1 + ^2 (80)
^ = 65 = ^
Y + ^ (80)
3 1 2
^ ^ ^
Y4 = 65 = 1 + 2 (80)
^ ^ ^
Y5 = 65 = 1 + 2 (80)
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
2.11
The reasons for stochastic disturbance
• Vagueness of theory
• Unavailability of data
• Direct effect vs indirect effect
• (Core variables vs peripheral variables)
• Intrinsic randomness in human behaviour
• Poor proxy variables
• Principle of parsimony
• wrong functional form
Y1 .} u 1
x
x1 x2 x3 x4
The relationship among Yi, ui and the true regression line.
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
2.14
The Sample Regression Function (SRF)
(SRF2)
Y ^ ^ ^
Y = 1 + 2x
Y4 ^u {. ^ ^ ^
4 Y = 1 + 2x
(SRF1)
Y3 . }^u 3
Y2 ^u .
2{
^
} 1
u
Y1 .
x
x1 x2 x3 x4
Different samples will have different SRFs)
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
SRF:
Yi = 1 + 2 Xi 2.15
^ ^ ^
or Yi =
^1 + ^2Xi + u^i
Residual
or Yi = b1 + b2 Xi + ei
PRF:
E(Y|X) = 1 + 2 Xi
Yi = 1 + 2 Xi + u i Error term or
Disturbance
^
Yi = estimator of Yi (E(Y|xi)
^
i or bi = estimator of i
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
Least Squared Method ^ 2.16
SRF :Y = a +a X
2
2
1 2
Y
^
SRF1:Y1= b1+b2X
1 -2
1
1 -1/2
-11/2
2
0
-1
-1
X
SRF1: |u| = |1| + |-1| + |-1| + |1| + |-1.5| = 5.5
u2 =12 + 12 + 12 + 12 + 1.52 = 6.25 smaller
Yi = 1 + 2Xi + ui
u i = Y i - 1 - 2X i
f ( )
1 = - 2 (Y i - 1 - 2Xi )
f()
2 = - 2 Xi (Yi - 1 - 2Xi )
Set each of these two derivatives equal to zero and
solve these two equations for the two unknowns: 1
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
2
To minimize f(.), you set the two 2.19
derivatives equal to zero to get:
f()
1 = - 2 (Y i – b1 – b2Xi ) = 0
f()
2 = - 2 xi (Yi - b1 – b2Xi ) = 0
When these two terms are set to zero,
1 and 2 become b1 and b2 because they no longer
represent just any value of 1 and 2 but the special
values that correspond to the minimum of f() .
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
2.20
- 2 (Y i - b1 – b2Xi ) = 0
- 2 Xi (Y i – b1 – b2Xi ) = 0
nb1 + b2 Xi = Y i
2
b1 Xi + b2 Xi = Xi Yi
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
n 2.21
Xi b1
= Yi
Xi X
2
i b2 = Xi Yi
b2 = n Xi Yi - Xi Yi
2 2
n X i - (Xi )
xy
= Xi - X )Yi -Y) =
X
i - X ) 2
x 2
b1 = Y - b2 x
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
Y 2.22
. Y4 ^Y = b
^*
^*
Y2 .
^*
Y3
^u*
4 {. ^*
^* *
1 + b 2X
*
Y = b1 + b2X
.
Y1 . u*3{
^ Y4
{
u*2 {. Y2
^ .
Y3
^
u*1
.
Y1
x1 x2 x3 x4 x
re
tu
di
p en
.
ex .
Y
i
r e
i tu
e nd
p
ex
.
.
.
x1 x2 x3 income xt
The variance of Yi increases as family income,
xi, increases.
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
2.26
Assumptions of SRF (continue)
Y ~ N [(1+2X),2 ]
x t = years of experience
^
yt = predicted wage rate
^
If x t = 2 years, then yt = $7.00 per hour.
^
If x t = 3 years, then yt = $8.50 per hour.
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
2.31
Mean Prediction:
Ŷ ˆ 0 ˆ 1 X Prediction
Ŷ = 24.454 + 0.5090 X
X= 100
^
Y = 24.454 + 0.5090 (100) = 75.364
(estimated result)
1947 – 1995: ^
Yt = 238.4 + 0.87Xt
Given values of X96 = 10,419; X97 = 10,625; … X99 = 11,286
The calculated predictions or the “ex post” forecasts are:
^
1996: Y96 = 238.4 + 0.87(10,149) = 9.355
^
1997: Y97 = 238.4 + 0.87(10,625) = 9.535.50
…..
^
1999: Y99 = 238.4 + 0.87(11285) = 10,113.70
^ ^ ^
Yt 1 2 Xt
Forecast for-period t+ is
^ ^ ^
Yt 1 2 Xt
: # of period into the future
Forecast error:
xt : is an observed or control value
^
ut
f ^ of future
Yt Yt
All rights reserved by Dr.Bill Wan Sing Hung - HKBU
Comparison of Forecasts 2.34
^
Mean squared error (Y Y ) 2
(MSE)
nk
Root mean squared MSE
error(RMSE)
^ 2
(Y Y )
nk
^ Y |
|Y
Mean absolute percentage error ( i
Yi
i )
(MAPE) MAPE
n k