Topic 9 One-Sample Hypothesis Tests INTRODUCTION TO ECONOMIC STATISTICS

Transcription

Topic 9 One-Sample Hypothesis Tests INTRODUCTION TO ECONOMIC STATISTICS
INTRODUCTION TO ECONOMIC STATISTICS
Topic 9
One-Sample
Hypothesis Tests
These slides are copyright © 2010 by Tavis Barr. This work is licensed under a Creative Commons AttributionShareAlike 3.0 Unported License. See http://creativecommons.org/licenses/by-sa/3.0/ for further information.
Hypothesis Testing
●
The purpose of hypothesis testing is to
state the validity of a claim about a
parameter of the population.
–
Is the population mean really, say, 10?
–
Is the population proportion really 25%?
–
Is the population stabdard deviation really 3?
(We won't cover this last test.)
Hypothesis Testing
●
●
●
●
Background and Methodolgy
One-Sample Hypothesis Test for
Population Mean
–
Large Sample
–
Small Sample
One-Sample Hypothesis Test for Pop'n
Proportion (Large Sample Only)
Type I and Type II Errors
Hypothesis Testing
●
●
●
Hypothesis tests must be set up in a
certain order to be done correctly
We have to be careful that our knowledge
about the data does not affect our choice
of hypotheses
Otherwise we can be tempted to choose
hypotheses that we already know are
true or false
Hypothesis testing
The order of a hypothesis test:
1. The null hypothesis (H0) and the alternative hypothesis (H1)
is stated
2. A level of significance is decided on
3. A test statistic is selected
4. A decision rule is selected, usually involving a critical value.
Usually we want to develop a confidence interval for the
population parameter at the critical value.
5. A sample is collected, and the statistic and its critical value is
determined
The Steps of a Hypothesis Test
1.The null hypothesis (H0) and the alternative
hypothesis (H1) is stated
●
The null hypothesis is a statement we want to test
“The population mean is zero”
• “The population proportion is 40 percent”
The alternative hypothesis is what is true when the
null hypothesis is not true
•
●
•
•
“The population mean is not zero”
“The population proportion is not 40 percent”
The Steps of a Hypothesis Test
2. A level of significance is decided on
●
●
●
The level of significance: If we declare the
null hypothesis false, what chance of being
wrong we are willing to allow ourselves?
Rarely can a hypothesis be declared
certainly true or untrue. Rather, it can be
declared likely or unlikely
Larger data sets or less noisy data may
allow us to be more stringent
The Steps of a Hypothesis Test
3. A test statistic is selected
–
A test statistic is a number that describes
how likely our null hypothesis is
–
The test statistic usually follows a common
distribution, such as the Normal or t.
–
The distribution of the test statistic is
independent of sample properties such as
the mean or standard deviation. It may
depend on the number of observations in the
sample.
The Steps of a Hypothesis Test
4.A decision rule is selected, usually
involving a critical value.
●
●
●
Because the test statistic follows a known
distribution, it will be above or below a given
value with a known probability if the null
hypothesis is true
If the value is too large or too small, the null
hypothesis is improbable
How large or small the statistic needs to be
depends on what significance level we chose
The Steps of a Hypothesis Test
5. A sample is collected, and the statistic and its
critical value is determined. A decision is made.
●
●
●
The key point: We have decided on all of the
methodological questions (significance level,
test statistic, etc.) before we look at the data
This way, we know that our familiarity with
the data does not influence our decision
about, say, what significance level to use
Note that we never choose to accept a null
hypothesis, only reject it or not reject it.
Test about a Population Mean
●
●
First, we make a null hypothesis about what the
population mean is. We call this mean (H0)
Then we make a confidence interval based on
the sample mean and make a decision based
on where the hypothesized population mean
lies:
Population Mean Lies:
Outside 90% Interval
Outside 95% Interval
Outside 99% Interval
●
Decision:
Reject at 10% significance level
Reject at 5% significance level
Reject at 1% significance level
But note that we decide on significance level
before looking at data
Test About a Population Mean
●
For large samples, the statistic is:
X− H0 
X− H0 
z=
=
2
Std. Error
s
 /n
●
●
If μ(H0) is the true population mean, then the CLT
says X is Normal with mean μ(H0) and standard
deviation √s2/n
So if the null hypothesis
is true, then z follows
the standard normal
distribution
P(-1.65<z<1.65) =0.9
-2
-1
0
1
f(z)
z
2
Test About a Population Mean
For large samples, the statistic is:
z=
X− H0 
Std. Error
=
X− H0 
2
s
 /n
z is:
Less than -1.645
More than 1.645
(H0) is:
More than X+1.645xSE
Less than X -1.645xSE
Hypothesized mean is:
Above 90% Conf. Int.
Below 90% Conf. Int.
Reject at 10 percent
Less than -1.96
More than 1.96
More than X+1.96xSE
Less than X -1.96xSE
Below 95% Conf. Int.
Above 95% Conf. Int.
Reject at 5 percent
Less than -2.576
More than 2.576
More than X+2.576xSE
Less than X -2.576xSE
Below 99% Conf. Int.
Above 99% Conf. Int.
Reject at 1 percent
Test About a Population Mean
For large samples, the statistic is:
z=
X− H0 
Std. Error
=
X− H0 
s
2
/n
-1.645 < z < 1.645: Do not reject
1.645 < |z| < 1.96: Reject at 10%
1.96 < |z| < 2.576: Reject at 5%
2.576 < |z|: Reject at 1%
-3
-2
-1
0
1
2
3
Test of Popn' Mean – Example
●
According to a survey of 7,615 clients of the Maine
Addiction Treatment System from 1990-1995, the
average income of a client of a client is $928.30
per month, with a standard deviation of $875.80
per month.
Source: http://www.bu.edu/econ/faculty/ma/Papers_Archive/interaction_JHE_March2004.pdf
●
●
The federal poverty line in 1995 for a household of
two was $863.33 per month
Can we reject the hypothesis, at the 5 percent
level, that the average income of a client was equal
to the poverty line for a household of two?
Test of Popn' Mean Example 2
●
●
●
●
One hundred people in some middle-income
country have their red blood cell count taken.
The sample mean is 4.8 million cells per
milliliter, and the sample standard deviation is
1.5 million cells/ml.
Five million cells per milliliter is considered a
healthy count.
At a 5% significance level, can we reject the
hypothesis that the blood cell count in this
country is too low?
Test of Popn' Mean Example 3
●
●
●
●
A company claims its cell phones emit 1.2 W/kg
of radiation.
A Consumer Reports engineer wants to test
this claim and measures radiation from a
sample of 300 phones.
The sample mean is 1.33 W/kg, and the sample
standard deviation is 0.25 W/kg.
At a 5% significance level, can we reject the
company's claim that the phones emit 1.2
W/kg?
Means Test with Small Sample
●
z test makes use of Central Limit Theorem
●
CLT only applies to samples over 30
●
With small sample, we can use t statistic
●
●
t statistic only works when original variable
follows the Normal distribution
We compute the t statistic exactly like the z:
X− H0 
X−H 0 
t=
=
2
Std. Error
s
 /n
Means Test with Small Sample
●
We compute the t statistic exactly like the z:
X− H0 
X−H 0 
t=
=
2
Std. Error
s
 /n
●
●
z statistic follows a standard normal distribution;
t statistic follows a t distribution with n-1
degrees of freedom
This means unlike the z statistic, whose critical
values are always the same (1.645, 1.96,
2.576), those of the t statistic depend on the
sample size
Means Test with Small Sample
●
t =[ X −H 0 ]/ Std. Err.
=[ X −H 0 ]/  s / n
2
●
●
●
t statistic follows a t
distribution with n-1
degrees of freedom
Critical values
depend on the
sample size
Use two-tailed test
Confidence Intervals
80%
90%
95%
Level of Significance for One-Tailed Test
df
0.100 0.050 0.025
Level of Significance for Two-Tailed Test
0.20
0.10
0.05
1
3.08
6.31
12.71
2
1.89
2.920
4.3
3
1.64
2.35
3.18
4
1.53
2.13
2.78
5
1.48
2.02
2.57
98%
99%
99.9%
0.010
0.005
0.0005
0.02
31.82
6.97
4.54
3.75
3.37
0.01
0.001
63.657 636.619
9.925 31.599
5.841 12.924
4.604 8.610
4.032 6.869
6
7
8
9
10
1.440
1.42
1.4
1.38
1.37
1.943
1.895
1.860
1.833
1.812
2.45
2.37
2.31
2.26
2.23
3.14
3
2.87
2.82
2.76
3.707
3.499
3.355
3.250
3.169
5.959
5.408
5.041
4.781
4.587
11
12
13
14
1.36
1.36
1.350
1.35
1.796
1.782
1.771
1.761
2.2
2.18
2.160
2.15
2.72
2.68
2.650
2.62
3.106
3.055
3.012
2.977
4.437
4.318
4.221
4.140
t Test Example
●
●
●
The SAT has a mean score of 1,000
nationally.
We look at a sample of 6 students from a
school and want to know if they score
above or below average
Scores are: 1020, 970, 820, 740, 850,
930.
t Test Example
●
Scores are: 1020, 970, 820, 740, 850, 930.
●
First step: Find sample mean and variance.
X:
1020970820740850930
=888.33
6
2
2
2
1020−888.33  970−888.33  820−888.33 
2
2
2
2 740−888.33 850−888.33 930−888.3
 :
5
17336.116669.4444669.44422002.781469.4441736.111
=
5
=10776.67
t Test Example
●
●
●
●
●
Sample mean: 888.33
Sample variance:
10776.67
H0:  = 1000
6 observations, so 5
d.o.f.
t =[ X −H 0]/Std. Err.
=[ X −H0 ]/  s /n
=888.33−1000/  10776.67/6
=−111.67/42.38=−2.63
Confidence Intervals
80%
90%
95%
Level of Significance for One-Tailed Test
df
0.100 0.050 0.025
Level of Significance for Two-Tailed Test
0.20
0.10
0.05
1
3.08
6.31
12.71
2
1.89
2.920
4.3
3
1.64
2.35
3.18
4
1.53
2.13
2.78
5
1.48
2.02
2.57
98%
99%
99.9%
0.010
0.005
0.0005
0.02
31.82
6.97
4.54
3.75
3.37
0.01
0.001
63.657 636.619
9.925 31.599
5.841 12.924
4.604 8.610
4.032 6.869
6
7
8
9
10
1.440
1.42
1.4
1.38
1.37
1.943
1.895
1.860
1.833
1.812
2.45
2.37
2.31
2.26
2.23
3.14
3
2.87
2.82
2.76
3.707
3.499
3.355
3.250
3.169
5.959
5.408
5.041
4.781
4.587
11
12
13
14
1.36
1.36
1.350
1.35
1.796
1.782
1.771
1.761
2.2
2.18
2.160
2.15
2.72
2.68
2.650
2.62
3.106
3.055
3.012
2.977
4.437
4.318
4.221
4.140
2
Another t Test Example
●
The average January temperature in New
York in the 1990s was:
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
35.5
29.2
30.2
30.9
20.4
32.5
25.7
27.6
35.6
29.7
Source: http://www.ncdc.noaa.gov/oa/climate/research/cag3/Y8.html
●
Can we reject at the 10% level the
hypothesis that the average temperature
is 32 degrees?
Another t Test Example
●
●
The average January temperature in New
York in the 1990s was:
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
35.5
29.2
30.2
30.9
20.4
32.5
25.7
27.6
35.6
29.7
Can we reject at the 10% level the hypothesis
that the average temperature is 32 degrees?
–
First, calculate the sample mean and
variance:
X: 29.73 s2: 20.57
Another t Test Example
●
Sample mean: 29.73
●
Sample variance: 20.57
●
H0:  = 32
●
df=?
●
t=?
Confidence Intervals
80%
90%
95%
Level of Significance for One-Tailed Test
df
0.100 0.050 0.025
Level of Significance for Two-Tailed Test
0.20
0.10
0.05
1
3.08
6.31
12.71
2
1.89
2.920
4.3
3
1.64
2.35
3.18
4
1.53
2.13
2.78
5
1.48
2.02
2.57
98%
99%
99.9%
0.010
0.005
0.0005
0.02
31.82
6.97
4.54
3.75
3.37
0.01
0.001
63.657 636.619
9.925 31.599
5.841 12.924
4.604 8.610
4.032 6.869
6
7
8
9
10
1.440
1.42
1.4
1.38
1.37
1.943
1.895
1.860
1.833
1.812
2.45
2.37
2.31
2.26
2.23
3.14
3
2.87
2.82
2.76
3.707
3.499
3.355
3.250
3.169
5.959
5.408
5.041
4.781
4.587
11
12
13
14
1.36
1.36
1.350
1.35
1.796
1.782
1.771
1.761
2.2
2.18
2.160
2.15
2.72
2.68
2.650
2.62
3.106
3.055
3.012
2.977
4.437
4.318
4.221
4.140
Hypothesis Test for
Population Proportion
●
●
●
●
In a large enough sample, sample proportion
is normally distributed
Expected value is population proportion (p);
standard error is √p(1-p)/n
We write population proportion as , so
hypothesized proportion is written (H0)
If null hypothesis is true, and proportion is
really (H0), then standard error is
 H 0 1−H 0 / n
Hypothesis Test for
Population Proportion
●
If null hypothesis is true, sample
proportion is normally distributed with
mean (H0) and standard error
 H 0 1−H 0 / n
●
That means that the following statistic will
be standard normally distributed:
z=
p−H 0 
 H 0 1− H0 / n
Hypothesis Test for
Proportion – Example
●
According to a June, 2007 Gallup poll of
1,007 U.S. adults, 53% of Americans
believe that the theory of evolution is
definitely or probably true.
http://www.usatoday.com/news/politics/2007-06-07-evolution-poll-results_n.htm
●
At the five percent significance level, can
we reject the possibility that half of U.S.
adults believe that evolution is definitely
or probably true?
Hypothesis Test for
Proportion – Example 2
●
●
●
●
●
Insurance fraud rate in New York is about 6%
The director of insurance investigations in
Nassau County wants to figure out if fraud rate
is above or below state average
Conducts an intensive review of 500 cases
Finds that in his sample, 40 cases are
fraudulent
Can we reject the hypothesis, at the 10% level,
that Nassau County has an average fraud rate?
Hypothesis Test for
Proportion – Another Example
●
On January 4, 2003, Slashdot readers were
asked who they thought were the dumbest people
in Los Angeles. Their responses:
CyberCafeGang Violence Kids
City Councilmen demanding cybercafe security
The LAPD Who Want To Crack Down on CyberCafes
The MPAA
CowboyNeal hasn't been to LA
TOTAL
●
1619
468
1047
6175
1328
10637
Can we reject the hypothesis that half of Slashdot
readers think the MPAA are the dumbest people
in LA at the 1% significance level?
Type I and Type II Errors
●
●
Conclusions from statstistical tests are
not made with certainty
We may make a mistake, either rejecting
a hypothesis that is actually true, or not
rejecting a hypothesis that is actually
false
Type I Error
●
●
A Type I Error occurs when we reject a
null hypothesis that is actually true
The probability of doing this, known as ,
is just the significance level of the test:
5% test:
P(|z|>1.96) = 0.05
P[(-1.96(SE)
<X
< -1.96(SE)]
=0.95
2.5% Prob.
X

2.5% Prob.
z
Type II Error
●
●
A Type II Error occurs when we fail to reject a
null hypothesis that is actually false
The probability of this, known as , depends on
the alternative hypothesis
Critical values
under H0
Probability of
observing a value in
non-rejection range if
H1 is actually true

(H0)
(H1)
z