CH 6 Slides
CH 6 Slides
CH 6 Slides
(SW Ch. 6)
6-1
The TestScore – STR relation looks approximately
linear…
6-2
But the TestScore – average district income relation
looks like it is nonlinear.
6-3
If a relation between Y and X is nonlinear:
The effect on Y of a change in X depends on the value
of X – that is, the marginal effect of X is not constant
A linear regression is mis-specified – the functional
form is wrong
The estimator of the effect on Y of X is biased – it
needn’t even be right on average.
The solution to this is to estimate a regression
function that is nonlinear in X
6-4
The General Nonlinear Population Regression Function
Assumptions
1. E(ui| X1i,X2i,…,Xki) = 0 (same); implies that f is the
conditional expectation of Y given the X’s.
2. (X1i,…,Xki,Yi) are i.i.d. (same).
3. “enough” moments exist (same idea; the precise
statement depends on specific f).
4. No perfect multicollinearity (same idea; the precise
statement depends on the specific f).
6-5
6-6
Nonlinear Functions of a Single Independent Variable
(SW Section 6.2)
6-7
1. Polynomials in X
Approximate the population regression function by a
polynomial:
Yi = 0 + 1Xi + 2 X i +…+ r X i + ui
2 r
6-8
Example: the TestScore – Income relation
Quadratic specification:
Cubic specification:
------------------------------------------------------------------------------
| Robust
testscr | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
avginc | 3.850995 .2680941 14.36 0.000 3.32401 4.377979
avginc2 | -.0423085 .0047803 -8.85 0.000 -.051705 -.0329119
_cons | 607.3017 2.901754 209.29 0.000 601.5978 613.0056
------------------------------------------------------------------------------
6-
Interpreting the estimated regression function:
(a) Compute “effects” for different values of X
2
TestScore = 607.3 + 3.85Income i – 0.0423(Income i )
(2.9) (0.27) (0.0048)
TestScore
= 607.3 + 3.856 – 0.042362
– (607.3 + 3.855 – 0.042352)
= 3.4
6-
2
TestScore = 607.3 + 3.85Income i – 0.0423(Income i )
6-
Estimation of the cubic specification in STATA
------------------------------------------------------------------------------
| Robust
test avginc2 avginc3; Execute the test command after running the regression
( 1) avginc2 = 0.0
( 2) avginc3 = 0.0
F( 2, 416) = 37.69
Prob > F = 0.0000
x x
Here’s why: ln(x+x) – ln(x) = ln 1
x x
d ln( x ) 1
(calculus: )
dx x
Numerically:
ln(1.01) = .00995 .01; ln(1.10) = .0953 .10 (sort of)
6-
Three cases:
6-
I. Linear-log population regression function
Yi = 0 + 1ln(Xi) + ui (b)
X
now ln(X + X) – ln(X) ,
X
X
so Y 1
X
Y
or 1 (small X)
X / X
6-
Linear-log case, continued
Yi = 0 + 1ln(Xi) + ui
X
Now 100 = percentage change in X, so a 1%
X
increase in X (multiplying X by 1.01) is associated with
a .011 change in Y.
6-
Example: TestScore vs. ln(Income)
First defining the new regressor, ln(Income)
The model is now linear in ln(Income), so the linear-log
model can be estimated by OLS:
TestScore = 557.8 + 36.42ln(Incomei)
(3.8) (1.40)
6-
II. Log-linear population regression function
Y
so 1X
Y
Y / Y
or 1 (small X)
X
6-
Log-linear case, continued
ln(Yi) = 0 + 1Xi + ui
Y / Y
for small X, 1
X
Y
Now 100 = percentage change in Y, so a change in
Y
X by one unit (X = 1) is associated with a 1001%
change in Y (Y increases by a factor of 1+1).
Note: What are the units of ui and the SER?
ofractional (proportional) deviations
ofor example, SER = .2 means…
6-
III. Log-log population regression function
Y X
so 1
Y X
Y / Y
or 1 (small X)
X / X
6-
Log-log case, continued
ln(Yi) = 0 + 1ln(Xi) + ui
6-
Example: ln( TestScore) vs. ln( Income)
First defining a new dependent variable, ln(TestScore),
and the new regressor, ln(Income)
The model is now a linear regression of ln(TestScore)
against ln(Income), which can be estimated by OLS:
6-
Neither specification seems to fit as well as the cubic or linear-log
6-
Summary: Logarithmic transformations
Yi = 0 + 1D1i + 2D2i + ui
6-
Interpreting the coefficients
Yi = 0 + 1D1i + 2D2i + 3(D1iD2i) + ui
6-
Example: TestScore, STR, English learners
Let
1 if STR 20 1 if PctEL l0
HiSTR = and HiEL =
0 if STR 20 0 if PctEL 10
TestScore = 664.1 – 18.2HiEL – 1.9HiSTR – 3.5(HiSTRHiEL)
(1.4) (2.3) (1.9) (3.1)
Di is binary, X is continuous
As specified above, the effect on Y of X (holding
constant D) = 2, which does not depend on D
To allow the effect of X to depend on D, include the
“interaction term” DiXi as a regressor:
6-
Interpreting the coefficients
Yi = 0 + 1Di + 2Xi + 3(DiXi) + ui
When HiEL = 0:
TestScore = 682.2 – 0.97STR
When HiEL = 1,
TestScore = 682.2 – 0.97STR + 5.6 – 1.28STR
= 687.8 – 2.25STR
Two regression lines: one for each HiSTR group.
Class size reduction is estimated to have a larger effect
when the percent of English learners is large.
Example, ctd.
6-
TestScore = 682.2 – 0.97STR + 5.6HiEL – 1.28(STRHiEL)
(11.9) (0.59) (19.5) (0.97)
Yi = 0 + 1 + 2Xi + 3Xi + ui
= (0+1) + (2+3)Xi + ui
6-
6-
(c) Interactions between two continuous variables
Yi = 0 + 1X1i + 2X2i + ui
6-
TestScore = 686.3 – 1.12STR – 0.67PctEL + .0012(STRPctEL),
(11.8) (0.59) (0.37) (0.019)
6-
Does population coefficient on STRPctEL = 0?
t = .0012/.019 = .06 can’t reject null at 5% level
Does population coefficient on STR = 0?
t = –1.12/0.59 = –1.90 can’t reject null at 5% level
Do the coefficients on both STR and STRPctEL = 0?
F = 3.89 (p-value = .021) reject null at 5% level(!!)
(Why? high but imperfect multicollinearity)
6-
Application: Nonlinear Effects on Test Scores
of the Student-Teacher Ratio
(SW Section 6.4)
6-
The TestScore – Income relation
6-
Question #1:
Investigate by considering a polynomial in STR
2 3
TestScore = 252.0 + 64.33STR – 3.42STR + .059STR
(163.6) (24.86) (1.25) (.021)
6-
Interpreting the regression function via plots
(preceding regression is labeled (5) in this figure)
6-
Are the higher order terms in STR statistically
significant?
2 3
TestScore = 252.0 + 64.33STR – 3.42STR + .059STR
(163.6) (24.86) (1.25) (.021)
TestScore = 653.6 – .53STR + 5.50HiEL – .58HiELSTR
(9.9) (.34) (9.80) (.50)
– .411LunchPCT + 12.12ln(Income)
(.029) (1.80)
TestScore = 653.6 – .53STR + 5.50HiEL – .58HiELSTR
(9.9) (.34) (9.80) (.50)
– .411LunchPCT + 12.12ln(Income)
(.029) (1.80)
TestScore = 653.6 – .53STR + 5.50HiEL – .58HiELSTR
(9.9) (.34) (9.80) (.50)
– .411LunchPCT + 12.12ln(Income)
(.029) (1.80)
6-
Tests of joint hypotheses:
6-
Summary: Nonlinear Regression Functions