Hypothesis Test1
Hypothesis Test1
Hypothesis Test1
Rama Shankar
Hypothesis Testing
1
Developing Null and Alternative Hypotheses
2
The American Trial System
In Truth, the Defendant is:
H0: Innocent HA: Guilty
Null Hypothesis Ho
3
Alternative Hypothesis Ha
4
Steps in Hypothesis Testing
1. Establish the Hypothesis 10. Select the samples
– State the Null Hypothesis 11. Conduct the test and collect
(H0)
data
– State the Alternative
Hypothesis (Ha) 12. Calculate the test statistic (Z, t,
) from the data
2. Decide on appropriate statistical
test (assume distribution Z, t,) 13. Determine the probability that
the calculated test statistic has
3. State the alpha level
occurred by chance
(usually 5 %)
4. State the beta level 14. If that probability is less than
(usually 10-20 %) alpha, reject H0
5. Establish the effect size (delta) 15. If that probability is greater than
alpha, do not reject H0
6. Establish the sample size
7. Develop a sampling plan
5
Types of Hypothesis Testing: Two
Samples
Two Sample t-Test
• Use to compare two sample distributions to determine if a difference
exists in their means
• For a two-tailed, two-sample t
• s is unknown
Paired t-Test
• Use the paired t command to perform a hypothesis test of the difference
between population means when observations are paired.
• A paired t-procedure matches responses that are dependent or related
in a pairwise manner.
• This matching usually results in a smaller error term, since it minimizes
variability in the pair.
A Test of Hypotheses
6
Test Procedure
A test procedure is specified by
1. A test statistic, a function of the
sample data on which the decision is
to be based.
2. A rejection region, the set of all test
statistic values for which H0 will be
rejected (null hypothesis rejected if
the test statistic value falls in this
region.)
© Copyright. All rights reserved
Test Statistic
The test statistic z has a standard normal
probability distribution.
We can use the standard normal probability
distribution table to find the calculated z-value with
an area of α in the lower (or upper) tail of the
distribution.
The value of the test statistic that established the
boundary of the rejection region for the test is
called the critical value for the test.
The rejection rule is: (For the calculated z value)
• Lower tail: Reject H0 if z < zα.
• Upper tail: Reject H0 if z > zα.
7
Type I and Type II Errors
8
The Risk Truth Table
α is the risk of finding a difference when there really isn’t one.
β is the risk of not finding a difference when there really is one.
Action
Ho not rejected Ho rejected
State of Nature
Type I or
Ho should not
producer’s risk
be rejected Correct
α = P(Type I)
(Ho is true)
Ho should Type II or
be rejected consumer’s risk Correct
(Ho is false) β = P(Type II)
Think of…
Pascal’s Wager
The TRUTH
Your Decision God Exists God Doesn’t Exist
Reject God
BIG MISTAKE Correct
9
Steps of Hypothesis Testing (Manual
Method)
10
A Summary of Forms for Null and Alternative
Hypotheses about a Population Mean
Null hypothesis: H 0 : µ = µ0
x − µ0
Test statistic value: z =
σ/ n
11
A Normal Population With Known σ
X −µ
Test Statistic: T=
S/ n
12
Small Sample Tests (n < 30)
Null hypothesis: H 0 : µ = µ0
x − µ0
Test statistic value: t=
s/ n
13
Hypothesis Tests for
Proportions
A Population Proportion
14
A Summary of Forms for Null and Alternative
Hypotheses about a Population Proportion
Null hypothesis: H 0 : p = p0
15
Tests for Proportion p : (np > = 5 and n(1-p) >=5)
Student’s t Table
16
Exercise 1:
Answer
1. Define your hypotheses (null, alternative)
H0: Mu. (average sleep time) = 6.0 hours Ho : µ a = µ b
Ha: Mu. (average sleep time) ≠ 6.0 hours
Ha : µ a ≠ µ b
2. Specify your null distribution
We have 30 students. Sample size <=30, therefore T distribution
17
Answer
3. Do an experiment
x − µ 0
observed in our experiment z =
x bar = 6.9 hours σ / n
4. Calculate the z-
z-value of what you observed
Calculated test statistic = 1.64
6.9 − 6.0
T29 = = 1.64
.55
Answer
6. Reject or fail to reject the null hypothesis ?
Since the test statistic 1.64 does not fall in the reject
region,
Fail to reject the null hypothesis
at the significance level
Critical z Critical z
z ≥ zα / 2 or z ≤ − zα / 2 Calc. z
18
Minitab Method Exercise 1
• Minitab Command:
– Stat> Basic Stat > 1 sample t
• At dialogue box:
– Summarized data
– Sample size = 30
– Mean = 6.9
– Standard Deviation = 3
– Test Mean = 6
• What is your conclusion?
19
Minitab Method Exercise 2
• Null Hypothesis: New Mean = Old Mean
• Alternate Hypothesis: New Mean is not = Old Mean
• Minitab Command:
– Stat> Basic Stat > 1 sample t
• At dialogue box:
– Choose “Samples in Column”
– Select “Strength”
– Enter test mean value from exercise: 5.15
– Options: Choose “not equal” and Confidence level = 95
– Graphs: Choose “boxplot”
• What is your conclusion?
Minitab Exercise 2
20
Minitab output Exercise 2
Boxplot of strength
(with Ho and 95% t-confidence interval for the mean)
One-Sample T: strength
Exercise 3 Furnace.mtw
• A study was performed in order to evaluate the effectiveness of two
devices for improving the efficiency of gas home-heating systems.
Energy consumption in houses was measured after one of the two
devices was installed.
21
Exercise in Minitab
Exercise in Minitab
Boxplot of Furnace 1, Furnace 2
20
15
different?
10
Furnace 1 Furnace 2
22
More Exercises
• A new spark plug design is tested for wear. A sample of
6 plugs tested showed wear of: .0058, .0049, .0052,
.0044, .0050 and .0047 inches. The current design has
historically produced an average wear of .0055". With
95% confidence, is the new design better?
• A very expensive experiment has been conducted to
evaluate the manufacture of synthetic diamonds using a
new technique. Five diamonds have been generated and
weights recorded of .46, .61, .52, .57 and .54 carats. An
average diamond weight equal to or greater than .50
carats must be realized for the venture to be profitable.
What is your recommendation assuming 95%
confidence?
P - Values
23
P – Value (Value shown in statistical software)
P-Value (area)
P -value = 1 − Φ( z )
Upper-Tailed
P -value = Φ ( z ) 0 z
Lower-Tailed
-z 0
P -value = 2[1 − Φ (| z |)]
Two-Tailed
-z 0 z
© Copyright. All rights reserved
24
P–Values for t Tests
Exercise 3
25
Answer
1. What is your null hypothesis?
Null hypothesis: Let P(1) be John’s value and P(2) be Nick’s value
P (2) > = P (1)
Alternative hypothesis: P (2) < P(1)
4. Z = (.085-.15)/.025 = -2.6 pˆ − p0
z=
5. From Z table : .05* area under curve corresponds to p0 (1 − p0 ) / n
Z= -1.65
p-value = P(Z –1.65 < -2.6)
6. Since “P value is low; Null Hypotheses must be rejected.
• Minitab Command:
– Stat> Basic Stat > 2 proportions
• At dialogue box:
– Summarized data
– First Sample: Trials 200; Events 17
– Second Sample: Trials 100; Events 15
– Options: Choose “less than”
– Choose “Pooled standard deviation”
• What is your conclusion?
26
Exercise
Answer
27
Exercise 5
• As your corporation's purchasing manager, you need to
authorize the purchase of twenty new photocopy
machines. After comparing many brands in terms of
price, copy quality, warranty, and features, you have
narrowed the choice to two: Brand X and Brand Y. You
decide that the determining factor will be the reliability of
the brands as defined by the proportion requiring service
within one year of purchase.
• Because your corporation already uses both of these
brands, you were able to obtain information on the
service history of 50 randomly selected machines of
each brand. Records indicate that six Brand X machines
and eight Brand Y machines needed service. Use this
information to guide your choice of brand for purchase.
Minitab solution
28
Minitab solution
• Test and CI for Two Proportions
• Sample X N Sample p
• 1 44 50 0.880000
• 2 42 50 0.840000
Exercise
The number of calls to the help desk associated with a new software
release was recorded during May. At the end of May a software
patch was instituted. Data was recorded on the number of calls
associated with report generation during June. Did the patch reduce
the number of calls to the help desk.
29
Exercise
Exercise
A new type of ink is being proposed by your supplier. The ink is
being tested to see the color saturation obtained using old ink and
new ink (higher is better). QA wishes to know if the new ink is better
than the old ink.
30
© Copyright. All rights reserved
31