Hypothesis Testing (Test of Significance)
• Important application of inferential statistics
• Assumptions are made about population and
tested with help of sample data
• So It is the procedure whereby we decide, in the
basis of sample information taken from a
sample, whether to accept or reject a
hypothesis.
• The methods of inference used to support or
reject claims about population based on sample
data are known as tests of significance
Cont’d
• The most popular ones are t-test, Z-test, ANOVA
test Chi-square test.
• Selection of test
Quantitative data : Z-test, t-test, ANOVA test
(called parametric test)-follows normal
distribution
Qualitative data: Chi-square test(Categorical
data ), run test, Fishers exact test (called non
parametric test)
These test do not follow normal property.
Cont.
Testing of hypothesis
Non parametric test: Nominal and ordinal
Parametric test: continuous data scale
(ratio scale) Examples:
Examples: Run test
Z test Median test
T test Chi square test
ANOVA test Mann Whitney U test etc.
Hypothesis
A hypothesis may be defined simply as statement about one
or more populations.
Or
A hypothesis is a claim or a statement regarding a
population parameter which may or may not be true, but
needs to be verified by a random sample.
Example:
Is TFR of educated women lower than uneducated
women?
Is New treatment more effective than existing treatment
?
- Answer obtained by setting hypothesis
TFR of educated women is lower than uneducated
women.
New treatment is more effective than existing treatment.
- Data are used to test hypothesis
Types of Hypothesis
1. Research hypothesis: The research hypothesis is the
conjecture or supposition that motivates the
research
2. Statistical hypothesis :The statistical hypotheses are
hypothesis that are stated in a such way that they
may be evaluated by appropriate statistical
techniques.
Research hypotheses directly lead to statistical
hypotheses
Hypothesis
Statistical Hypothesis:
1. Null Hypothesis (Ho)
- Hypothesis of no difference between two means
- no association between two variables
- no relationship between two variables
Example:
1. Sample mean = Population mean (H0:= 0)
2. Mean of 1st sample = mean of 2nd sample (H0:1= 2)
3. New treatment is not beneficial to those suffering from
certain diseases compare with existing treatment.
4. Effects of two drugs A and B are same.
Hypothesis
2. Alternative Hypothesis (HA or H1) :
-There is difference between two variables
- There is association between two variables
- There is relationship between two variables
Example:
1. Sample mean ≠ Population mean (H1: ≠ o)
2. Mean of 1st sample ≠ mean of second sample (H1:1 ≠
2)
3 New treatment is beneficial to those suffering from
certain diseases compare with existing treatment.
4. Effect of two drugs A and B are not same.
Cont’d
• A null hypothesis is tested against an
alternative hypothesis.
• Research question is always towards
alternative hypothesis.
• In most the research we want result towards
alternative hypothesis.
• So null hypothesis is established for the
rejection purpose
Cont’d
Types of Alternative Hypothesis
1. Directional 2. Non Directional
-Also called ’‘one tailed’’ - Also called ’‘ two tailed ‘’
-Tail may be right or left
- Composite hypothesis - Simple hypothesis
One tailed test - Two tailed test
Right Tail mean height of male
Mean height of male students > students ≠ mean
mean height of female students height of female
students
Left Tail
Mean height of male students <
mean height of female students
Two tailed test
Two and one tailed test
Critical region
Two tailed and one tailed test
One tailed test
Two tailed test
Accept Ho if the sample mean falls in this
region
0.025 0.475 + 0.475 0.025
0.95
Z= - 1.96 Z=1.96
Reject Ho if the sample mean falls in either of these two
region
One tailed test (Left tailed test)
Accept Ho if the sample mean falls in
this region
Rejection Region Acceptance Region
0.05 + 0.5=0.95
Z= -1.645 =H0
Reject Ho if the sample mean falls in this region.
One tailed test (Right tailed test)
Accept Ho if the sample mean falls in
this region
Acceptance Region
Rejection Region
0.95
0.05
=H0 Z= 1.645
Reject Ho if the sample mean falls in this region.
Errors in Hypothesis Testing
I. Reject H0 when it is not true.
II. Accept H0 when it is true.
III. Reject H0 when it is true.
IV. Accept H0 when it is false.
I and II are correct decision
III and IV are wrong decision
Wrong decisions are called errors in
hypothesis testing
Types of error in testing of Hypothesis
True Decision from sample
statement Accept H0 Reject H0
H0 true Correct decision Wrong decision
Type I error(α)
H0 False Wrong decision Correct
Type II error(β) decision
Type II error is more dangerous than type I error.
Type I error is also called false positive (FP).
Type II error is also called false negative (FN).
• Errors in hypothesis testing
• Errors in hypothesis testing
False positive and false negative
Types of error
Cont’d
New treatment is more effective than existing treatment
New treatment is not effective New treatment is effective
Effect
No Effect
Type I error Type II error
False Positive False Negative
Cont’d
Type I error: Reject true null hypothesis in fact it is true. It is
also called level of significance.
It is set by the researcher.
It has serious consequences .
Example
- test is positive but no disease .
- Person is innocent but jury decide he is guilty
Type II error: Accept false null hypothesis in fact it is wrong.
Example
- test is negative but there is disease.
- Person is guilty but jury decide he is innocent
Both errors can be kept at minimum level by taking large
samples.
Level of significance (α)
• The significance level is the maximum percentage of
rejecting Ho when it is true and is usually determined in
advance before testing the hypothesis.
• It helps to identify where the test statistic value lies either
acceptance region or rejection region
• Also called thresh hold p value.
• 0.01(1%) and 0.05 (5%) are most common p values.
Z values at different level of significance
10% 5% 1%
Two tailed ±1.645 ±1.96 ± 2.58
One tailed ±1.28 ± 1.645 ± 2.33
P value
• It is the probability value calculated from sample data
and compared with level of significance which is fixed in
advance under the assumption of null hypothesis. The
level of significance are fixed 1%(.01) and 5% (.05)
• The p-value is a number between 0 and 1 and
interpreted in the following way:
• A small p-value (typically ≤ 0.05) indicates strong
evidence against the null hypothesis, so we reject the
null hypothesis.
• A large p-value (> 0.05) indicates weak evidence against
the null hypothesis, so we fail to reject the null
hypothesis.
Power of test
• The power of test is a probability of
rejecting a null hypothesis when it is
actually false.
• Complimentary of type II error ( β)
• power of test = 1- β
• β is small – powerful test
• It depends upon sample size.
Steps of Test Statistics
1. State the hypothesis
a) null hypotheses (b) alternative hypotheses
2. Calculate the value of test statistic : Z test or t test or Chi square
test or ANOVA test
3. Fix the level of significance (and find degree of freedom if
necessary)
4. Take the tabulated value at the given level of significance (at
given certain df if necessary)
5. Compare the value of observed test statistic (calculated value )
to the tabulated value
6. Draw the conclusion
i. If Observed value < tabulated value, we accept H0, then we
conclude that there is no difference between two means.
ii. If Observed value ≥ tabulated value, we reject H0 (accept
H1) then we conclude that there is significant difference
between two means
Z test
• Z-test is a statistical test where normal
distribution is applied and is basically used for
dealing with problems relating to large
samples when n ≥ 30.
• A test statistic is a standardized normal
variate Z of the statistics obtained from
sample.
X
Z
SE
Z test
Criterion for using Z-test
• Distribution should be normal
• Data set may be qualitative or quantitative
• Sample size should be more than 30
• Observation are randomly selected
• Variance should be known.
Types of Z test
• There are different types of Z-test each for different
purpose. Some of the popular types are outlined below:
1. z test for single sample mean
2. z test for difference between two sample means
3. z test for single sample proportion
4. z test for difference between two sample proportions
Z test and its types
One sample mean test Difference of two sample means test
Setting Hypothesis Setting Hypothesis
H0: =o ( sample mean and H0: 1=2 ( Two sample means are equal)
population are equal) H1: 12 (Two sample means are
significantly different)
H1: o (sample mean and population Test statistic
are significantly different)
Test statistic X1 X 2 1 2
2 2
X 0 Z , whereSE ( X 1 X 2 )
Z , whereSE ( X ) SE ( X 1 X 2 ) n1 n2
SE ( X ) n
One sample proportion test Difference of two sample proportion test
Setting Hypothesis Setting Hypothesis
H0: p1=p2 ( two sample proportions are
H0: P=Po ( sample proportion and equal)
population proportion are equal) H1: p1p2 ( two sample proportions are
H1: PPo (sample proportion and significantly different)
population proportion are significantly Test statistic
different)
p1 p2 p1q1 p2q2
Test statistic Z , whereSE ( p1 p2 )
p P0 PQ SE ( p1 p2 ) n1 n2
Z , whereSE ( X )
SE ( p) n
Example 1
• The mean birth weight of 100 infants is 3
kg. Do you conclude that the sample mean
is significantly different with the population
mean 2.5kg having standard deviation
0.5kg
Example 2
In a study on growth of children, one group of 100 children had a mean
height of 60 cm and SD of 2.5 cm while another group of 150 children
had a mean height of 62 cm and SD of 3 cm. Is the difference between
two groups statistically significant?
Given :
Mean SD sample size(n)
Group A 60 2.5 100
Group B 62 3 150
1. Hypothesis:
Null hypothesis: There is no difference between mean heights (Mean
height of group A = Mean height of group B)
Alternative hypothesis: There is difference between mean heights
(Mean height of group A ≠ Mean height of group B)
2. Test Statistic
X1 X 2
2 2
s1 s2
Z , whereSE ( X 1 X 2 )
SE ( X 1 X 2 ) n1 n2
60 62
z 6.06
2.52 32
100 150
3. Let level of significance (α) = 5%
Then tabulated value of Z at 5% level of significance =1.96
4. Comparison: Here calculated Z = 6.06 is greater than tabulated Z =
1.96 at 5% level of significance. Therefore null hypothesis is rejected
5. Conclusion: Since null hypothesis is rejected we conclude that there
is significant difference between the mean height of group A and
group B.
Common “Z” levels of
confidence
Commonly used confidence levels are 90%,
95%, and 99%
Confidence
Z value
Level
80% 1.28
90% 1.645
95% 1.96
98% 2.33
99% 2.58
99.8% 3.08
99.9% 3.27
Example 3
• In a certain hospital, it was recorded that
there were 190 female births out of 400
births in a year. Do you conclude that the
sex ratio is equal?
Or
• Is the proportion of female births equal to
½ or not
Example 4
In a community A, there were 25 smokers out of 60,
while in another community B, 75 out of 400 were
smokers. Do you conclude that the proportions of
smokers are significantly different or not?
Solution:
p1 = 25/60 =0.42 and p2 = 75/400=0.19
q1= 1-p1 = 1- 0.42 = 0.58 and q2 =1 -p2 = 1- 0.19 = 0.81
Null hypothesis(H0): Two sample propor1tions are equal
Alternative hypothesis(H1) : Two sample proportions are significantly
different
p1q1 p2q2 0.42 0.58 0.19 0.81
SE ( p1 p2 ) 0.06
n1 n2 60 400
• Now Z = p1 p2 0.42 0.19
3.83
SE ( p1 p2 ) 0.06
Comparison: Since calculated Z (3.83) is
greater then tabulated Z (1.96) at 5% level
of significance , we reject the null
hypothesis.
Conclusion: Since null hypothesis is
rejected we conclude that there is a
significant difference between two
proportions.
T test
• The t-test is any statistical hypothesis test in which
the test statistic follows a Student's t-distribution under
the null hypothesis.
• A t-test is most commonly applied when the test
statistic would follow a normal distribution.
• The t-statistic was introduced in 1908 by William Sealy
Gosset, a chemist working for
the Guinness brewery in Dublin, Ireland. "Student" was
his pen name.
• William Sealy Gosset, who developed the "t-statistic"
and published it under the pseudonym of "Student". So
the test became student t test
• A t-test is an analysis framework used to determine the
difference between two sample means from two
normally distributed populations with unknown
variances.
t – test ( Students' t-test )
• Criterion for using t-test
- distribution should be normal
- data set must be quantitative
- sample size should be less than 30
- not required the population variance
Use of t test
• Comparison between sample mean and population
mean whether they are significantly or not.(one
sample mean test)
• Comparison between two sample means
(Independent t test or unpaired t test)
• Comparison of two means of the same samples or
groups (dependent t test or paired t test)
• Used to test the correlation value (r) whether it is
significant or not
• Used to test the regression coefficient (b)value
t – test …Cont
one sample mean test
• H0 : μ = 0 ( sample mean and population mean are
equal)
H1 : μ 0(( sample mean and population mean are
significantly different )
t test X 0 s
t , whereSE ( X )
SE ( X ) n
s = standard deviation of sample and n= sample size
s
( X X ) 2
n 1
Degree of freedom = n-1
Problem
• An experiment was conducted to see if a given therapy works
to reduce test anxiety. A standard measure of average of
test anxiety was 20. In the sample of 7, the mean = 18 with
s = 22 were calculated. Do the sample mean is significantly
different with population mean?
Solution
Setting hypothesis
H0: sample mean and population mean are equal
H1: sample mean and population mean are not equal
Test statistic t X 0 , whereSE ( X ) s
SE ( X ) n
18 20
t 0.24 t 0.24 SE ( X )
22
8.33
8.33 7
T test
• Let level of significance = 5% and degree of freedom(df) =
7-1 = 6
• Then tabulated or critical value of t at 5% level of
significance and 6 df. = 2.44
Comparison:
Calculated t < tabulated t, so we accept the null hypothesis.
Conclusion:
Since the null hypothesis accepted, it can be concluded that
the average anxiety level obtained from sample is not
significantly different with given standard average. The
difference is due to chance.
Finding Critical Values
A portion of the t distribution table
47
Independent t test or unpaired test
• The independent samples t-test is used
when two separate sets of independent
and identically distributed samples are
obtained, one from each of the two
populations being compared.
• For example comparison of two means of:
case and control
Male and female
Urban and rural etc.
t – test (Independent Test)
Two samples mean test
H0: x1 = x2 ( two means are equal)
HA: x1 x2 two sample means are significantly different)
T test X1 X 2
t ,
SE ( X1 X 2 )
2 2
s1 s2
where SE ( X 1 X 2 ) (different population )
n1 n2
1 1
s (same population )
2
n1 n2
s1 (n1 1) s2 (n2 1)
2 2
where s
n1 n2 2
Degree of freedom = (n1+n2 - 2)
Example
Marks of 50 60 45 70 65 80
boys
Marks of 60 70 50 40 90 80
girls
Does it conclude that is there any significant
difference between the average marks of boys
and girls?
Paired t test or dependent test
It is used to compare the mean of two samples of the same
individuals.
Example
• To compare the effect before and after treatment
• Pre and post score after intervention
• To compare the effect of two drugs given to the same
individuals
• To compare the efficacy of two different instruments
• To compare the results of two different laboratory
techniques
• Fasting and random blood sugar
For testing the significance
difference
Hypothesis
• Ho: before and after mean are equal
• H1: before and after mean are different
Test statistic
t= d where d = difference between
SE (d )
before and after reading
d = mean difference
s , s = standard deviation
SE ( d )
n
S = (d d ) =
2
1
d
2
d
2
n 1 n 1 n
Degree of freedom = n-1
Conclusion
i. If calculated t < tabulated t, we accept
null hypothesis, then the difference is not
significant.
ii. If calculated t > tabulated t, we reject the
null hypothesis, then the difference is
significant.
Example
• A researcher wants to find the difference
of blood pressure before and after
exercise . He collected the following
information
Before(BP) 120 125 130 122 115 135
After (BP) 124 126 134 125 116 140
Can you conclude that the difference is
significant or not?
Solution
BP(Before) BP(after) d= d d (d d ) 2
difference
120 124 -4 -1 1
125 126 -1 2 4
130 134 -4 -1 1
122 125 -3 0 0
115 116 -1 2 4
135 140 -5 -2 4
Total -18 14
mean of difference ( d) = d
18
3
n 6
s2
(d d )2
14
2.8
n 1 5
SE( d ) = s/n= 1.67/ 6 = 0.68
Here,
H0: Before and after means are equal
H1 : Before and after means are significantly
different.
Test
d
t = SE (d ) = -3/ 0.68= - 4.41
t = 4.41
Tabulated t at 5% l.s. at 5 d.f. is 2.57
Comparison: Calculated t > tabulated t
So null hypothesis is rejected.
Conclusion: difference is significant
Finding Critical Values
A portion of the t distribution table
57