## PDF page 1

EMA1002 Engineering Mathematics 2
Hypothesis Testing for Mean
Basic Definitions
•A hypothesis is a proposed explanation for a phenomenon.
•The null hypothesis, denoted byH0, is a statistical hypothesis that states that there is no difference between a
parameter and a specific value, or that there is no difference between the two parameters.
•The alternative hypothesis, denoted byH 1, is a statistical hypothesis that states the existence of a difference
between a parameter and a specific value, or states that there is a difference between two parameters.
Null Hypothesis Alternative Hypothesis
H0 :µ=µ 0
H1 :µ < µ 0 left-tailed test (one-tailed)
H1 :µ > µ 0 right-tailed test (one-tailed)
H1 :µ̸=µ 0 two-tailed test
whereµ 0 is used to denote a number. Hypothesis testing can help us answer questions such as whether:
•a new medication helps change a person’s heart rate.
•a genetically modified food contains different levels of potassium.
Test statistics are sample statistics or values based on the sampledata. They help us determine if we should rejector
fail to rejectthenullhypothesis. Dependingontheconditions, wehavetousedifferenthypothesis tests (z-test or t-test) ,
as shown in the flowchart below.
Hypothesis Testing for Mean
Is the population
normally distributed?
Is the sample
sizen≥30?
The sample mean ¯Xis
normally distributed
or approximately
normally distributed
Not in EM2 Syllabus
Isσknown?
Usez−test
z0 = ¯x−µ
σ√n
Uset−test
t0 = ¯x−µ
s√n
,d f=n−1
No
Yes
Yes, by CLT No
Yes
No, onlysis known from the sample
Excel Formula
The formula to calculate the p-value for two-tailedz-test is:=2*(1-NORM.S.DIST(ABS(z0),TRUE))
The formula to calculate the p-value for two-tailedt-test is:=2*(T.DIST.RT(ABS(t0),n-1))
Adjust the formula accordingly when performing a one-tailed test (either left-tailed or right-tailed).
©EM2 ENG/TP Page 1 of 4

## PDF page 2

Example 1
A pharmaceutical company claims that the mean dose of a brand of drugs is 0.3 mg per pill. An independent consumer
group selected a random sample of 31 pills and recorded the data. The mean of the sample is 0.317 mg and the standard
deviation is 0.032 mg. Assume that the population standard deviation is 0.03 mg. Test the company’s claim at a 0.5%
significance level using a two-tailed test.
Step 1.Write down the null and alternative hypotheses and the level of significance
H0 :µ= 0.3
H1 :µ̸= 0.3(two-tailed test)
α= 0.5
100 = 0.005
Step 2.Compute test statistic
Since the population standard deviation is known, use z-test.
z0 = ¯x−µ
σ√n
=3.155
Step 3.Find the p value using Excel
P-value= 0.00160
Step 4.Compare the p value withα
P-value= 0.00160<0.005 =α
Step 5.Conclusion
There is sufficientevidence at the 0.5% significance level to reject the claim that the mean dosage is 0.3 mg.
The evidence suggests that the mean dosage differs from 0.3 mg.
Note:
The Excel formula to calculate the p-value for a two-tailed z-test is:=2*(1-NORM.S.DIST(ABS(z0),TRUE))
Example 2
A delivery company claims that its mean delivery time is 30 minutes. A customer service manager suspects that the
mean delivery time exceeds 30 minutes. A random sample of 40 deliveries has a mean delivery time of 31 minutes
and a sample standard deviation of 5 minutes. The population standard deviation is unknown. Test the manager’s
suspicion at the 5% significance level.
Step 1.Write down the null and alternative hypotheses and the level of significance
H0 :µ= 30
H1 :µ >30(right-tailed test)
α= 5
100 = 0.05
Step 2.Compute test statistic
Since the population standard deviation is unknown and the sample size is large, use a t-test.
t0 = ¯x−µ
s√n
= 31−30
5√
40
≈1.265 ,d f=n−1 = 39
Step 3.Find the p value using Excel
P-value= 0.10670
Step 4.Compare the p value withα
P-value= 0.10670>0.05 =α
Step 5.Conclusion
There is insufficient evidence at the 5% significance level to reject the claim that the mean delivery time is 30
minutes.
Note:
The Excel formula to calculate the p-value for a right-tailedt-test is:=T.DIST.RT(t0,n-1).
©EM2 ENG/TP Page 2 of 4

