Upload
alexis-evans
View
322
Download
7
Tags:
Embed Size (px)
Citation preview
Hypothesis Testing
Judicial Analogy
Hypothesis
Collect Evidence Decision Rule
Significance Level
Hypothesis Testing
• Hypothesis testing
Null hypothesis
• Purpose
Test the viability
• Null hypothesis
Population parameter
Reverse of what the experimenter believes
Hypothesis Testing
1. State the null hypothesis, H0
2. State the alternative hypothesis, HA
3. Choose , our significance level
4. Select a statistical test, and find the observed test statistic
5. Find the critical value of the test statistic ( and p value)
6. Compare the observed test statistic with the critical value,
(or compare the p value with ), and decide to accept or
reject H0
Coin Example
H
HH
T T
Coin Analogy
Hypothesis
Collect Evidence Decision Rule
Significance Level
Types of Errors
You used a decision rule to make a decision, but was the decision correct?
ACTUAL
DECISION Fair Coin Not Fair Coin
Fair Coin correct Type II error
Not Fair Coin Type I error correct
Modified Coin Experiment
Which coins are fair?
6 3 H e a d s3 7 Ta i ls
4 0 H e a d s6 0 Ta i ls
5 5 H e a d s4 5 Ta i ls
1 5 H e a d s8 5 Ta i ls
p -v a lu e = .2 7
p -v a lu e < .0 1 p - v a lu e < .0 1
p - v a lu e = .0 4
Cases in Hypothesis Testing
Means - variance known - variance unknown
Comparison of means - unpaired, variance known - comparison of variances - unpaired, variances unknown but equal - unpaired, variances unknown and unequal - paired
Proportion
Comparison of Proportion
One sample t-test
Statistical Hypothesis Test
H : e q u a l i tyH : d i f fe r e n c e
o
1
Decision Rule
Significance Level
Collect Data
p -v a lu e
p - v a lu e
Set Hypothesis
s e t
R is en
S h in e1 5 o z .
Two-Sided Test of Hypothesis
The test of hypothesis is two-sided if the null
is rejected when the actual value of interest is either less than or greater than the hypothesized value.
H0: 15.00
HA: 15.00
Two-Sided Test of Hypothesis
One-Sided Test of Hypothesis
In many situations, you are only interested in one direction. Perhaps you only want evidence that the mean is significantly lower than fifteen.
For example, instead of testing
H0: = 15 versus H1: 15
you test
H0: 15 versus H1: < 15
One-Sided Test of Hypothesis
The Critical Values of Z to memorize
• Two tailed hypothesis– Reject the null (H0) if z z/2, or z - z/2
• One tailed hypothesis– If HA is > Xbar, then reject H0 if z z
– If HA is < Xbar, then reject H0 if z - z
The Z-test – an example• Suppose that you took a sample of 25 people off
the street in Morgantown and found that their personal income is $24,379
• And you have information that the national average for personal income per capita is $31,632 in 2003.
• Is the Morgantown significantly different from the National Average
• Sources: – (1) Economagic– (2) US Bureau of Economic Analysis
What to conclude?
• Should you conclude that West Virginia is lower than the national average? – Is it significantly lower?– Could it simple be a randomly “bad” sample”
• Assume that it is not a poor sampling technique
• How do you decide?
Example (cont.)• We will hypothesize that WV income is lower than the national
average.– H0: WVInc = USInc (Null Hypothesis)– HA: WVInc < USInc (Alternate Hypothesis)
• Statistician can write by :– H0: $31,632– HA: < $31,632
• Since we know the national average ($31,632) and standard deviation (15000), we can use the z-test to make decide if WV is indeed significantly lower than the nation
Example (cont.)
• Using the z-test, we get
• For = 5% -z = -z0.05 = -1.645
• THE DECISION IS REJECT H0 SO West Virginia is lower than the national average
42.2
25
150003163224379
n
Xz
The t test• When we cannot use the population standard deviation, we must
employ a different statistical test
• Think of it this way:
– The sample standard deviation is biased a little low, but we know that as the sample size gets larger, it becomes closer to the true value.
– As a result, we need a sampling distribution that makes small sample estimates conservative, but gets closer to the normal distribution as the sample size gets larger, and the sample standard deviation more closely resembles the population standard deviation.
The t-test (cont.)
• The t-test is a very similar formula.
• Note the two differences– using s instead of – The resultant is a value that has a t-
distribution instead of a standard normal one.
n
sX
t
The Critical Values of t
• Two tailed hypothesis– Reject the null (H0) if t t/2(n-1), or t - t/2(n-1)
Reject H0 if |t| ≥ t/2(n-1)
• One tailed hypothesis– If HA is > Xbar, then reject H0 if t t(n-1)
– If HA is < Xbar, then reject H0 if t - t(n-1)
Reject H0 if |t| ≥ t(n-1)
T-test example• Suppose we decided to look at Oregon, but do not know the
population standard deviation– And we have a small sample anyway (N=25).
• without an a priori reason to hypothesize higher or lower, use the 2-tailed test
• Assume Oregon has a mean of 29,340, and that we collected a sample of 169.
• Using the t-test, we get
• Critical value = t.025(168) = 1.96 Since |-1.9684| > 1.96• REJECT H0
9864.1
169
150003163229340
1
n
sX
tn
Two sample t-test
Two-Sample t-Tests
Cereal Example
R is en
S h in e
Other Examples
• Is the income of blacks lower than whites?
• Are teachers salaries in West Virginia and Mississippi alike?
• Is there any difference between the background well and the monitoring well of a landfill?
The Difference of means Test
• Frequently we wish to ask questions that compare two groups.– Is the mean of A larger (smaller) than B?– Are As different (or treated differently) than
Bs?– Are A and B from the same population?
• To answer these common types of questions we use the standard two-sample t-test
Assumptions
• independent observations• normally distributed data for each group• equal variances for each group.
C o m pa r in g Tw o P o p u la t io n s
M o r n in g R is e n S h in e
1
2
The Difference of means Test
• The standard two-sample t-test is:
2
22
1
21
21
ns
ns
XXt
The equal Variance test
21
2
21
11nn
s
XXt
t
• If the variances from the two samples are the same we may use a more powerful variation
• Where 2
11
21
222
2112
nn
snsnst
• If the variances from the two samples are the same we may use a more powerful variation
• With degree of freedom:
The unequal Variance test
2
2
22
2
1
21
2
2
22
1
21
11
ns
ns
ns
ns
dbeff
2
22
1
21
21
ns
ns
XXt
Which test to Use?
• In order to choose the appropriate two-sample t-test, we must decide if we think the variances are the same.
• Hence we perform a preliminary statistical test – the equal variance F-test.
The Equal Variance F-test
• One of the fortunate properties on statistics is that the ratio of two variances will have an F distribution.
• Thus with this knowledge, we can perform a simple test.
smaller
erl
nn s
sF
2
arg2
)1,1( 21
F Test for Equality of Variances
F =
H : 2
1
2
21H : = 2
1
2
20
1
2
m in (s , s ) 1
2
2
22m a x (s , s )2
=
Interpretation of F-test• If we find that F > F (n1-1,n2-1) , (P(F) > .05), we
conclude that the variances are unequal.
• If we find that F ≤ F (n1-1,n2-1) , (P(F) ≤ .05), we conclude that the variances are unequal.
• We then select the equal– or unequal-variance t-test accordingly.
Test Statistics and p-Values
F Test for equal variances: H0: 12 = 2
2
Variance Test:
F’ = 1.51 DF = (3,3)
t-Tests for equal means: H0: 1 = 2
Unequal Variance t-test:
T = 7.4017 DF = 5.8
Equal Variance t-test:
T = 7.4017 DF = 6.0
What would we conclude?
PAIRED T-test
Paired Samples
S a le sS a le s
B E F O R E A F T E RA D V E R T IS IN G
Proportion
Large Sample
• H0 : p = p0
HA : p ≠ p0 or HA: p < p0 or HA: p > p0
• Test statistic :
npp
ppz
)1(
ˆ
00
0
Example
• Do you think it shoul or should not be government implementation the law of pornography and pornoaction?
• Let p denote the population proportion of Indonesia adults who believe it should be
• p < .5 minority• p > .5 majority
Continued example
• This data is not real, just for ilustration• Suppose from 1534 adults, 812 believe it should be• H0 : p = .5
HA : p ≠ .5
The critical value for = 5% z.025 = 1.96
The conclusion - Reject H0 majority adults agree if government implementation the law of pornography and pornoaction
297.2
1534)5.1(5.
5.529.
z
Comparison two proportion
Large sample
• H0 : p1 = p2
HA : p1 ≠ p2
• Test statistic :
= x1/n1, = x2/n2, = (x1 + x2)/(n1 + n2)
21
21
11)ˆ1(ˆ
)ˆˆ(
nnpp
ppz
p̂1p̂ 2p̂
Reference• Agresti, A. & Finlay, B. 1997. Statistical Methods for the Social
Sciences 3rd Edition. Prentice Hall.• Mac Gregor. 2006. Lecture 3: Review of Basic Statistics.
McMaster University• PS 601 Notes – Part II
Statistical Tests • SAS Inc• Tang, A. 2004. Lecture 9 Common Statistical Test. Tufts
University