Académique Documents
Professionnel Documents
Culture Documents
=
=
n
i
i i
y y SSR
1
2
=
=
n
i
i
u
1
2
37
Copyrighted by Edmund Malesky. Do not distribute without permission.
Picking the Parameters
To Minimize SSR, we need parameter
estimates.
In calculus, if you wish to know when
a function is at its minimum, you take
the first derivative.
In this case we must take partial
derivatives since we have two
parameters (
0
&
1
) to worry about.
38
Copyrighted by Edmund Malesky. Do not distribute without permission.
How good does it fit?
To measure reduction in errors we need
a benchmark variable is a relevant and
tractable benchmark for comparing
predictions for comparison.
The mean of the dependent.
The mean of Y represents our best
guess at the value of Y
i
absent other
information.
39
Copyrighted by Edmund Malesky. Do not distribute without permission.
Sums of Squares
This gives us the following 'sum-of-
squares' measures:
SST=Total Sum of Squares
SSE= Explained Sum of Squares
SSR= Residual (Unexplained Sum of Squares)
Total Variation (SST) = Explained Variation (SSE) +
Unexplained Variation (SSR)
( )
2
1
=
=
n
i
i
y y SST
( )
=
=
n
i
i
y y SSE
1
2
( )
=
=
n
i
i i
y y SSR
1
2
40
Copyrighted by Edmund Malesky. Do not distribute without permission.
Explained and Unexplained
Variation
Y
X
X
i
y
i
0
B
1
B
x y
1 0
B + B =
i
y
i
u
( ) y y
i
41
Copyrighted by Edmund Malesky. Do not distribute without permission.
Explained and Unexplained
Variation
Y
X
i
y
i
i
y
i
u
( ) y y
i
Square this quantity
and sum across all
observations and
we have our SST
(Total Sum of
Squares)
Square this
quantity and sum
across all
observations and
we have our
SSE (Explained
Sum of Squares)
X
Square this
quantity and sum
across all
observations and
we have our SSR
(Residual Sum of
Squares)
42
Copyrighted by Edmund Malesky. Do not distribute without permission.
Some Confusing Terminology
Occasionally you may see people refer
instead to USS (Unexplained) and ESS
(Error)
These terms are interchangeable, but
ESS can be confused with explained sum
of squares
USS is not confused with any
mathematical jargon, but does pose issues
for statistical work on the US Navy.
43
Copyrighted by Edmund Malesky. Do not distribute without permission.
Lets Test Some Theories
Presidential approval depends upon the
performance of the US economy
The development of US military power
was a response to Americas threatening
environment
44
Copyrighted by Edmund Malesky. Do not distribute without permission.
Plotting Approval and Inflation
45
Copyrighted by Edmund Malesky. Do not distribute without permission.
Regressing Approval on
Inflation
. reg approve inflat
Source | SS df MS Number of obs = 46
---------+------------------------------ F( 1, 44) = 17.20
Model | 1960.60398 1 1960.60398 Prob > F = 0.0002
Residual | 5015.26094 44 113.983203 R-squared = 0.2811
---------+------------------------------ Adj R-squared = 0.2647
Total | 6975.86492 45 155.01922 Root MSE = 10.676
------------------------------------------------------------------------------
approve | Coef. Std. Err. t P>|t| [95% Conf. Interval]
---------+--------------------------------------------------------------------
inflat | -2.213684 .5337539 -4.147 0.000 -3.289394 -1.137973
_cons | 63.80565 2.711964 23.527 0.000 58.34004 69.27125
------------------------------------------------------------------------------
46
Copyrighted by Edmund Malesky. Do not distribute without permission.
Fitting Inflation to Approval
(mean) inflat
(mean) approve Fitted values
-.263876 12.8595
28.3333
76.2143
47
Copyrighted by Edmund Malesky. Do not distribute without permission.
Plotting US Power & Disputes
u
s
c
a
p
b
l
numtargt
0 7
.03
.38
48
Copyrighted by Edmund Malesky. Do not distribute without permission.
Regress US Power on Disputes
. reg uscapbl numtargt
Source | SS df MS Number of obs = 177
---------+------------------------------ F( 1, 175) = 18.61
Model | .110444241 1 .110444241 Prob > F = 0.0000
Residual | 1.03834672 175 .00593341 R-squared = 0.0961
---------+------------------------------ Adj R-squared = 0.0910
Total | 1.14879096 176 .006527221 Root MSE = .07703
------------------------------------------------------------------------------
uscapbl | Coef. Std. Err. t P>|t| [95% Conf. Interval]
---------+--------------------------------------------------------------------
numtargt | .0201142 .0046621 4.314 0.000 .010913 .0293155
_cons | .1455665 .0067132 21.684 0.000 .1323172 .1588157
------------------------------------------------------------------------------
49
Copyrighted by Edmund Malesky. Do not distribute without permission.
Fitting Disputes to US Power
numtargt
uscapbl Fitted values
0 7
.03
.38
50
Copyrighted by Edmund Malesky. Do not distribute without permission.
A Brief Review of Critical Concepts
Measures of Central Tendency
(Mean, Median, Mode)
Population Variance
Standard Deviation
Covariance
Correlation
Marginal Effect
1
(1/ )
n
i
i
x n x
=
=
2
2 2
1
( ) [( ( )) ]
(1/ ) ( )
n
i
i
Var X E X E X
n x x o
=
= =
2
( ) sd X o =
1
y x | A = A
| |
( , ) ( ( ))( ( )) Cov X Y E X E X Y E Y
( , )
( , )
( ) * ( )
XY
X Y
Cov X Y
Corr X Y
sd X sd Y
o
o o
=
51
Copyrighted by Edmund Malesky. Do not distribute without permission.
Distributions The Usual Suspects
Normal Distribution
Standard Normal
Chi-Square
t
F
52
Copyrighted by Edmund Malesky. Do not distribute without permission.
The Normal Distribution
(Probability Density Function)
x
2 2
2
1
( ) [ ( ) / 2 ]
2
( , )
f x E x u
X Normal u
o
o t
o
=
~
53
Copyrighted by Edmund Malesky. Do not distribute without permission.
The Standard Normal
Distribution (PDF)
Z
0
2
1
( ) [ / 2]
2
(0,1)
z E z
Z Normal
|
t
=
~
54
Copyrighted by Edmund Malesky. Do not distribute without permission.
Chi-Square Distribution
i
n
2
i=1
Let Z , 1, 2..., be independent random variables, each distributed
standard normal.
= Z
( , 2 )
i
i n
n n
_
_
=
~
f(x)
x
df=2
df=4
df=6
55
Copyrighted by Edmund Malesky. Do not distribute without permission.
t-distribution:
The Statistical Workhorse
0
3 -3
Let have a chi-square distribution
with degrees of freedom.
Z
T=
/
(0, /( 2))
n
n
t n n
_
_
~
df=2
df=4
df=6
As the degrees of
freedom increase, the
t-distribution
approaches the normal
distribution.
56
Copyrighted by Edmund Malesky. Do not distribute without permission.
Quick Review:
Hypothesis Testing
In STATA, the null hypothesis for a two-
tailed t-test is:
H
0:
j
=0
57
Copyrighted by Edmund Malesky. Do not distribute without permission.
Quick Review:
Hypothesis Testing
To test the hypothesis, I need to have a rejection rule. That
is, I will reject the null hypothesis if, t is greater than some
critical value (c).
c is up to me to some extent, I must determine what level of
significance I am willing to accept. For instance, if my t-
value is 1.85 with 40 df and I was willing to reject only at the
5% level, my c would equal 2.021 and I would not reject the
null. On the other hand, if I was willing to reject at the 10%
level, my c would be 1.684, and I would reject the null
hypotheses.
| | t c > =
58
Copyrighted by Edmund Malesky. Do not distribute without permission.
t-distribution:
5 % rejection rule for the that H
0:
j
=0
with 25 degrees of freedom
Rejection Region
Area=.025
Rejection Region
Area=.025
0
Looking at table G-
2, I find the critical
value for a two-
tailed test is 2.06
2.06 -2.06
59
Copyrighted by Edmund Malesky. Do not distribute without permission.
Quick Review:
But this operation hides some very useful
information.
STATA has decided that it is more useful to
provide what is the smallest level of significance
at which the null hypothesis would be rejected.
This is known as the p-value.
In the previous example, we know that
.05<p<.10.
To calculate the p, STATA computes the area
under the probability density function.
60
Copyrighted by Edmund Malesky. Do not distribute without permission.
T-distribution:
Obtaining the p-value against a two-sided
alternative, when t=1.85 and df=40.
P-value=P(|T|>t)
In this case,
P(|T|>1.85)=
2P(T>1.85)=2(.0359)
=.0718
Area=.9282
Rejection Region
Area=.0359
Rejection Region
Area=.0359
0
61
Copyrighted by Edmund Malesky. Do not distribute without permission.
F Distribution
f(x)
x
df=2,8
df=6,8
df=6,20
1
2
1
2
2/
2/
k
k
k
F
k
_
_
=
F and Chi Square
testing involves
only a one-tailed
test of the area
underneath the
right portion of the
curve.
62
Copyrighted by Edmund Malesky. Do not distribute without permission.