## PDF page 3

Confidence Interval for Mean
•The confidence levelis100(1−α)%, whereαis the significance level. It refers to the reliability of the estimation
process. If the sampling and estimation process were repeated many times,100(1−α)%of the confidence
intervals constructed would contain the true population parameter.
•A confidence intervalis a range of values calculated using sample data to estimate a population parameter at a
specified confidence level.
Is the population
normally distributed?
Is the sample
sizen≥30?
The sample mean ¯Xis
normally distributed
or approximately
normally distributed
Not in EM2
Syllabus
Isσknown?
Usez−distribution
¯x−z α
2
σ√n < µ <¯x+z α
2
σ√n
z α
2
σ√n is the Margin of ErrorE α
Uset−distribution
¯x−t α
2 ,n−1
s√n < µ <¯x+t α
2 ,n−1
s√n
t α
2 ,n−1
s√n is the Margin of ErrorE α
Yes
No, onlysis known from the sample
No
Yes Yes, by CLT No
Confidence Interval
Example 3
A random sample of 64 polytechnic students has a mean travelling time to campus of 47.5 minutes. The population
standard deviation is known to be 12 minutes. Find the 95% confidence interval for the population mean travelling
time to campus.
Step 1.Find the Margin of Error using Excel
Since the population standard deviation is known, use thez-distribution.
α= 1−0.95 = 0.05
Eα = 2.93995→=CONFIDENCE.NORM(0.05,12,64)
Step 2.Construct the Confidence Interval
¯x−Eα < µ <¯x+E α
47.5−2.93995< µ <47.5 + 2.93995
44.560< µ <50.440
Example 4
A random sample of 50 households has a mean internet download speed of 1.82 Gbps and a sample standard deviation
of 0.36 Gbps. The population standard deviation is unknown. Find the 99% confidence interval for the population
mean internet download speed.
Step 1.Find the Margin of Error using Excel
Since the population standard deviation is unknown, use thet-distribution.
α= 1−0.99 = 0.01
Eα = 0.13644→=CONFIDENCE.T(0.01,0.36,50)
Step 2.Construct the Confidence Interval
¯x−Eα < µ <¯x+E α
1.82−0.13644< µ <1.82 + 0.13644
1.684< µ <1.956
©EM2 ENG/TP Page 3 of 4

## PDF page 4

The Relationship between Probabilities and Area under Normal Curve
P(X >5.21)
5.21
Area This is the Area to the right of 5.21.
P(X <3.21)
3.21
Area This is the Area to the left of 3.21
P(−1.11< X <3.21)
3.21−1.11
Area
P(X <3.21)−P(X <−1.11)
p-value Approach
The diagrams below illustrate a two-tailed test with a positive observed test statisticz0. Here,pdenotes the total
two-tailed p-value.
Area to the right ofz α
2
= α
2
Area to the right ofz 0 is p
2
This is the distribution assuming the null hypothesisH 0 is correct
0 z α
2
z0
Sufficient evidence to reject the null hypothesis (H0) sincep≤α
Area to the right ofz α
2
= α
2
Area to the right ofz 0 is p
2
This is the distribution assuming the null hypothesisH 0 is correct
0 z0 z α
2
Insufficient evidence to reject the null hypothesis sincep > α
The above explanation works for thet-test as well. Take note thatz0 needs to be replaced witht0 andz α
2 needs to
be replaced witht α
2 ,n−1.z 0 andt 0 are known as the test statistics whereaszα
2 andt α
2 ,n−1 are known as the critical
values.
©EM2 ENG/TP Page 4 of 4