interaction terms by mumtaz hussain
TRANSCRIPT
-
8/2/2019 Interaction Terms by Mumtaz Hussain
1/6
bbb
bbbb
bbbb
=+++
=+++ +
=+++
+D
i 0 1 1 2 2
i 0 1 2 2 3 1 2
0 1 1 2 2 3 1 2
1
Interactions between Two Continuous Variables
Y
Y ( )
Gerneral Rule:
Y ( ) (a)
Now change inY
i i i
i i i i i
X X u
X X X X u
X X X X
Xbb bb
bb bb
bbbb
bbb bb b
bb
=++D++ +D
-
+D-=++D++ +D
-+++
+D-=++D++ +D
-++
0 1 1 1 2 2 3 1 1 2
0 1 1 1 2 2 3 1 1 2
0 1 1 2 2 3 1 2
0 1 1 1 1 2 2 3 1 2 3 1 2
0 1 1
Y ( ) [( ) ] (b)
Subtract
Y Y Y ( ) [( ) ]
[ ( )]
Y Y Y
[
X X X X X X
b a
X X X X X X
X X X X
X X X X X X X
X bb
bbb bb b
bbbb
b b
b b
bb
bb
bbb b
+
+D-=++D++ +D
----
D=D+D
D=D+D
D=D+
D=+
D
+D=+++D+ +D
+D=
2 2 3 1 2
0 1 1 1 1 2 2 3 1 2 3 1 2
0 1 1 2 2 3 1 2
1 1 3 1 2
1 1 3 1 2
1 1 3 2
1 3 2
1
2
0 1 1 2 2 2 3 1 2 2
( )]
Y Y Y
Y
Y
Y ( )
Y
Now change in
Y Y ( ) [ ( )]
Y Y
X X X
X X X X X X X
X X X X
X X X
X X X
X X
XX
X
X X X X X X
bbbb b b
bbb b
bbbb
bbbb b b
+++D+ + D
-
+D-=+++D+ +D
-+++
+D-=+++D+ + D
0 1 1 2 2 2 2 3 1 2 3 1 2
0 1 1 2 2 2 3 1 2 2
0 1 1 2 2 3 1 2
0 1 1 2 2 2 2 3 1 2 3 1 2
(c)
Subtract c
Y Y Y ( ) [ ( )]
[ ( )]
Y Y Y
X X X X X X X
a
X X X X X X
X X X X
X X X X X X X
bbbb
bbbb b b
bbbb
b b
bb
-+++
=+++D+ + D
----
D=D+ D
D=D+
0 1 1 2 2 3 1 2
0 1 1 2 2 2 2 3 1 2 3 1 2
0 1 1 2 2 3 1 2
2 2 3 1 2
2 2 3 1
[ ]
Y
Y ( )
X X X X
X X X X X X X
X X X X
X X X
X X
bbD
=+D
2 3 1
2
Y X
X
Mu mt a z K h e r a n i - Ma r c h 2 0 1 2 1
-
8/2/2019 Interaction Terms by Mumtaz Hussain
2/6
Interactions Between Binary and Continuous Variables
?Different Intercept , Same Slope (D-S)
Different Intercept , Different Slope (D-D)
?Same Intercept , Different Slope (S-D)
1 0 1 2Y i i i X D ubbb=+++
1 0 1 2 3Y ( )i i i i i X D X D ubbbb=+++ +
1 0 1 3Y ( )i i i i X X D ubbb=++ +
2
-
8/2/2019 Interaction Terms by Mumtaz Hussain
3/6
bbb
bbbb
=+++
=+++ +
1 0 1 2
1 0 1 2 3
Interactions between binary and continuous variable
Y
Including Interaction Term as a Regressor
Y ( )
General Rule:
i i i
i i
i i i i i
D X u
D X
D X D X u
bbbb
bbb b
bbb b
bbbb
bb
=+++
+D=+++D+ +D
-
+D-=+++D+ +D
-+++
+D-=+
0 1 2 3
0 1 2 3
0 1 2 3
0 1 2 3
0 1
Y ( ) (a)
Now change in X
Y Y ( ) [ ( )] (b)
Subtract
Y Y Y ( ) [ ( )]
[ ( )]
Y Y Y
D X D X
D X X D X X
b a
D X X D X X
D X D X
bbb b
bbbb
bb
bb
bb
b bbbb
++D+ +D
----
D=D+D
D=D+
D=+
D
D= =+=+
D
2 2 3 3
0 1 2 3
2 3
2 3
2 3
3 2 3 2 3
Y
Y [ ]
Y
Effect of X depend upon D
Yincriment to the effect of X when D 1 ( 1 )
D X X D X D X
D X D X
X D X
X D
DX
X
Mu mt a z K h e r a n i - Ma r c h 2 0 1 2
-
8/2/2019 Interaction Terms by Mumtaz Hussain
4/6
bbb
bbbb
bbbb
bbbb
=+++
=+++ +
=+++
=
==+++
i 0 1 2
i 0 1 2 3
0 1 2 3
0 1 2 3
Interactions between Binary and Continuous Variables
Y
Y ( )
General Rule:
Y ( )
Step 1: at ( 0)
E(Y/ , 0)
i i i
i i i i i
i
X D u
X D X D u
X D X D
D
X D X D
bbbb
bb
bbbb
bbbb
bbbb
bbbb
==+++
==+
=
==+++
==+++
==+++
==+++
0 1 2 3
0 1
0 1 2 3
0 1 2 3
0 1 2 3
0 2 1 3
( )
E(Y/ , 0) (0) ( 0)
E(Y/ , 0) (a)
Step 2: at ( 1)
E(Y/ , 1) ( )
E(Y/ , 1) (1) ( 1)
E(Y/ , 1)
E(Y/ , 1) ( ) ( )
X D
X D X X
X D X
D
X D X D X D
X D X X
X D X X
X D X
bbbbbb
bbbbbb
bb
bbb
bbb
b
bb
-
=- =
=+++-+
=+++--
=+
-
=+-
=+-
=
-
=+
0 2 1 3 0 1
0 1 2 3 0 1
2 3
0 2 0
0 2 0
2
1 3
(b)
Step 3: Subtract
E(Y/ , 1) E(Y/ , 0)
( ) ( ) [ ]
Intercept: Subtract
( )
Slope: Subtract
(
b a
X D X D
X X
X X X
X
b a
b a
X b
bbb
bbb
b
-
=+-
=+-
=
1
1 3 1
1 3 1
3
)
( )
X
X X X
X
X
Mu mt a z K h e r a n i - Ma r c h 2 0 1 2
-
8/2/2019 Interaction Terms by Mumtaz Hussain
5/6
=- + -
Interactoions Between Binary and Continuous Variables
:
Application to the Student Teacher Ratio (STR) and the percentage of
English Learners (HiEL)
682.2 0.97 5.6 1.28( )
Example
TestScore STR HiEL STR HiEL
=
=
=- +-
=-
2
(11.9) (0.59) (19.5) (0.97)
R 0.305
Low fraction of English Learners ( 0)
682.2 0.97 5.6(0) 1.28( 0)
682.2 0.97
HiEL
TestScore STR STR
TestScore ST +-
=-
=
=- +-
= +- -
=-
0 0
682.2 0.97
High fraction of English Learners ( 1)
682.2 0.97 5.6(1) 1.28( 1)
(682.2 5.6) 0.97 1.28
687.8 2.25
According to these estim
R
TestScore STR
HiEL
TestScore STR STR
TestScore STR STR
TestScore STR
ates, reducing the by 1 unit is predicted
to increase by 0.97 points in districts with low fraction of
but by 2.25 points in districts with high fraction of .
First, the hypot
STR
TestScore
HiEL HiEL
hesis that the two lines are infact the same can be tested by computing
the F-statistic testing the joint hypothesis that the coefficient on ,and the coefficient on the
interaction term
HiEL
STR HiEL
are both zero. This F-statistics is 89.9 which is singinicant at the 1% level.
Second, the hypothesis that tow lines have the same slope can be tested by testing whether the
coefficient on the intera - =-ction term is zero. The t-statistic ( 1.28 0.97 1.32) is less than 1.645 in
absolute vale, so the null hypothesis that the two lines have the same slope cnnot be jrected using a
two-sided test at the
= =
10% significane level.
Third, the hypothesis that the lines have the same intercept can be tested by testing whether the
population coefficients on is zero. The t-statistic is 5.6 19.5 0.29, soHiEL t the hypothesis that
the lines have the same intercept cannot be rejected at the 5% level.
-
8/2/2019 Interaction Terms by Mumtaz Hussain
6/6
bbb
bbbb
bb
=+++
=+++ +
===+
1 0 1 1 2 2
1 2
1 0 1 1 2 2 3 1 2
1 1 1 2 0 1 1
Interactions between two binary variables
Y
Including Interaction Term as a RegressorY ( )
Step 1:
E(Y / , 0)
i i i
i i
i i i i i
i i i
D D u
D DD D D D u
D d D D bb
bbbb
bb
bbbb
bbbb
++
===+++
===+
===+++
===+++
2 2 3 1 2
1 1 1 2 0 1 1 2 3 1
1 1 1 2 0 1 1
1 1 1 2 0 1 1 2 3 1
1 1 1 2 0 1 1 2 3 1
( )
E(Y / , 0) (0) ( 0)
E(Y / , 0) (a)
Step 2:
E(Y / , 1) (1) ( 1)
E(Y / , 1) (b)
St
i i
i i
i i
i i
i i
D d D
D d D d d
D d D d
D d D d d
D d D d d
bbbbbb
bbbbbb
bb
-
==- ==
=+++-+
=+++--
=+
1 1 1 2 1 1 1 2
0 1 1 2 3 1 0 1 1
0 1 1 2 3 1 0 1 1
2 3 1
ep 3: Subtract
E(Y / , 1) E(Y / , 0)
[ ]
i i i i
b a
D d D D d D
d d d
d d d
d
Mu mt a z K h e r a n i - Ma r c h 2 0 1 2