0% found this document useful (0 votes)
4 views

chapter 7 hypothesis testing and sample size determination _2

The document provides an overview of hypothesis testing in statistics, covering key concepts such as null and alternative hypotheses, statistical significance, and types of errors. It outlines the steps involved in hypothesis testing, including formulating hypotheses, selecting samples, and calculating test statistics. Additionally, it discusses the interpretation of p-values and the application of different statistical tests based on sample size and variance knowledge.

Uploaded by

Berhanu Yelea
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

chapter 7 hypothesis testing and sample size determination _2

The document provides an overview of hypothesis testing in statistics, covering key concepts such as null and alternative hypotheses, statistical significance, and types of errors. It outlines the steps involved in hypothesis testing, including formulating hypotheses, selecting samples, and calculating test statistics. Additionally, it discusses the interpretation of p-values and the application of different statistical tests based on sample size and variance knowledge.

Uploaded by

Berhanu Yelea
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 69

Arba Minch University

School Of Public Health


Unit of Epidemiology and Biostatistics

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.”

•HO is always a statement about a parameter ( mean,


proportion, etc. of a population).

•HO is an equality ( μ= 14) rather than an inequality (μ<


14)
03/22/25 3
Statistical hypothesis(cot ….
Alternative hypothesis (represented by HA or H1)
•Hypothesis that will be accepted if HO is
rejected.

•HA must also be formulated before a sample is


tested, so it, like the null hypothesis (HO), does
not depend on sample values.

•states the ‘opposing’ view that ‘there is a


difference between factor and outcome’ or
‘there is an intervention effect’.

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

At present only 60% of patients with


leukaemia survive more than 6 years. A
doctor develops a new drug. Of 40
patients, chosen at random, on whom
the new drug is tested, 26 are alive after
6 years. Is the new drug better than the
former treatment? What is the null and
alternative hypothesis.
HO : P = .60
HA : P > .60
03/22/25 6
Example 2

• The mean height of the Arba Minch


University students is 1.63m.
HO : μ= 1.63 m
HA : μ ≠163 m or
HA : μ> 1.63 m or
HA : μ< 1.63 m.

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…

4. Select the level of significance for


the statistical test (α=0.05, 0.01,
0.001, etc.) and determine the
critical value.
• Critical value :A value the test
statistic must attain to be declared
significant.

03/22/25 11
Steps in hypothesis testing(cont…

03/22/25 12
Steps in hypothesis testing(cont…

5. Draw and state the conclusion.


• If the numerical value of the test statistic falls
in the rejection region, we reject the null
hypothesis
 and conclude that the alternative hypothesis‐
testing process will lead to this conclusion
incorrectly only 100α% of the time when H0 is
true.

• If the test statistic does not fall in the


rejection region, we do not reject H0
.
03/22/25 13
Types of error
• A null hypothesis is either true or false,
and it is either rejected or not
rejected.

• No error is made if it is true and we fail


to reject it, or if it is false and rejected.

• An error is made, however, if it is true


but rejected, or if it is false and we fail
to reject it.

03/22/25 14
Types of error(cont…

relationships between the null


hypothesis and the decision taken .
Decision
Accept HO Reject HO
Null (Fail to reject HO)
hypothesis

HO true Correct Type I error


(Prob. = 1-α) (Prob. = α = Sign.
level)
HO false Type II error Correct
03/22/25 (Prob. = β= 1-Power) (Prob. = β= 1-Power) 15
Types of error(cont…
• Type I error: rejecting the null hypothesis when it is
true.

* The probability of making a type I error is denoted by


α.
It is called the level of significance.

• Type II error: not rejecting the null hypothesis when it


is actually false.
* The probability of making a type II error is denoted by
β.

 Therefore, we must learn to live with probabilities of


type I (α) and type II (β) errors
03/22/25 16
• The probability
Power
of rejecting the null hypothesis
when it is false.
• Power = 1‐ β.

• The power of a test tells the likelihood that the


hypothesis of no treatment effect will be rejected
when the treatment has an effect.

• The smaller size of the treatment effect (with


respect to the population standard deviation) the
harder it is to detect.
• The larger the sample size, the greater the power
of the test.
03/22/25 17
p-value
 In most applications, the outcome of
performing a hypothesis test is to produce a p-
value.

 P is the probability of getting a sample


statistic at least as extreme as the
calculated statistic if the null hypothesis is true.

 P-value is the probability that the observed


difference is due to chance.

 That is, a small p-value suggests that there


might be sufficient evidence for rejecting the
null hypothesis.

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:

•If the calculated Z value is positive, the rule says:


Reject HO if Z calculated ( Z calc) > Z tabulated (Z
tab) or accept HO if Z calc < Z tab.
On the other hand, if the calculated Z value is
negative:
 reject HO if Z calculated ( Z calc) < Z tabulated
(Z tab) (Here, both Z calculated and Z tabulated
are negative values)
03/22/25 23
Example
• Assume that in a certain district the mean
systolic blood pressure of persons aged 20
to 40 is 130 mm Hg with a standard
deviation of 10 mm Hg . A random sample of
64 persons aged 20 to 40 from village x of
the same district has a mean systolic blood
pressure of 132 mm Hg. Does the mean
systolic blood pressure of the dwellers of the
village (aged 20 to 40) differ from that of the
inhabitants of the district (aged 20 to 40) in
general, at a 5% Level of significance?

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:

Z calc = (132-130) / (10/ √64)


= 2 / 1.25 = 1.6
• Step 4: α= 0.05

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.

• From the table mentioned above we get


P=0.11 (note that this p-value is greater than
the given level of significance).

• If P ≥ α- Fail to reject the null hypothesis


in this case 0.11> 0.05 fail to reject null
hypothesis
03/22/25 28
Exercise
Researchers are interested in the mean
level of some enzyme in a certain
population which had a mean enzyme
level of 25 . They collect a sample of size
49 from a Normally distributed population
with a normally distributed population
with a known variance, σ2= 45. The
calculated sample mean is 22 can they
conclude that the mean enzyme level in
this population is different from 25? (level
of significance 0.05)
03/22/25 29
Solution
• Step 1: H0: μ= 25
H1: μ≠ 25
• Step 2: they collect a sample of size 49
from a normally distributed population
with a known, σ2= 45. The calculated
sample mean is = 22
• Step 3:
 Testing a hypothesis about population mean
 The population is normally distributed
 Population variance is known
03/22/25
 So Z ‐statistic is the appropriate one 30
Sample: n = 49, mean=22
σ2= 45 => σ= √45 =6.708
The Z score for the random sample of 49 persons of the
village aged 20 to 40 years:

Z calc = (22- 25) / ( 6.708/ √49) = -3 / 0.958 = -3.13


Step 4: α= 0.05
so critical value is 1.96
Step 5: The score -3.13 falls inside the rejection
region from below –1.96. in addition reject
Ho
Other way to make conclusion
P=2x0.0009=0.0018 => p< α
•The result is statistically significant therefore
reject Ho =>mean enzyme level with in the
03/22/25 31
population is different from 25
Z test is applied when sample is large and known
varience But, what happens when n<30 and σ is
unknown?
 We will use a t-distribution which depends on the number
of degrees of freedom (df).

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).

A. Find a 95% C.I. for the population mean.

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.

• Conclusion : The result (sample estimate) obtained from the


sample is consistent with the population mean. Not significant
03/22/25 40
Confidence Interval =x t

n
= 68.7 ± (2.31 x 2.89)
= 68.7 ± 6.7
= (62.0 to 75.4) beats per minute.
What is the decision?
• Hypothesized parameter 0 = 72
• Fail to reject the Ho, since the interval (62 –
75.4) contain the hypothesized parameter.
03/22/25 41
Hypothesis testing about differences
between population means ( normally
distributed)
A) Known variance (2 independent
samples)
if we assume the two groups as
population 1 and 2
Ho: µ1-µ2 =0 or HO:µ1 = µ2 AND
HA: µ1-µ2 ≠ 0, or HA: µ1-µ2 < 0, or
HA: µ1-µ2 > 0
( x  y )  ( 1   2 )
cal 
And test zstatistic is calculated as
12  22

n1 n2

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

Zcalc = (76 – 68) / 1.59 = 8 / 1.59 = 5.03


The corresponding P-value is less than .0003
Zcalc > Ztab and P-value < the given αvalue
the null hypothesis ( Ho ) is rejected.
⇒ there is a statistically significant difference in the
mean lifetimes of non smokers and smokers
03/22/25 44
B)Unknown variances
i) Equal variances (2 independent
samples)
• The test statistic t can be
calculated

• The degree of freedom is n1+n2- 2


03/22/25 45
Example:

Serum amylase determinations were made on


a sample of 15 apparently healthy subjects
and 22 hospitalized subjects. Suppose the
samples yielded
= 96 units/100 ml = 120 units/100
ml
S1 = 35 units/100 ml S2= 40 units/100 ml
The populations are approximately normally
distributed. Would we be justified in concluding
that the population means are different?

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

•With degree of freedom

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.

• If the 95% confidence interval


includes the point of zero difference
then, by convention, any difference
in the sample cannot be generalized
to the population.
03/22/25 67
Confidence interval or p – value?
(cont…

• Confidence intervals are preferable


– because they give information about the
size of any difference in the population,
and
– they also (crucially) indicate the amount
of uncertainty remaining about the size
of the difference.

03/22/25 68
Statistical methods for
Categorical Variables

03/22/25 69

You might also like