Appendix--Deriving the OLS Regression Estimator Equations

advertisement
UNC-Wilmington
Department of Economics and Finance
ECN 377
Dr. Chris Dumas
Appendix to Regression Handout
Ģ‚ šŸŽ and šœ·
Ģ‚šŸ
Derivation of the OLS Regression Estimator Equations for šœ·
(The material in this Appendix is not required for ECN377, but if you plan to go to grad school, you should
understand and be able to explain the derivation below. If you want to understand, but you don’t, come by my
office, and I’ll help you.)
The OLS Regression Estimator Equations are the solution to the problem:
“Find the βĢ‚i’s that minimize the sum of the squared eĢ‚i’s for all individuals in the sample.”
min ∑(š‘’Ģ‚š‘–2 )
Ģ‚0 ,š›½
Ģ‚1
š›½
š‘–
The problem above is a nonlinear optimization problem without constraints, so we can use the classical calculus
method of optimization to find a solution (recall the classical calculus method of optimization from your ECN321
course at UNCW).
To solve this problem, begin by replacing eĢ‚i with š‘Œš‘– − βĢ‚0 − βĢ‚1 āˆ™ š‘‹1š‘–
2
min ∑ ((š‘Œš‘– − βĢ‚0 − βĢ‚1 āˆ™ š‘‹1š‘– ) )
Ģ‚0 ,š›½
Ģ‚1
š›½
š‘–
Next, square the expression within the parentheses:
2
min ∑[š‘Œš‘–2 − š‘Œš‘– š›½Ģ‚0 − š‘Œš‘– š›½Ģ‚1 š‘‹1š‘– − š›½Ģ‚0 š‘Œš‘– + š›½Ģ‚02 + š›½Ģ‚0 š›½Ģ‚1 š‘‹1š‘– − š›½Ģ‚1 š‘‹1š‘– š‘Œš‘– + š›½Ģ‚1 š‘‹1š‘– š›½Ģ‚0 + š›½Ģ‚12 š‘‹1š‘–
]
Ģ‚0 ,š›½
Ģ‚1
š›½
š‘–
Inside the brackets, collect similar terms together:
2
min ∑[š‘Œš‘–2 − 2š‘Œš‘– š›½Ģ‚0 − 2š‘Œš‘– š›½Ģ‚1 š‘‹1š‘– + š›½Ģ‚02 + 2š›½Ģ‚0 š›½Ģ‚1 š‘‹1š‘– + š›½Ģ‚12 š‘‹1š‘–
]
Ģ‚0 ,š›½
Ģ‚1
š›½
š‘–
Take partial derivatives and set each equal to zero to find the First Order Conditions for the minimization problem
(remember that the partial derivative operator can “move through” the summation operator):
F.O.C.’s
(1)
(2)
šœ•
Ģ‚
šœ•š›½
0
šœ•
Ģ‚
šœ•š›½
1
Ģ‚ + 2š›½
Ģ‚ š‘‹ ]=0
= ∑š‘– [−2š‘Œš‘– + 2š›½
0
1 1š‘–
Ģ‚ š‘‹ + 2š›½
Ģ‚ š‘‹2 ] = 0
= ∑š‘– [−2š‘Œš‘– š‘‹1š‘– + 2š›½
0 1š‘–
1 1š‘–
Now let’s focus on simplifying FOC (1):
Ģ‚ + 2š›½
Ģ‚ š‘‹ ]=0
∑ [−2š‘Œš‘– + 2š›½
0
1 1š‘–
š‘–
1
UNC-Wilmington
Department of Economics and Finance
ECN 377
Dr. Chris Dumas
Recall that the summation operator can distribute across terms that are added or subtracted:
Ģ‚ ] + ∑ [2š›½
Ģ‚ š‘‹ ]=0
∑[−2š‘Œš‘– ] + ∑ [2š›½
0
1 1š‘–
š‘–
š‘–
š‘–
Recall that constants can be “pulled through” summation operators:
Ģ‚ ∑ 1 + 2š›½
Ģ‚ ∑š‘‹ = 0
−2 ∑ š‘Œš‘– + 2š›½
1š‘–
0
1
š‘–
š‘–
š‘–
Next, assuming that our sample size is “n”, notice that the sum of n “one’s” is simply equal to n:
Ģ‚ š‘› + 2š›½
Ģ‚ ∑š‘‹ = 0
−2 ∑ š‘Œš‘– + 2š›½
1š‘–
0
1
š‘–
š‘–
Cancelling the “2’s” and moving the term with the sum of Y to the right side of the equation:
š›½Ģ‚0 š‘› + š›½Ģ‚1 ∑š‘– š‘‹1š‘–
=
∑š‘– š‘Œš‘–
call this Equation (3)
Turning to FOC (2), using methods similar to those that we used for FOC (1), we find that FOC (2) simplifies to:
2
] = ∑š‘–[š‘Œš‘– š‘‹1š‘– ]
š›½Ģ‚0 ∑š‘–[š‘‹1š‘– ] + š›½Ģ‚1 ∑š‘–[š‘‹1š‘–
call this Equation (4)
Importantly, notice that Equation (3) and Equation (4) are “two equations in two unknowns.” The two unknowns
are š›½Ģ‚0 and š›½Ģ‚1 (recall that we are trying to solve for š›½Ģ‚0 and š›½Ģ‚1 .) The X and Y variables are not unknowns,
because we have sample data on X and Y that we can insert into the equations; we also assume that we know n,
the sample size. Next, we solve these “two equations in two unknowns” for š›½Ģ‚0 and š›½Ģ‚1 (for example, we could
solve Equation (3) for š›½Ģ‚0 , substitute the result into Equation (4), solve Equation (4) for š›½Ģ‚1 , and then substitute
the result for š›½Ģ‚1 back into Equation (3) to find š›½Ģ‚0 ). When we solve Equation (3) and Equation (4) for š›½Ģ‚0 and
š›½Ģ‚1 , we find:
š›½Ģ‚0
š›½Ģ‚1 =
=
∑š‘– š‘Œš‘–
š‘›
− š›½Ģ‚1
∑š‘– š‘‹1š‘–
š‘›
∑š‘–[š‘Œš‘– š‘‹1š‘– ] − (∑š‘–[š‘‹1š‘– ]) (
2 ] (∑ [š‘‹ ])
∑š‘–[š‘‹1š‘–
−
š‘–
1š‘– (
∑š‘–[š‘Œš‘– ]
š‘›
∑š‘–[š‘‹1š‘– ]
š‘›
)
)
2
UNC-Wilmington
Department of Economics and Finance
ECN 377
Dr. Chris Dumas
We can simplify the last two equations above a bit more by noticing that
the dataset, or Ģ…Ģ…Ģ…
š‘‹1 , and similarly,
∑š‘– š‘Œš‘–
š‘›
∑š‘– š‘‹1š‘–
š‘›
is simply the average value of X1 in
is equal to š‘ŒĢ…. Making these substitutions:
š›½Ģ‚0
š›½Ģ‚1 =
Ģ… − š›½Ģ‚1
=š‘Œ
āˆ™ Ģ…Ģ…Ģ…
š‘‹1
∑š‘–[š‘Œš‘– š‘‹1š‘– ] − (∑š‘–[š‘‹1š‘– ]) āˆ™Ģ…š‘Œ
2 ] (∑ [š‘‹ ]) Ģ…Ģ…Ģ…Ģ…
∑š‘–[š‘‹1š‘–
−
š‘–
1š‘– āˆ™ š‘‹1
As a last simplification, if we multiply each ∑š‘– š‘‹1š‘– by
š‘›
š‘›
and notice again that
∑š‘– š‘‹1š‘–
š‘›
is equal to Ģ…Ģ…Ģ…
š‘‹1 , we find:
Ģ‚ šŸŽ and šœ·
Ģ‚šŸ
The OLS Regression Estimator Equations for šœ·
š›½Ģ‚0
š›½Ģ‚1 =
Ģ… − š›½Ģ‚1
=š‘Œ
āˆ™ Ģ…Ģ…Ģ…
š‘‹1
∑š‘–[š‘Œš‘– š‘‹1š‘– ] − š‘› āˆ™ š‘‹Ģ…1 āˆ™Ģ…š‘Œ
2]
∑š‘–[š‘‹1š‘–
− š‘› āˆ™ (š‘‹Ģ…1 )2
3
Download