BBTC 3282: BIOSTATISTICS
DR. NURUL AIN MOHAMAD ISHAK
nurulain@cyberjaya.edu.my
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
COMPARING MEAN
(Z-TEST AND ONE SAMPLE T-TEST)
WEEK 8
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
Topic/ Chapter Learning Outcome
The objective of this chapter is to expose the
student the technique of comparing mean between
Z-test and T-test.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
COMPARING MEAN
• Hypothesis test to determine whether there is a statistically significant
different between mean, either for a single sample or for multiple
independent or related samples.
• To compare means for 2 populations or samples. Which technique you use
depends on what type of data you have and how that data is group together.
• Techniques:
• Z-Test
• One sample T-Test
• Paired samples T-Test
• Independent samples T-Test
• One way ANOVA
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
Z-TEST VS T-TEST
• Z-TEST: statistical test used to determine whether there is a significant
difference between the sample mean and the population mean or
between the means of 2 groups when the population standard deviation
is known and the sample size is large.
• T-TEST: Statistical test used to determine whether there is a significant
difference between the means of 2 groups or between a sample mean is
given. It is particularly useful when dealing with small sample sizes or
when the population standard deviation is unknown.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
Z-TEST VS T-TEST
Z-TEST
T-TEST
Sample size is large (n >30) and Sample size is small (n<30) and
the population standard
the population standard
deviation/variance is known. deviation/variance is unknown.
The data normal distribution.
The data is t-distribution.
Not required Degree of
Required Degree of Freedom.
Freedom.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
Z-TEST
• Primarily used when the sample size exceeds 30, allowing the use of the
normal distribution to approximate the distribution of the test statistic.
• When to use Z-test:
• The sample size should be greater than 30.
• Samples should be drawn at random from the population
• The standard deviation of the population should be known.
• Samples that are drawn from the population should be independent of each
other.
• The data should be normally distributed, however for a large sample size, it is
assumed to have a normal distribution because central limit theorem.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
Z-TEST_STEP
1)
2)
3)
4)
Identify the null hypothesis and alternate hypothesis.
Determine the level of significance (๐ผ)
Based on significance value, find the critical value of Z-score in Z-Table.
Calculate the z-test statistics:
(๐เดค − ๐)
๐=
๐
( )
๐
Where:
เดค
๐:mean
of the sample
๐: mean of the population
๐: standard deviation of the population
n: Sample size
5)
Compare with the hypothesis and decide whether to reject or not reject the null hypothesis.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
TYPE OF Z-TEST
Left-tailed Test
Right-tailed Test
Two-tailed Test
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
ONE-TAILED TEST
CASE:
A school claimed that the students who study that are more intelligent
than the average school. On calculating the IQ scores of 50 students, the
average turns out to be 110. The mean of the population IQ is 100 and
the standard deviation is 15. State whether the claim of the principal is
right or not at a 5% significance level.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CALCULATION
• Identify the hypothesis:
Null Hypothesis: The average of IQ score is equal to 100. (๐ป๐ : ๐ = 100)
Alternate Hypothesis: The average of IQ score is more than 100
(๐ป๐ด : ๐ > 100)
• State the level of significance
(๐ผ = 0.05)
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CALCULATION
• Determine the Z-score:
๐เดค − ๐
๐ − ๐ ๐๐๐๐ =
๐Τ ๐
Where: ๐เดค = 110 ; ๐ = 100; ๐ = 15; ๐ = 50
110 − 100
๐ − ๐ ๐๐๐๐ =
= 4.71
15
50
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CALCULATION
• Determine the critical value from z-table.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CONCLUSION
• When ๐ผ = 0.05, the z-score for the right-tailed test is 1.65.
• Thus, 4.71 > 1.65, so we reject the null hypothesis. The average of IQ
score is more than 100.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
TWO-TAILED TEST
• In this test, we have 2 normally distributed and independent populations, and
we have drawn samples at random from both populations. Where we will
consider ๐1 ๐๐๐ ๐2 as population mean, meanwhile, ๐1 ๐๐๐ ๐2 to be
observed sample mean. Thus, hypothesis could be like:
๐ป0 : ๐1 − ๐2 = 0
๐ป๐ด : ๐1 − ๐2 ≠ 0
And z-test score:
๐1 − ๐2 − ๐1 − ๐2
๐=
๐12 ๐22
+
๐1 ๐2
Where ๐1 and ๐2 are the standard deviation and ๐1 and ๐2 are the sample size
of population corresponding to ๐1 and ๐2
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
TWO-TAILED TEST
Case:
There are 2 groups of students preparing for a competition: Group A and
Group B. Group A has studied offline classes, while Group B has studied
online classes. After the examination, the score of each student comes.
Now we want to determine whether the online or offline classes are
better.
Group A: sample size= 50, sample mean=75, sample standard
deviation=10.
Group B: sample size=60, sample mean=80, sample standard deviation=12
Assuming a 5% significance level, perform a two-sample z-test to
determine if there is a significant difference between the online and
offline classes.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CALCULATION
• Identify the hypothesis:
Null hypothesis: there is no significant difference between the mean score
between the online and offline classes (๐ป0 : ๐1 − ๐2 = 0)
Alternate Hypothesis: There is a significant difference in the mean scores
between the online and offline classes (๐ป๐ด : ๐1 − ๐2 ≠ 0)
• Significance Level
๐ผ = 0.05
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CALCULATION
• Calculate the z-score
๐=
๐1 − ๐2 − ๐1 − ๐2
๐12 ๐22
+
๐1 ๐2
๐=
75 − 80 − 0
102 122
+
60
50
= −2.384
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
๐ผ
• Critical Z-score value in Z-Table for = 0.025
2
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CONCLUSION
• From the table, critical Z-score= 1.96
• Compare with absolute Z-score value:
• Absolute Z-score >Critical Z-score.
• Thus, reject the null hypothesis. There is a significant difference between
the online and offline classes.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
T-TEST
• T-test is an inferential statistical test used to compare two or more
interval or ratio data group.
• The t-test requirement:
• Interval or ratio measurement scale: the data should be in continuous data scales
which are scores and values where the intervals between scores are the same
(ex: mathematics score, age, etc)
• Random sampling: Subjects in the sample should be randomly selected from the
population.
• Normality: Data in the population must be normally distributed.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
T-TEST
• Types of t-test:
• One sample t-test: when you want to compare means between one data set and
a specified constant (like the mean from a hypothetical normal distribution)
• Paired sample t-test: when you have 1 group tested at 2 different times. 2
measurements on the same item, person or thing. Ex: comparison of mean for
group of patients before treatment and after treatment.
• Independent sample t-test: When you want to compare means for 2 data sets
that are independent from each other.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
ONE SAMPLE T-TEST
• Compares the mean of your sample data to known value. E.g: you might
want to know how your sample mean compares to the population mean.
• Should run a one sample t-test when you don’t know the population
standard deviation, or you have a small sample size.
• One-sample t-test formula:
(๐เดค − ๐)
๐=
๐Τ ๐
Where: ๐เดค is the sample mean, ๐ is the population mean, S is the standard
deviation of the sample and n is the number of the sample observations.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
ONE-SAMPLE T-TEST_STEP
1) State the hypothesis
2) Calculate the T-statistics and Degree of Freedom
3) Determine the critical value
4) Make a decision
5) Interpret the results.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
ONE-SAMPLE T-TEST
CASE:
Your company wants to improve sales. Past sales data indicate that the
average sale was RM 100 per transaction. After training your sales force,
recent sales data (taken from a sample of 25 salesmen) indicates an
average sale of RM 130, with a standard deviation of RM 15. Did the
training work? Test your hypothesis at a 5% alpha level.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CALCULATION
• State the hypothesis:
Null Hypothesis: There is no different in sales. ๐ป0 : ๐ = ๐
๐ 100.
Alternate Hypothesis: The mean sale will be increase. ๐ป๐ด : ๐ > ๐
๐100
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CALCULATION
• Determine the T score:
(๐เดค − ๐)
๐=
๐Τ ๐
๐=
130 − 100
15Τ 25
= 10
• Degree of Freedom:
๐๐ = ๐๐ข๐๐๐๐ ๐๐ ๐ ๐๐๐๐๐ ๐ − 1 = 25 − 1 = 24
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
CONCLUSION
• From the table, critical T-score= 1.711
• Compare with absolute T-score value:
• Absolute T-score >Critical T-score.
• Thus, reject the null hypothesis. The mean sale will be increase.
© 2019, University of Cyberjaya. Please do not reproduce, redistribute or share without the prior express permission of the author.
Thank you
Address
University of Cyberjaya
Persiaran Bestari,
Cyber 11, 63000 Cyberjaya,
Selangor Darul Ehsan, Malaysia.
Telephone
03 - 8313 7000
Website
www.cyberjaya.edu.my
Facsimile
03 – 8313 7001
Email
inquiry@cyberjaya.edu.my