chapter 7 hypothesis testing and sample size determination _2
chapter 7 hypothesis testing and sample size determination _2
Hypothesis Testing
By:Haymanot N.
03/22/25 1
Learning objectives
At the end of this chapter the student will be able
to:
• Understand the concepts of null and alternative
hypothesis
• Explain the meaning and application of
statistical significance
• Differentiate between type I and type II errors
• Explain the meaning and application of P –
values
• Describe the different types of statistical tests
used when samples are large and small
• Understand the concepts of degrees of freedom
and Statstical test for categorical variables.
• Calculate sample size.
03/22/25 2
Statistical hypothesis
Definition:
•A statistical hypothesis: is an assumption
or a statement which may or may not be true
concerning one or more populations.
Null hypothesis (represented by HO)
•The main hypothesis which we wish to test is called the
null hypothesis, since acceptance of it commonly implies
“no effect” or “ no difference.”
03/22/25 4
Statistical hypothesis(cot ….
• Possible choices of HA
If Ho is then HA is
μ= A (single mean) μ ≠A or μ< A
or μ> A
P = B (single proportion) P ≠B or P <
B or P > B
μx- μy = C (difference of means) μx- μy ≠C or
μx- μy< C or μx- μy> C
Px- Py = D(difference of proportions) Px- Py ≠D or
Px- Py< D or Px- Py>
D
03/22/25 5
Example
03/22/25 7
Idea of hypothesis testing
03/22/25 8
Steps in hypothesis testing
Steps involved in testing about a hypothesis
1. State the research question in terms of
statistical hypothesis.
• The null hypothesis, H0, is a statement
claiming that there is no difference b/n the
hypothesized value and the population
value.(The effect of interest is zero)
• The alternative hypothesis, H1, is a
statement that disagrees with the null
hypothesis.(The effect of interest is not
zero)
03/22/25 9
Steps in hypothesis testing(cont…
2. Select a sample and collect data
3. Decide on the appropriate test
statistic for the hypothesis (Z, t, χ2,
F, etc.)and perform calculation.
It is a value computed from the sample
data that is used in making the decision
about the rejection of the null hypothesis
Test statistic = relevant statistic –
hypothesized parameter
standard error of the relevant
statistic
Example:
03/22/25 10
Steps in hypothesis testing(cont…
03/22/25 11
Steps in hypothesis testing(cont…
03/22/25 12
Steps in hypothesis testing(cont…
03/22/25 14
Types of error(cont…
03/22/25 18
p-value
But for what values of p-value should we reject
the null hypothesis?
By convention, a p-value of 0.05 or smaller is
considered sufficient evidence for rejecting
the null hypothesis.
And we often say that the result is
statistically significant. (below some lower
level, such as 0.01, it may be called highly
significant.)
By using p-value of 0.05, we are allowing a
5% chance of wrongly rejecting the null
hypothesis when it is in fact true.
03/22/25 19
p-value
• It is important to distinguish between the
significance level and the p – value.
The significance level α is the
probability of making a type I error.
This is set before the test is carried out.
The P – value is the result observed
after the study is completed and is
based on the observed data.
03/22/25 20
• Test of significance answers the question:
Is chance (sampling) variation a likely
explanation of the discrepancy between a
sample result and the corresponding null
hypothesis population value? Answer:
03/22/25 21
p-value
There fore Another way to state
conclusion:
Reject the null hypothesis if P < α.
Accept the null hypothesis if P ≥ α,
03/22/25 22
Hypothesis test about population mean
(normally distributed)
A) Known variance
The critical point (Z statistic) is calculated as:
03/22/25 24
Solution
• Step 1: H0: μ= 130 ( the mean systolic blood
pressure of the village is the same as the
mean SBP of the district )
H1: μ≠ 130
• Step 2: collect a sample of size 64 from a
normally distributed population with a
known, σ= 10. The calculated sample
mean is = 132 mm Hg
• Step 3:
Testing a hypothesis about population mean
The population is normally distributed
Population variance is known
03/22/25 25
• Z ‐statistic is the appropriate one
n = 64, X= 132
The Z score for the random sample of 64
persons of the village aged 20 to 40 years:
03/22/25 26
This score 1.6 falls inside the “fail to
reject region” from –1.96 to +1.96 .
03/22/25 27
• The same conclusion will be reached by
referring to the corresponding P-value. Use the
table to find the P-value associated with an
observed (calculated) value of Z which is 1.6.
03/22/25 32
A) Unknown variance
•The test statistic is:
03/22/25 33
Example2
• Serum amylase determination were
made on a sample of 15 apparently
health subjects. The sample yielded a
mean of 96 units/100ml and a standard
deviation of 35 units/100ml. The
population was normally distributed but
the variance was unknown. We want to
know whether we can conclude that the
mean of the population is different from
120.
03/22/25 34
Step 1: H0: μ= 120
H1: μ≠120
Step 2: mean = 96 SD=35 n=15
Step 3:t‐test is the appropriate test,
since
we are testing about the population
mean
the population is normally distributed
the population variance is unknown
03/22/25 35
Step 4: α= 0.05 t 0.025,14= 2.1448
Step 5 :Since –2.65 < ‐2.1448, it falls in the
rejection region we reject the null hypothesis. The
mean of the population from which the sample
came is not 120.
03/22/25 36
The other way to make conclusion is:
P=2P(t
=2.65)=2x(0.005<P<0.01)=0.01<P
<0.02
⇒ P < α⇒ statistically significant ⇒
Reject Ho
03/22/25 37
Exercise
• The mean pulse rate and standard deviation of a random sample
of 9 first year male medical students were 68.7 and 8.67 beats
per minute respectively. (Assume normal distribution).
B. If past experience indicates that the mean pulse rate of first year
male medical students is 72 beats per minute, test the
hypothesis that the above sample estimate is consistent with the
population mean at 5% level of significance.
03/22/25 38
A. Confidence Intervalx=t
n
= 68.7 ± (2.31 x 2.89)
= 68.7 ± 6.7
= (62.0 to 75.4) beats per minute.
03/22/25 39
• Hypotheses : HO : μ = 72
HA : μ ≠ 72
• t calc = ( x - μ) / (S/√n) = (68.7 - 72) / (8.67/ √9) = -3.3 / 2 .89
= -1.14
(This corresponds to a P-value of greater than 0.10)
• t tab ( with α = 0.05 and 8 df) = ± 2.31
• Reject HO when t-calculated is either greater than 2.31 or less
than –2.31.
• So we fail to reject the null hypothesis.
03/22/25 42
Example:
If a random sample of 50 non-smokers have a mean life
of 76 years and a random sample of 65 smokers live 68
years. And If it is reasonable to assume that the two
populations values are normally distributed with
standard deviation equal to 8 years and 9 years for the
non smokers and smokers respectively then Test the
hypothesis that there is no difference between the
mean lifetimes of non smokers and smokers at a 0.01
level of significance.
03/22/25 43
• Hypotheses: HO: μ1= μ2 or HO: μ1- μ2 = 0
H A: μ1 ≠ μ2 or HA: μ1- μ2 ≠0
α= .01 ( two tailed ) ⇒Z (tabulated) = ±2.58
Z calc = x{ y( )- (μx- μy) } ⁄Standard error of the
difference of means
Standard error of the difference of means is:
= = √ 1 .28+ 1 .25 =
1.59 years
03/22/25 46
• HO: μ1= μ2
H 1: μ1 ≠ μ2
t‐test is the appropriate one, with d.f. = n1 +
n2 ‐ 2.
α = 0 05 ⇒ t0.025,35 = 2 0301
03/22/25 47
03/22/25 48
• Since ‐1.88 falls in the acceptance
region, we accept the null hypothesis.
03/22/25 49
ii) Unequal variances (2 independent
samples)
•We use the t‐statistic
03/22/25 50
iii) Paired sample
The test statistic is calculated as:
03/22/25 51
Example:
In a study of dialysis patient education,10
patients on dialysis were given programmed
instruction about kidney function and renal
failure. Patients were tested on this
information before and after instruction. The
pre instruction and post instruction test
scores for these patients are shown in the
next slide. Test the hypothesis that the
population test score mean before instruction
is the same as the population test score mean
after instruction, if the differences come from
a normally distributed population.
03/22/25 52
Pt number Before instruction After instruction Difference
1 65 85 ‐20
2 81 69 12
3 69 92 ‐23
4 42 69 ‐27
5 77 88 ‐11
6 69 88 ‐19
7 69 92 ‐23
8 69 77 ‐8
9 77 88 ‐11
10 58 96 ‐38
Mean -16.8
03/22/25 53
Solution
• H0: μd = 0 (the mean difference in
the population is zero)
H1: μd ≠ 0 (the mean difference is
not
zero
• To calculate the mean of differences:
03/22/25 54
• Step 3 :Paired t‐test with test statistic
d d
t
sd
16.8 0
t 3.96
13.4
• Step 4: α = 0.05 ⇒ t0.025,9 = 2.2622
10
•
03/22/25 55
• Since -3.96 falls in the rejection region
we reject H0. There is a significance
difference between the population
means before and after instruction.
03/22/25 56
Statistical test of significance for
single proportion
In the study of childhood abuse in psychiatry
patients, brown found that 166 in a sample
of 947 patients reported histories of physical
or sexual abuse.
a. constructs 95% confidence interval
b. test the hypothesis that the true population
proportion is 30%?
Solution (a) p (1 p )
p z
• The 95% CI for P is given by 2 n
0.3 0.7
0.175 1.96
947
0.175 1.96 0.0148
[0.145 ; 0.204]
03/22/25 57
B. To the hypothesis we need to follow the steps
Step 1: State the hypothesis
Ho: p=P=0.3
Ha: p≠P≠0.3
Step 2: Fix the level of significant (α=0.05) Set critical
value =1.96
Step 3: Compute the calculated and tabulated value of
the
P
p statistic
test
0.175 0.3 0.125
zcal 8.39
p (1 p ) 0.3(0.7) 0.0149
n 947
ztab 1.96
03/22/25 58
• Step 5: Comparison of the calculated
and tabulated values of the test statistic
• Since the tabulated value is smaller
than the calculated value of the test the
we reject the null hypothesis.
• Step 6: Conclusion
Hence we concluded that the proportion
of childhood abuse in psychiatry
patients is different from 0.3
03/22/25 59
Hypothesis testing for two population proportions
• The hypothesis are Ho: π1-π2 = 0
HA: π1-π2 ≠ 0
• The test statistics is given by
( p1 p2 ) ( 1 2 )
zcal
p1 (1 p1 ) p2 (1 p2 )
n1 n2
We use a pooled sample estimate for the common
hypothesized proportion, which is a weighted
average of the sample proportions, with the sample
size as weights.
03/22/25 60
Exercise 4
Two hundred patients suffering from a
certain disease were randomly divided
into two equal groups. Of the first group,
78 recovered within three days. Out of
the other 100,who were treated by a new
method, 90 recovered within three days.
The physician wished to know whether
the data provide sufficient evidence to
indicate that the new treatment is more
effective Than the standard.(apha =0.05 )
03/22/25 61
Solution
H0: π1= π2
H1: π1< π2
P1= 78/100 = 0.78, P2 = 90/100 = 0.90
The test statstic can be calculated:pooled P is
calculated by
=0.84
03/22/25 62
(0.78 0.9 ) (0)
zcal
0.84(1 0.84) 0.84 (1 0.84)
100 100
= -2.32
• Since ‐2.32 < ‐1.645 it falls in the rejection
region. We reject the null hypothesis. The
data suggests that the new treatment is
more effective than the standard
03/22/25 63
One tailed tests
• consider the situation when HA
includes the symbol “ > or < ”.
α(level of significance) two-tailed one -tailed,
< one-tailed, >
.10 ±1.64 - 1.28
1.28
.05 ±1.96 - 1.64 1.64
.01 ±2.58 - 2.33 2.33
03/22/25 64
Example :
A pharmaceutical company claims that
a drug which it manufactures relieves
cold symptoms for a period of 10
hours in 90% of those who take it. But
other company says that the drug
gives relief for less than 90% of the
population. In a random sample of 400
people with colds who take the drug,
350 find relief for 10 hours. At a .05
level of significance, is the
manufacturer’s claim correct?
03/22/25 65
Solution
HO: P = .90
HA : P < .90
Z tab (α= .05) = -1.64 and reject HOif Z calc
< -1.64.
Z calc = (.875 - .90) / √(.90 x .10 /400) =
(.875-.90)/.015 = -1.67
The corresponding P-value is .0475
– statistically significant
Z calc <Z tab
– Hence, HO is rejected: the manufacturer's
03/22/25 claim is not upheld. 66
Confidence interval or p –
value?
• A 95% confidence interval gives a
plausible range of values that should
contain the true population
difference.
03/22/25 68
Statistical methods for
Categorical Variables
03/22/25 69