Download Introduction to Hypothesis Testing One-sample test for

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Sufficient statistic wikipedia , lookup

Bootstrapping (statistics) wikipedia , lookup

Psychometrics wikipedia , lookup

Confidence interval wikipedia , lookup

Foundations of statistics wikipedia , lookup

Statistical hypothesis testing wikipedia , lookup

Misuse of statistics wikipedia , lookup

Resampling (statistics) wikipedia , lookup

Student's t-test wikipedia , lookup

Transcript
Introduction to Hypothesis Testing
Introduction to Hypothesis Testing
Scientific Method
1. State a research hypothesis or pose a question.
2. Gather data or evidence (observational or experimental) to answer the question.
3. Summarize data and test the hypothesis.
4. Draw a conclusion.
Statistical Hypothesis
• Null hypothesis (H0): Hypothesis of no difference or no relation (or not guilty) and often has
=, ≥, or ≤ notation in the mathematical statement of the hypothesis. A theory about the values
of one (or more) population parameter(s). The theory generally represents the status quo,
which we accept until it is proven false.
Example: H0: µ = 98.6F (average body temperature is 98.6)
• Alternative hypothesis (Ha): Usually corresponds to research hypothesis and opposite to
null hypothesis, (or guilty) and has >, < or ≠ notation in the mathematical statement of the
hypothesis. We accept this hypothesis only when sufficient evidence exists to support it.
Example: Ha: µ < 98.6F (average body temperature is less than 98.6)
Logic behind the hypothesis testing: The jury trial of an accused murderer is analogous to the
statistical hypothesis process. The null hypothesis in a jury trial is that the accused is innocent.
The status quo hypothesis in the US system of justice is that the accused is innocence, which is
assumed to be true until proven beyond reasonable doubt. In testing statistical hypothesis, the
null hypothesis is first assumed to be true. We collect evidence to see if it is strong enough to
reject the null hypothesis and, therefore, support the alternative hypothesis. It can be done by
using our knowledge of the sampling distribution of the test statistic based the assumption that
the null hypothesis is true, and then use the observed value of the test statistic to see whether it
is extreme enough (too far away from mean under null hypothesis) to reject null hypothesis.
Test Statistic: A sample statistic used to decide whether to reject the null hypothesis.
Steps in hypothesis testing
1. State hypotheses. H0 and Ha.
2. Choose a proper test statistic, collect data and compute the value of the statistic. This
includes checking the assumption about the sampled population and the sampling procedure.
3. Make decision rule based on level of significance. Do we reject or fail to reject null
hypothesis?
4. Draw conclusion.
One-sample test for population mean with known variance σ 2.
One wishes to test whether the average body temperature for healthy adults at a regular
environment is less than 98.6 F or not. Assume body temperature for healthy adults under regular
environment has a normal distribution with a standard deviation of 0.4 F. A random sample of
16 is chosen with a mean 98.32F. What does this say about the hypothesis that the average
body temperature for healthy adults at normal environment is less than 98.6 F? Test the
hypothesis at a level of significance 0.05.
One-sided Test
(1. State hypothesis)
H0: µ = 98.6 (or µ ≥ 98.6)
Ha: µ < 98.6
What will be the key statistic that you would use for this situation?
How should we decide whether the evidence is convincing enough?
If null hypothesis is true, what is the sampling distribution of the mean?
A. Chang
1
Introduction to Hypothesis Testing
(2. Choose a test, collect data and compute statistic)
From previous chapter, we know that the sampling distribution of the mean of a random sample
of size 16 sampled from a normal population is normal. If the null hypothesis is true, the mean of
the sampling distribution is 98.6 and the standard error is 0.4/4. “4” in the denominator is square
root of sample size, 16. If the null hypothesis, H0: µ = 98.6, is true, how far is the statistic
98.32 from 98.6 in terms of standard score (or z-score)?
Test Statistic :
z=
x − µ 0 x − µ0 98.32 − 98. 6 − 0. 28
=
=
=
= − 2.8
σ
0.4
σx
0.1
n
16
This implies that the statistic is 2.8 standard deviations away from the mean 98.6 in H0.
Is it extreme enough to convince us that the average body temperature is less than 98.6?
Is it likely to occur if the null hypothesis is true?
What is the probability that the sample mean is less than or equal to 98.32 under null hypothesis?
p-value = P (Z ≤ −2. 8) = 0.003
(area to the left of –2.8)
Sampling distribution Under H0
x
98.32
98.6
Standardized distribution
Z
-2.8
0
(3. Define decision rule)
p-value approach: Compare p-value with the predetermined significance level α. If this
probability (p-value) is less than α=0.05, then we reject the null hypothesis. (The smaller the pvalue the stronger the evidence is to reject null hypothesis.)
Critical value approach: Compare the test statistic with the critical value defined by significance
level α. If the test statistic is less than -z α = -z 0.05 = -1.64, then we reject the null hypothesis.
(–z 0.05 = –1.64 is also called critical value)
Rejection
Region
x
98.436
98.32
98.436 = 98.6 – 1.64 x 0.1
98.6
α=0.05
One-sided Test:
The decision rule is based
one side of the sample distribution.
A. Chang
Z
–1.64
–2.8
0
2
Introduction to Hypothesis Testing
Level of significance for the test (α
α)
A probability level selected by the researcher at the beginning of the analysis that defines unlikely
values of sample statistic if null hypothesis is true.
♥ p-value ♥
The probability of obtaining a test statistic more extreme than actual sample statistic value given
null hypothesis is true. It is a probability that indicates the extremeness of evidence against H0.
(4. Draw conclusion)
Conclude whether the evidence support the alternative (research) hypothesis or not. Since from
either critical value or p-value approach, we reject null hypothesis. Therefore, there is sufficient
evidence to support the alternative hypothesis that the average body temperature is less
than 98.6 F.
Possible statistical errors in hypothesis testing
Type I error: The null hypothesis is true, but we reject it.
Type II error: The null hypothesis is false, but we don’t reject it.
Two-sided Test
Use the same data above to test whether the average body temperature is different from 98.6 F.
(1. State hypothesis)
H0: µ = 98.6
Ha: µ ≠ 98.6
(2. Choose a test, collect data and compute statistic)
Check if data came from a normal distribution.
Test Statistic : z =
98.32 − 98.6 − 0. 28
=
= − 2. 8
0.4
0.1
16
p-value = P (Z ≤ − 2.8 or Z ≥ 2. 8) = 0. 003 x 2 = 0.006
0.003
(area to the right of 2.8 and to the left of –2.8)
0.003
Sampling distribution of Z
Z
-2.8
0
2.8
(3. Define decision rule)
p-value approach: Compare p-value with the predetermined significance level α. If this
probability (p-value) is less than α=0.05, then we reject the null hypothesis. (The smaller the pvalue the stronger the evidence is to reject null hypothesis.)
Critical value approach: Compare the test statistic with the critical value defined by significance
level α. If the test statistic is less than -z α/2 = -z 0.025 = -1.96 or greater than z0.025 = 1.96, we reject
the null hypothesis.
( –z 0.025 = –1.96 and z0.025 = 1.96 are both critical values.)
Rejection
Region
Rejection
Region
Z
–2.8 –1.96
0
1.96
Two-sided Test:
The decision rule is based both side of the sample distribution.
(4. Draw conclusion)
We reject null hypothesis. Why? ______ Therefore, there is sufficient evidence to support the
alternative hypothesis that the average body temperature is different from 98.6 F.
A. Chang
3
Introduction to Hypothesis Testing
One-sample test for population mean with unknown variance σ 2.
2
In practice, population variance is unknown most of the time. The sample standard deviation s is
2
used instead for σ . If the random sample of size n is from a normal distributed population and the
null hypothesis is true, the test statistic (standardized sample mean) will have a t-distribution with
degrees of freedom n−1.
Test Statistic :
t=
x − µ0
s
n
One-sided Test Example
If we have a random sample that has a mean of 98.2 and 0.4 is a sample standard deviation. The
test statistic will be a t test statistic and the value will be:
Test Statistic : t =
x − µ0 98.32 − 98.6 − 0.28
=
=
= − 2.8
s
0.4
0.1
n
16
Under null hypothesis, this t-statistics has a t-distribution with degrees of freedom n – 1, that is,
15 = 16 − 1.
Rejection
region
To test the hypothesis at α level 0.05,
the critical value is −tα = −t0.05 = −1.753.
t
–1.753
0
–2.8
For t test, p-value can only be approximated with a range because of the limitation of t-table.
p-value < 0.01 = P(T<2.602)
Since the area to the left of –2.602 is .01, the area to the left of –2.8 is definitely less than 0.01.
Decision Rule: If t < -1.753, we reject the null hypothesis, or if p-value < 0.05, we reject null
hypothesis.
Conclusion: Since t = -2.8 < -1.753, or say p-value < 0.01 < 0.05, we reject the null hypothesis.
There is sufficient evidence to support the research hypothesis that the average body
temperature is higher than 98.6 F.
If the sample size is relatively large (>30) both z and t tests can be used for testing hypothesis.
The number 30 is just a reference for practicing problems. In practice, if the sample is from a very
skewed distribution, we need to increase the sample size or use nonparametric alternatives.
Many commercial packages only provide t test since standard deviation of the population is often
unknown.
A. Chang
4
Introduction to Hypothesis Testing
A random sample of one hundred 400-gram soil specimens were sampled in location A
and analyzed for certain contaminant. The sample results in a mean contaminant level of
60 mg/kg and a standard deviation of 36 mg/kg. Test the hypothesis, at the level of
significance 0.05, that the true mean contaminant level in this location exceeds 50 mg/kg.
Hypothesis Testing Work Sheet
1. What is the hypothesis to be tested?
Ho:
Ha:
2.
Which test can be used for testing the hypothesis above? (Check assumptions.)
3.
Compute Test Statistic:
Write down the test statistic formula ______________________.
The value of the test statistic is _________________________ and p-value is ____________.
4.
Decision Rule:
Specify a level of significance, α, for the test. α = _______.
Critical value approach:
Reject Ho if _______________________________________________________.
P-value approach:
Reject Ho if _______________________________________________________.
5. Conclusion:
?What if we wish to test whether the mean is different from 50 mg/kg?
Is it going to be a one-sided test or two-sided test? _______________________
What would be the p-value based on the test statistic calculated above for testing whether the
mean is different from 50 mg/kg? _______________________
What would be the critical values based on the test statistic calculated above for testing whether
the mean is different from 50 mg/kg? _______________________
A. Chang
5
Introduction to Hypothesis Testing
A random sample of ten 400-gram soil specimens were sampled in location A and
analyzed for certain contaminant. The sample data are the followings:
65, 54, 66, 70, 72, 68, 64, 50, 81, 49
The contaminant levels are normally distributed. Test the hypothesis, at the level of
significance 0.05, that the true mean contaminant level in this location exceeds 50 mg/kg.
Hypothesis Testing Work Sheet
1. What is the hypothesis to be tested?
Ho:
Ha:
5.
Which test can be used for testing the hypothesis above? (Check assumptions.)
6.
Compute Test Statistic:
Write down the test statistic formula ______________________.
The value of the test statistic is _________________________ and p-value is ____________..
7.
Decision Rule:
Specify a level of significance, α, for the test. α = _______.
Critical value approach:
Reject Ho if _______________________________________________________.
P-value approach:
Reject Ho if _______________________________________________________.
5. Conclusion:
A. Chang
6
Introduction to Hypothesis Testing
A random sample of one hundred 400-gram soil specimens were sampled in location A
and analyzed for certain contaminant. The sample results in a mean contaminant level of
60 mg/kg and a standard deviation of 36 mg/kg. Find the 95% confidence interval estimate
for the mean contaminant level in location A.
Confidence Interval Estimate Work Sheet
1.
Use the confidence level to find the confidence coefficient:
The given confidence level is ____ = 1 − α, then α = _____ , α/2 = _____.
Confidence coefficient = __________
2.
Find the sample mean __________.
If population standard deviation is not given then find standard deviation _____________
3.
The confidence interval for mean is _____________ ± _______________________
(Use the confidence interval estimate formula.)
A random sample of ten 400-gram soil specimens were sampled in location A and
analyzed for certain contaminant. The sample data are the followings:
65, 54, 66, 70, 72, 68, 64, 50, 81, 49
The contaminant levels are normally distributed. Find the 95% confidence interval estimate
for the mean contaminant level in location A.
Confidence Interval Estimate Work Sheet
1.
Use the confidence level to find the confidence coefficient:
The given confidence level is ______ = 1 − α, then α = _____ , α/2 = _____.
Confidence coefficient = __________
2.
Find the sample mean __________.
If population standard deviation is not given then find standard deviation _____________
3.
The confidence interval for mean is _____________ ± _______________________
(Use the confidence interval estimate formula.)
A. Chang
7
Introduction to Hypothesis Testing
Statistics Formula Sheet
Confidence Interval Estimate:
σ
n
2
s
x ± tα ⋅
(d.f. = n – 1)
n
2
x ± zα ⋅
z-confidence interval:
t-confidence interval:
p̂ ± z α ⋅
Confidence interval for proportion:
2
pˆ (1 − pˆ )
n
σ12 σ22
x1 − x2 ± z α ⋅
+
n1
n2
2
Confidence interval for difference of two means:
Confidence interval for difference of two means:
If
σ =σ
If
σ ≠σ
2
1
2
1
2
2,
2
2,
( n1 − 1) s12 + ( n2 − 1) s 22
x1 − x2 ± t α ⋅
n1 + n2 − 2
2
s12 s 22
x1 − x 2 ± t α ⋅
+
n1 n2
2
1
1 
⋅  +  , d.f. = n 1 + n 2 − 2
 n1 n2 
, d.f. = min(n 1 − 1, n 2 − 1)
Hypothesis Testing:
x − µ0
σ
n
x − µ0
t-test statistic: t =
s
n
z-test statistic:
z=
(d.f. = n – 1)
pˆ − p 0
z-test for proportion: z =
p0 (1 − p0 )
n
x1 − x 2 − D0
z-test statistic for two means: z =
σ12 σ 22
+
n1 n 2
t-test statistic for two means:
If
If
σ12 = σ 22 , t =
σ12 ≠ σ22 , t =
A. Chang
x1 − x 2 − D0
(n1 − 1) s + ( n2 − 1) s  1
1 
⋅  + 
n1 + n2 − 2
 n1 n2 
2
1
x1 − x 2 − D0
s12 s 22
+
n1 n 2
, d.f. = n 1 + n 2 − 2
2
2
, d.f. = min(n 1 − 1, n 2 − 1)
[rough approximate]
8