Lecture 4
Lecture 4
1
3/8/2021
Indicator variables
(1=yes, 0=no)
2
3/8/2021
3
3/8/2021
Number of
bathrooms
Before reform
After reform
4
3/8/2021
Number of
police in 1986
Number of
police in 1990
5
3/8/2021
Sources of Data
6
3/8/2021
7
3/8/2021
8
3/8/2021
9
3/8/2021
10
3/8/2021
11
3/8/2021
𝜕𝑢𝑖2
𝜕𝐵2 =𝜕 𝜕𝐵2 Σ (Yi –B1 – B2X2i)2 =0
Derivations
n n
∑ ui2 = ∑ (yi – β1 – β2x2i)2
i=1 i=1
i=1 ∂β1
n
2 ∑ (yi – β1 – β2x2i) (-1) = 0
i=1
n n n
∑ (yi ) – ∑ β1 – β2∑ x2i = 0
i=1 i=1 i=1
n n
∑ (yi ) – ( β1 + β1 + .. β1.n ) – β2∑ x2i = 0
i=1 i=1
12
3/8/2021
Derivations
(Cont…)
n n
∑ (yi ) – ( β1 + β1 + .. β1.n ) – β2∑ x2i = 0
i=1 i=1
n n
∑ (yi ) – ( nβ1) – β2 ∑ x2i = 0
i=1 i=1
n
n
( nβ1) = ∑ (yi ) – β2∑ x2i
i=1 i=1
n n
β1 = ∑ (yi ) β2∑x2i
i=1
i=1
–
n n
– –
β1 = Y – β2 X
Derivations
n n
(Cont…)
∑ ui2 = ∑ (yi – β1 – β2x2i)2
i=1 i=1
n n n
β 2 ∑ x2i2 = ∑ (x2iyi ) – β1 ∑ x2i
i=1 i=1 i=1
13
3/8/2021
Derivations
(Cont…)
But we know that….
– –
β1 = Y – β2 X
n n n
β 2 ∑ x2i
2
= ∑ (x2iyi ) – β1 ∑ x2i
i=1 i=1 i=1
Derivations
(Cont…)
n n n n n
β 2 ∑ x2i2 = ∑ (x2iyi ) – ∑
i=1
x2i∑ yi
+
β 2 (∑x2i)2
i=1 i=1 i=1 i=1
n n
n n n
n
β 2 ( ∑xi)2 n ∑ x2i ∑ yi
β 2 ∑ xi2 – = ∑ (x2iyi ) – i=1 i=1
i=1
i=1
n i=1 n
n n n
n
(∑xi)2 n
∑ x2i∑ yi
β2 ∑ xi2 – i=1 = ∑ (x2iyi ) – i=1 i=1
i=1 i=1
n n
n n
n ∑ x2i∑ yi
∑ (x2iyi ) – i=1 i=1
i=1 n
β2 = n
n
∑ x2i2 (∑x )2
– i=1 2i
i=1 n
14
3/8/2021
Derivations
(Cont…)
n n
n ∑ x2i ∑ yi
∑ (x2iyi ) – i=1 i=1
i=1
n
β2 = n
n
(∑x2i)2
∑ xi2
i=1
– i=1n
n n n
n∑ (xiyi ) – ∑ x2i∑yi
i=1 i=1 i=1
n
β2 =
n n
n ∑ x2i2 – ( ∑x2i)2
i=1 i=1
Derivations
(Cont…)
n n n
n∑ (x2iyi ) – ∑ x2i ∑yi
i=1 i=1 i=1
n
β2 =
n n
n ∑ x2i2 – ( ∑ x2i)2
i=1 i=1
n n n
n∑ (x2iyi ) – ∑
i=1
x2i∑ yi
i=1 i=1
β2 = n n
n ∑ x2i2 – ( ∑x2i)2
i=1
i=1
15
3/8/2021
Derivations
(Cont…)
For OLS estimation of the model: Y = β1 + β2X2i +Ui
is given as follows
– –
β1 = Y – β2 X2
n n n
∑ xi ∑yi
n∑ (x2iyi ) – i=1
β2 =
i=1 i=1
ˆ2 x x y y
2i 2 i
x x
n n 2
∑x2i)2
n∑ x2i2 – (i=1 2i 2
i=1
𝑏1 = 𝑌 − 𝑏2 𝑋2
16
3/8/2021
17
3/8/2021
….by minimizing the error sum of squares (that’s what OLS does) of
these models
18