Upload
savabien
View
227
Download
0
Embed Size (px)
Citation preview
8/2/2019 Lecture 1 Review of Statistics
1/67
1
ECON 107
Introductory Econometrics
Summer 2011
8/2/2019 Lecture 1 Review of Statistics
2/67
2
Brief Overview of the Course
Economics suggests important relationships, often with policy
implications, but virtually never suggests quantitative
magnitudes of causal effects.
What is the quantitative effect of reducing class size onstudent achievement?
How does another year of education change earnings?What is the price elasticity of cigarettes?What is the effect on output growth of a 1 percentage
point increase in interest rates by the Fed?
What is the effect on housing prices of environmentalimprovements?
8/2/2019 Lecture 1 Review of Statistics
3/67
3
This course is about using data to measure causal effects.
Ideally, we would like an experimentowhat would be an experiment to estimate the effect of
class size on standardized test scores?
But almost always we only have observational(nonexperimental) data.
oreturns to educationocigarette pricesomonetary policy
8/2/2019 Lecture 1 Review of Statistics
4/67
4
In this course you will:
Learn methods for estimating causal effects usingobservational data
Focus on applicationstheory is used only as needed tounderstand the whys of the methods;
Learn to evaluate the regression analysis of othersthismeans you will be able to read/understand empirical
economics papers in other econ courses;
Get some hands-on experience with regression analysis inyour problem sets.
8/2/2019 Lecture 1 Review of Statistics
5/67
5
Review of Statistical Theory
1. The probability framework for statistical inference2. Estimation3. Testing4. Confidence Intervals
8/2/2019 Lecture 1 Review of Statistics
6/67
8/2/2019 Lecture 1 Review of Statistics
7/67
8/2/2019 Lecture 1 Review of Statistics
8/67
8
Population distribution of Y
The probabilities of different values ofYthat occur in thepopulation, for ex. Pr[Y= 650] (when Yis discrete)
or: The probabilities of sets of these values, for ex. Pr[640Y 660] (when Yis continuous).
8/2/2019 Lecture 1 Review of Statistics
9/67
9
(b) Moments of a population distribution: mean, variance,
standard deviation, covariance, correlation
mean = expected value (expectation) ofY
=E(Y)
= Y
= long-run average value ofYover repeated
realizations ofY
variance =E(YY)2
= 2Y
= measure of the squared spread of thedistribution
standard deviation = variance = Y
8/2/2019 Lecture 1 Review of Statistics
10/67
10
Moments, ctd.
skewness =
3
3
Y
Y
E Y
= measure of asymmetry of a distribution
skewness = 0: distribution is symmetricskewness > ( 3: heavy tails (leptokurtic)
8/2/2019 Lecture 1 Review of Statistics
11/67
11
8/2/2019 Lecture 1 Review of Statistics
12/67
12
Two random variables:joint distributions and covariance
Random variablesXandZhave ajoint distributionThecovariance betweenXandZis
cov(X,Z) =E[(XX)(ZZ)] = XZ
The covariance is a measure of the linear associationbetweenXandZ; its units are units ofX units ofZ
cov(X,Z) > 0 means a positive relation betweenXandZIfXandZare independently distributed, then cov(X,Z) = 0
(but not vice versa!!)
The covariance of a r.v. with itself is its variance:cov(X,X) =E[(XX)(XX)] =E[(XX)
2] = 2X
8/2/2019 Lecture 1 Review of Statistics
13/67
13
The covariance between Test Score and STR is negative:
so is thecorrelation
8/2/2019 Lecture 1 Review of Statistics
14/67
14
Thecorrelation coefficient is defined in terms of the
covariance:
corr(X,Z) = cov( , )
var( ) var( )
XZ
X Z
X Z
X Z
= rXZ
1 corr(X,Z) 1corr(X,Z) = 1 mean perfect positive linear associationcorr(X,Z) =1 means perfect negative linear associationcorr(X,Z) = 0 means no linear association
8/2/2019 Lecture 1 Review of Statistics
15/67
15
Thecorrelation coefficient measures linear association
8/2/2019 Lecture 1 Review of Statistics
16/67
16
(c) Conditional distributions and conditional means
Conditional distributions
The distribution ofY, given value(s) of some otherrandom variable,X
Ex: the distribution of test scores, given that STR < 20Conditional expectations and conditional moments
conditional mean = mean of conditional distribution=E(Y|X=x) (important concept and notation)
conditional variance = variance of conditional distributionExample: E(Test scores|STR < 20) = the mean of test
scores among districts with small class sizes
The difference in means is the difference between the means
of two conditional distributions:
8/2/2019 Lecture 1 Review of Statistics
17/67
17
Conditional mean, ctd.
=E(Test scores|STR < 20)E(Test scores|STR 20)
Other examples of conditional means:
Wages of all female workers (Y= wages,X= gender)Mortality rate of those given an experimental treatment (Y
= live/die;X= treated/not treated)
IfE(X|Z) = const, then cov(X,Z) = 0 (not necessarily viceversa however)
The conditional mean is a term for the familiar idea of thegroup mean
8/2/2019 Lecture 1 Review of Statistics
18/67
18
(d) Distribution of a sample of data drawn randomly
from a population: Y1,, Yn
We will assume simple random sampling
Choose an individual (district, entity) at random from thepopulation
Not using the stratified sampling or cluster sampling.Randomness and data
Prior to sample selection, the value ofYis randombecause the individual selected is random
Once the individual is selected and the value ofYisobserved, then Yis just a numbernot random
The data set is (Y1, Y2,, Yn), where Yi = value ofYfor theith
individual (district, entity) sampled
8/2/2019 Lecture 1 Review of Statistics
19/67
19
Distribution of Y1,, Ynunder simple random sampling
Because individuals #1 and #2 are selected at random, thevalue ofY1 has no information content for Y2. Thus:
oY1 and Y2 are independently distributedoY1 and Y2 come from the same distribution, that is, Y1,
Y2 are identically distributed
oThat is, under simple random sampling, Y1 and Y2 areindependently and identically distributed (i.i.d.).
oMore generally, under simple random sampling, {Yi}, i= 1,, n, are i.i.d.
This framework allows rigorous statistical inferences about
moments of population distributions using a sample of data
from that population
8/2/2019 Lecture 1 Review of Statistics
20/67
20
Estimation
Y is the natural estimator of the mean. But:
(a)What are the properties ofY?(b)Why should we use Y rather than some other estimator?
Y1 (the first observation)maybe unequal weightsnot simple averagemedian(Y1, Yn)12
(min
Y +max
Y )
8/2/2019 Lecture 1 Review of Statistics
21/67
21
(a) The sampling distribution ofY
Y is a random variable, and its properties are determined by
thesampling distribution ofY
The individuals in the sample are drawn at random.Thus the values of (Y1,, Yn) are randomThus functions of (Y1,, Yn), such as Y , are random: had
a different sample been drawn, they would have taken ona different value
The distribution ofY over different possible samples ofsize n is called thesampling distribution ofY .
The mean and variance ofY are the mean and variance ofits sampling distribution, E(Y) and var(Y).
8/2/2019 Lecture 1 Review of Statistics
22/67
22
The concept of the sampling distribution underpins all ofeconometrics.
8/2/2019 Lecture 1 Review of Statistics
23/67
23
The sampling distribution ofY, ctd.
Example: Suppose Ytakes on 0 or 1 (aBernoulli random
variable) with the probability distribution,
Pr[Y= 0] = .22, Pr(Y=1) = .78
Then
E(Y) =p1 + (1p)0 =p = .782
Y
=E[YE(Y)]2
=p(1p) [remember this?]
= .78(1.78) = 0.1716
The sampling distribution ofY depends on n.
Consider n = 2. The sampling distribution ofY is,
Pr(Y = 0) = .222
= .0484
Pr(Y = ) = 2.78 .22= .3432
Pr(Y = 1) = .782
= .6084
8/2/2019 Lecture 1 Review of Statistics
24/67
24
The sampling distribution ofY when Yis Bernoulli (p = .78)
8/2/2019 Lecture 1 Review of Statistics
25/67
25
Things we want to know about the sampling distribution:
What is the mean ofY?oIfE(Y) = true = .78, then Y is an unbiasedestimator
of
What is the variance ofY?oHow does var(Y) depend on n (famous 1/n formula)
Does Y become close to when n is large?oLaw of large numbers: Y is aconsistent estimator of
Y appears bell shaped for nlargeis this generallytrue?
oIn fact, Y is approximately normally distributedfor n large (Central Limit Theorem)
8/2/2019 Lecture 1 Review of Statistics
26/67
26
The mean and variance of the sampling distribution ofY
General casethat is, for Yi i.i.d. from any distribution, not
just Bernoulli:
mean: E(Y) =E(1
1 n
i
i
Yn
) =1
1( )
n
i
i
E Yn
=1
1 n
Y
in
= Y
Variance: var(Y) =E[Y E(Y)]2
=E[Y Y]2
=E
2
1
1 n
i Y
i
Yn
=E
2
1
1( )
n
i Y
i
Yn
8/2/2019 Lecture 1 Review of Statistics
27/67
27
so var(Y) =E
2
1
1( )
n
i Y
i
Yn
=1 1
1 1( ) ( )
n n
i Y j Y
i j E Y Y n n
=2
1 1
1( )( )
n n
i Y j Y
i j
E Y Y n
=2
1 1
1cov( , )
n n
i j
i j
Y Yn
= 22
1
1 n
Y
i
n
=2
Y
n
8/2/2019 Lecture 1 Review of Statistics
28/67
28
Mean and variance of sampling distribution ofY, ctd.
E(Y) = Y
var(Y) =2
Y
n
Implications:
1. Y is an unbiasedestimator ofY(that is,E(Y) = Y)2. var(Y) is inversely proportional to n
the spread of the sampling distribution isproportional to 1/ n
8/2/2019 Lecture 1 Review of Statistics
29/67
29
Thus the sampling uncertainty associated with Y isproportional to 1/ n (larger samples, less
uncertainty, but square-root law)
8/2/2019 Lecture 1 Review of Statistics
30/67
30
The sampling distribution ofY whenn is large
For small sample sizes, the distribution ofY is complicated,
but ifn is large, the sampling distribution is simple!
1. As n increases, the distribution ofY becomes more tightlycentered around Y(theLaw of Large Numbers)
2. Moreover, the distribution ofYYbecomes normal (theCentral Limit Theorem)
8/2/2019 Lecture 1 Review of Statistics
31/67
31
TheLaw of Large Numbers:
An estimator isconsistent if the probability that its falls
within an interval of the true population value tends to one
as the sample size increases.
If (Y1,,Yn) are i.i.d. and2
Y
8/2/2019 Lecture 1 Review of Statistics
32/67
32
The Central Limit Theorem (CLT):
If (Y1,,Yn) are i.i.d. and 0 )
H0:E(Y) = Y,0 vs.H1:E(Y) < Y,0 (1-sided,
8/2/2019 Lecture 1 Review of Statistics
40/67
40
Some terminology for testing statistical hypotheses:
p-value= probability of drawing a statistic (e.g. Y) at least as
adverse to the null as the value actually computed with your
data, assuming that the null hypothesis is true.
= probability of rejecting the null hypothesis when it is true.
Thesignificance levelof a test is a pre-specified probability
of incorrectly rejecting the null, when the null is true.
Calculating the p-value based on Y :
p-value =0 ,0 ,0
Pr [| | | |]act H Y Y
Y Y
h actY i th l f Y t ll b d ( d )
8/2/2019 Lecture 1 Review of Statistics
41/67
41
where actY is the value ofY actually observed (nonrandom)
Calculating the p value ctd
8/2/2019 Lecture 1 Review of Statistics
42/67
42
Calculating the p-value, ctd.
To compute thep-value, you need to know the samplingdistribution ofY , which is complicated ifn is small.
Ifn is large, you can use the normal approximation (CLT):p-value =
0 ,0 ,0Pr [| | | |]act
H Y Y Y Y ,
=0
,0 ,0Pr [| | | |]/ /
act
Y YH
Y Y
Y Yn n
=0
,0 ,0Pr [| | | |]
act
Y Y
H
Y Y
Y Y
probability under left+rightN(0,1) tails
whereY
= std. dev. of the distribution ofY = Y/ n .
C l l ti th l ith k
8/2/2019 Lecture 1 Review of Statistics
43/67
43
Calculating the p-value with Yknown:
For large n,p-value = the probability that aN(0,1) randomvariable falls outside |( actY Y,0)/ Y |
In practice,Y
is unknownit must be estimated
Estimator of the variance of Y:
8/2/2019 Lecture 1 Review of Statistics
44/67
44
Estimator of the variance of Y:
2
Ys = 2
1
1( )
1
n
i
i
Y Y
n
= sample variance ofY
Fact:
If (Y1,,Yn) are i.i.d. andE(Y4)
8/2/2019 Lecture 1 Review of Statistics
45/67
45
Computing the p-value with Y estimated:
p-value =0 ,0 ,0
Pr [| | | |]act H Y Y
Y Y ,
=0
,0 ,0Pr [| | | |]
/ /
act
Y Y
H
Y Y
Y Y
n n
0
,0 ,0Pr [| | | |]
/ /
act
Y Y
H
Y Y
Y Y
s n s n
(large n)
so
p-value =0
Pr [| | | |]actH t t (2
Y estimated)
probability under normal tails outside |tact
|
where t=,0
/
Y
Y
Y
s n
(the usual t-statistic)
What is the link between the p value and the significance
8/2/2019 Lecture 1 Review of Statistics
46/67
46
What is the link between thep-value and the significance
level?
The significance level is prespecified. For example, if theprespecified significance level is =5%,
you reject the null hypothesis if |t| 1.96equivalently, you reject ifp (= 0.05).Often, it is better to communicate thep-value than simply
whether a test rejects or notthep-value contains more
information than the yes/no statement about whether the
test rejects.
At this point you might be wondering
8/2/2019 Lecture 1 Review of Statistics
47/67
47
At this point, you might be wondering, ...
What happened to thet-table and the degrees of freedom?
Digression: the Studentt distributionIfYi, i = 1,, n is i.i.d.N(Y,
2
Y ), then the t-statistic has the
Student t-distribution with n1 degrees of freedom.
The critical values of the Student t-distribution is tabulated in
the back of all statistics books. Remember the recipe?
1. Compute the t-statistic2. Compute the degrees of freedom, which is n13.
Look up the 5% critical value
4. If the t-statistic exceeds (in absolute value) thiscritical value, reject the null hypothesis.
Comments on this recipe and the Student t-distribution
8/2/2019 Lecture 1 Review of Statistics
48/67
48
Comments on this recipe and the Studentt-distribution
1. If the sample size is moderate (several dozen) or large(hundreds or more), the difference between the t-
distribution and N(0,1) critical values are negligible. Hereare some 5% critical values for 2-sided tests:
degrees of freedom
(n1)
5% t-distribution
critical value
10 2.23
20 2.09
30 2.04
60 2.00
1.96
Comments on Student t distribution ctd
8/2/2019 Lecture 1 Review of Statistics
49/67
49
Comments on Student t distribution, ctd.
2. So, the Student-tdistribution is only relevant when thesample size is very small; but even in that case, for it to becorrect, you must be sure that the population distribution of
Yis normal. In economic data, the normality assumption is
rarely credible. Here are the distributions of some
economic data.
Do you think earnings are normally distributed?
8/2/2019 Lecture 1 Review of Statistics
50/67
50
Comments on Student t distribution ctd
8/2/2019 Lecture 1 Review of Statistics
51/67
51
Comments on Student t distribution, ctd.
3. [You might not know this.] Consider the t-statistic testingthe hypothesis that two means (groups s, l) are equal:
2 2 ( )s ls l
s l s l
s ss l
n n
Y Y Y Y tSE Y Y
Even if the population distribution ofYin the two groups
is normal, this statistic doesnt have a Student tdistribution!
There is a statistic testing this hypothesis that has a
normal distribution, the pooled variance t-statisticsee
SW (Section 3.6)however the pooled variance t-statistic
is only valid if the variances of the normal distributions
are the same in the two groups Would you expect this to
8/2/2019 Lecture 1 Review of Statistics
52/67
52
are the same in the two groups. Would you expect this to
be true, say, for mens vs. womens wages?
The Student-t distribution summary
8/2/2019 Lecture 1 Review of Statistics
53/67
53
The Student t distribution summary
The assumption that Yis distributedN(Y, 2Y ) is rarelyplausible in practice (Income? Test score?)
For n > 30, the t-distribution andN(0,1) are very close (asn grows large, the tn1 distribution converges toN(0,1))
The t-distribution is an artifact from days when samplesizes were small and computers were people
For historical reasons, statistical software typically usesthe t-distribution to computep-valuesbut this is
irrelevant when the sample size is moderate or large.For these reasons, in this class we will focus on the large-
n approximation given by the CLT
Confidence Intervals
8/2/2019 Lecture 1 Review of Statistics
54/67
54
Confidence Intervals
A 95%confidence intervalfor Y is an interval that contains
the true value ofY in 95% of repeated samples.
Digression: What is random here? The values ofY1,,Yn and
thus any functions of themincluding the confidence
interval. The confidence interval it will differ from one
sample to the next. The population parameter, Y, is not
random, we just dont know it.
8/2/2019 Lecture 1 Review of Statistics
55/67
Summary:
8/2/2019 Lecture 1 Review of Statistics
56/67
56
Summary:
From the two assumptions of:
(1) simple random sampling of a population, that is,{Yi, i=1,,n} are i.i.d.
(2) 0
8/2/2019 Lecture 1 Review of Statistics
57/67
57
Empirical problem: Class size and educational output
Policy question: What is the effect on test scores (or someother outcome measure) of reducing class size by one
student per class? By 8 students/class?
The California Test Score Data Set
8/2/2019 Lecture 1 Review of Statistics
58/67
58
Ca a S a a S
All K-6 and K-8 California school districts (n = 420)
Variables:
5th grade test scores (Stanford-9 achievement test,combined math and reading), district average
Student-teacher ratio (STR) = no. of students in thedistrict divided by no. full-time equivalent teachers
Initial look at the data:
8/2/2019 Lecture 1 Review of Statistics
59/67
59
(You should already know how to interpret this table)
This table doesnt tell us anything about the relationship
between test scores and the STR.
Do districts with smaller classes have higher test scores?
8/2/2019 Lecture 1 Review of Statistics
60/67
60
g
Scatterplot of test score v. student-teacher ratio
What does this figure show?
We need to get some numerical evidence on whether districts
8/2/2019 Lecture 1 Review of Statistics
61/67
61
g
with low STRs have higher test scoresbut how?
1. Compare average test scores in districts with low STRsto those with high STRs (estimation)
2. Test the null hypothesis that the mean test scores inthe two types of districts are the same, against the
alternative hypothesis that they differ (hypothesis
testing)
3. Estimate an interval for the difference in the mean testscores, high v. low STR districts (confidence
interval)
Initial data analysis: Compare districts with small (STR
8/2/2019 Lecture 1 Review of Statistics
62/67
62
y p (
20) and large (STR 20) class sizes:
ClassSize
Average score( j
iY )
Standarddeviation (sY)
n
Small 657.4 19.41
n 238
Large 650.0 17.9 182
1. Estimation of = difference between group means2. Test the hypothesis that = 03. Construct aconfidence intervalfor
1. Estimation
8/2/2019 Lecture 1 Review of Statistics
63/67
63
1 2Y Y =small
1small
1n
i
i
Yn
large
1large
1n
i
i
Yn
= 657.4650.0
= 7.4
Is this a large difference in a real-world sense?
Standard deviation across districts = 19.1Difference between 60th and 75th percentiles of test score
distribution is 667.6659.4 = 8.2
This is a big enough difference to be important for schoolreform discussions, for parents, or for a school
committee?
2. Hypothesis testing
8/2/2019 Lecture 1 Review of Statistics
64/67
64
yp g
Difference-in-means test: compute the t-statistic,
2 2 ( )s ls l
s l s l
s ss l
n n
Y Y Y Y t
SE Y Y
(remember this?)
where SE( sY lY) is the standard error of sY lY , the
subscripts s and lrefer to small and large STR districts,
and 2 2
1
1( )
1
sn
s i sis
s Y Yn
(etc.)
Compute the difference-of-means t-statistic:
8/2/2019 Lecture 1 Review of Statistics
65/67
65
Size Y sY n
small 657.4 19.4 238large 650.0 17.9 182
2 2 2 219.4 17.9
238 182
657.4 650.0 7.4
1.83s ls l
s l
s s
n n
Y Y
t
= 4.05
|t| > 1.96, so reject (at the 5% significance level) the null
hypothesis that the two means are the same.
3. Confidence interval
8/2/2019 Lecture 1 Review of Statistics
66/67
66
A 95% confidence interval for the difference between the
means is,
(s
Y l
Y) 1.96SE(s
Y l
Y)
= 7.4 1.961.83 = (3.8, 11.0)
Two equivalent statements:
1. The 95% confidence interval for doesnt include 0;2. The hypothesis that = 0 is rejected at the 5% level.
8/2/2019 Lecture 1 Review of Statistics
67/67
67
What is the effect on students standardized test scores ofa percentage increase in Student-teacher ratio?
To answer the above question, you will learn regression
analysis in the coming classes.