Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

C2 Foundation Mathematics

Lecture 7 Part1
The Z-test

INTO City University London


Skills

Perform a Z-test
I Write the null and alternative hypothesis

I Look up the critical value

I Calculate the test statistic

I Make the decision

I Write a conclusion
Hypothesis testing

We use hypothesis testing to compare the mean of a very large


data set, a population mean, with the mean of a sample data set, a
sample mean.
Hypothesis testing

We use hypothesis testing to compare the mean of a very large


data set, a population mean, with the mean of a sample data set, a
sample mean.

Question: A lightbulb company says their lightbulbs last a mean


time of 1000 hours with a standard deviation of 50. We think their
lightbulbs last longer than this and propose a test at a 5% level of
signicance. We buy 75 lightbulbs and they last a mean time of
1022 hours.
Hypothesis testing

We use hypothesis testing to compare the mean of a very large


data set, a population mean, with the mean of a sample data set, a
sample mean.

Question: A lightbulb company says their lightbulbs last a mean


time of 1000 hours with a standard deviation of 50. We think their
lightbulbs last longer than this and propose a test at a 5% level of
signicance. We buy 75 lightbulbs and they last a mean time of
1022 hours.

The POPULATION is all the lightbulbs that the company makes.


The POPULATION MEAN (lifetime) is 1000 hours.
The SAMPLE is the 75 light bulbs that we test.
The SAMPLE MEAN (lifetime) is 1022 hours.
The null hypothesis and the alternative hypothesis

I The null hypothesis, H0 , always concerns the population mean.


The null hypothesis and the alternative hypothesis

I The null hypothesis, H0 , always concerns the population mean.


I It is always of the form
H0 : µ = A

where µ is 'population mean' and A is the hypothetical value


The null hypothesis and the alternative hypothesis

I The null hypothesis, H0 , always concerns the population mean.


I It is always of the form
H0 : µ = A

where µ is 'population mean' and A is the hypothetical value


I The alternative hypothesis, H1 , is that the null hypothesis is
incorrect and will be one of
H1 : µ 6= A
H1 : µ < A
H1 : µ > A
The null hypothesis and the alternative hypothesis

I The null hypothesis, H0 , always concerns the population mean.


I It is always of the form
H0 : µ = A

where µ is 'population mean' and A is the hypothetical value


I The alternative hypothesis, H1 , is that the null hypothesis is
incorrect and will be one of
H1 : µ 6= A
H1 : µ < A
H1 : µ > A

I The question will direct you which of the above to use.


Hypothesis testing and signicance levels

I The null hypothesis, H0 is initially assumed to be true.


Hypothesis testing and signicance levels

I The null hypothesis, H0 is initially assumed to be true.


I Sample data is tested to see if it is consistent with the null
hypothesis.
Hypothesis testing and signicance levels

I The null hypothesis, H0 is initially assumed to be true.


I Sample data is tested to see if it is consistent with the null
hypothesis.
I If the sample mean is signicantly dierent from the
population mean, then we say that we have sucient evidence
to reject the null hypothesis, H0 , in favour of the alternative
hypothesis, H1 .
Hypothesis testing and signicance levels

I The null hypothesis, H0 is initially assumed to be true.


I Sample data is tested to see if it is consistent with the null
hypothesis.
I If the sample mean is signicantly dierent from the
population mean, then we say that we have sucient evidence
to reject the null hypothesis, H0 , in favour of the alternative
hypothesis, H1 .
I The null hypothesis, H0 , will always be tested at a given level
of signicance.
Hypothesis testing and signicance levels

I The null hypothesis, H0 is initially assumed to be true.


I Sample data is tested to see if it is consistent with the null
hypothesis.
I If the sample mean is signicantly dierent from the
population mean, then we say that we have sucient evidence
to reject the null hypothesis, H0 , in favour of the alternative
hypothesis, H1 .
I The null hypothesis, H0 , will always be tested at a given level
of signicance.
I A 5% level of signicance means we are testing to see if the
probability of getting the sample data by chance is less than
5/100. If the probability is less than 5/100, then we reject H0
and accept H1 .
Hypothesis testing and signicance levels

I The null hypothesis, H0 is initially assumed to be true.


I Sample data is tested to see if it is consistent with the null
hypothesis.
I If the sample mean is signicantly dierent from the
population mean, then we say that we have sucient evidence
to reject the null hypothesis, H0 , in favour of the alternative
hypothesis, H1 .
I The null hypothesis, H0 , will always be tested at a given level
of signicance.
I A 5% level of signicance means we are testing to see if the
probability of getting the sample data by chance is less than
5/100. If the probability is less than 5/100, then we reject H0
and accept H1 .
I A 1% level of signicance translates to a probability of 1/100.
Critical value

I A critical value is the value beyond which we reject the null


hypothesis. It tells us the boundary of the critical region(s)
Critical value

I A critical value is the value beyond which we reject the null


hypothesis. It tells us the boundary of the critical region(s)
I In a Z-test this depends on the alternative hypothesis and the
signicance level.
Critical value

I A critical value is the value beyond which we reject the null


hypothesis. It tells us the boundary of the critical region(s)
I In a Z-test this depends on the alternative hypothesis and the
signicance level.
I We look up the critical value(s) in tables.
Sig. Lev. 5% Sig. Lev. 1%
One-tail Two-tail One-tail Two-tail
Critical value 1.65 1.96 2.33 2.58
H1 : µ 6= A

If our alternative hypothesis is H1 : µ 6= A we are doing a two-tailed


test and we have 2 critical values, one negative and one positive.
The critical value is the boundary of the rejection region.
For a 5% level of signicance we have the following picture:

−1.96 1.96

The rejection (shaded) regions have a combined area of 5% of the


total area under the curve.
H1 : µ > A

If our alternative hypothesis is H1 : µ > A we are doing a


one-tailed test and we have 1 critical value which is positive.
The critical value is the boundary of the rejection region.
For a 5% level of signicance we have the following picture:

1.65

The rejection region has an area of 5% of the total area under the
curve.
H1 : µ < A

If our alternative hypothesis is H1 : µ < A we are doing a


one-tailed test and we have 1 critical value which is negative.
The critical value is the boundary of the rejection region.
For a 5% level of signicance we have the following picture:

−1.65

The rejection region has an area of 5% of the total area under the
curve.
Test statistic

I The test statistic is dierence between the sample mean, x̄


and the (hypothetical) population mean A, divided by the
standard error.
I The standard error is σ/√n for the Z -test and s/√n for the
T -test, where n is the sample size, σ is the population
standard deviation and s is the sample standard deviation.
Test statistic

I The test statistic is dierence between the sample mean, x̄


and the (hypothetical) population mean A, divided by the
standard error.
I The standard error is σ/√n for the Z -test and s/√n for the
T -test, where n is the sample size, σ is the population
standard deviation and s is the sample standard deviation.
I The test statistic is
x̄ − A
σ/√n
Test statistic

I The test statistic is dierence between the sample mean, x̄


and the (hypothetical) population mean A, divided by the
standard error.
I The standard error is σ/√n for the Z -test and s/√n for the
T -test, where n is the sample size, σ is the population
standard deviation and s is the sample standard deviation.
I The test statistic is
x̄ − A
σ/√n

I If the test statistic lies beyond the critical value(s) (in the
rejection region) we reject H0 . If it does not, we accept H0 .
Z-test - example 1

Research says that the mean height for a man is 182cm with a
standard deviation of 9. We suspect men might be shorter than
this. We get the heights of 100 men and their mean height is 176.
We test at a 1% level of signicance.
Z-test - example 1

I The null hypothesis and alternative hypothesis are:


H0 : µ = 182
H1 : µ < 182
Z-test - example 1

I The null hypothesis and alternative hypothesis are:


H0 : µ = 182
H1 : µ < 182
I We are doing a 1-tailed test at a 1% level of signicance so
the critical value is −2.33.
Z-test - example 1

I The null hypothesis and alternative hypothesis are:


H0 : µ = 182
H1 : µ < 182
I We are doing a 1-tailed test at a 1% level of signicance so
the critical value is −2.33.
I The test statistic is 176−182
9/ 100 = −6.67 to 2 d.p.

Z-test - example 1

I The null hypothesis and alternative hypothesis are:


H0 : µ = 182
H1 : µ < 182
I We are doing a 1-tailed test at a 1% level of signicance so
the critical value is −2.33.
I The test statistic is 176−182
9/ 100 = −6.67 to 2 d.p.

I −6.67 < −2.33 so we reject the null hypothesis.


I We conclude that the mean height for a man is less than
182cm.
Z-test - example 2

A company says employees are supposed to work an average of 40


hours a week with a standard deviation of 5 hours. Alfred wants to
know if he ts this to a 5% level of signicance. He notes down how
many hours he works over 48 weeks and has a mean of 39 hours.
Z-test - example 2

I The null hypothesis and alternative hypothesis are:


H0 : µ = 40
H1 : µ 6= 40
Z-test - example 2

I The null hypothesis and alternative hypothesis are:


H0 : µ = 40
H1 : µ 6= 40
I We are doing a 2-tailed test at a 5% level of signicance so
the critical values are ±1.96.
Z-test - example 2

I The null hypothesis and alternative hypothesis are:


H0 : µ = 40
H1 : µ 6= 40
I We are doing a 2-tailed test at a 5% level of signicance so
the critical values are ±1.96.
I The test statistic is 39−40
5/ 48 = −1.39 to 2 d.p.

Z-test - example 2

I The null hypothesis and alternative hypothesis are:


H0 : µ = 40
H1 : µ 6= 40
I We are doing a 2-tailed test at a 5% level of signicance so
the critical values are ±1.96.
I The test statistic is 39−40
5/ 48 = −1.39 to 2 d.p.

I −1.96 < −1.39 < 1.96 so we accept the null hypothesis.


I We conclude that Alfred works an average of 40 hours a week.
Z-test - example 3

A lightbulb company says their lightbulbs last a mean time of 1000


hours with a standard deviation of 50. We think their lightbulbs last
longer than this and propose a test at a 5% level of signicance.
We buy 75 lightbulbs and they last a mean time of 1022 hours.
Z-test - example 3

I The null hypothesis and alternative hypothesis are:


H0 : µ = 1000
H1 : µ > 1000
Z-test - example 3

I The null hypothesis and alternative hypothesis are:


H0 : µ = 1000
H1 : µ > 1000
I We are doing a 1-tailed test at a 5% level of signicance so
the critical value is 1.65.
Z-test - example 3

I The null hypothesis and alternative hypothesis are:


H0 : µ = 1000
H1 : µ > 1000
I We are doing a 1-tailed test at a 5% level of signicance so
the critical value is 1.65.
I The test statistic is 1022−1000

50/ 75 = 3.81 to 2 d.p.
Z-test - example 3

I The null hypothesis and alternative hypothesis are:


H0 : µ = 1000
H1 : µ > 1000
I We are doing a 1-tailed test at a 5% level of signicance so
the critical value is 1.65.
I The test statistic is 1022−1000

50/ 75 = 3.81 to 2 d.p.
I 1.65 < 3.81 so we reject the null hypothesis.
I We conclude that the lightbulbs do last longer than 1000
hours.
Z-test summary

I You will be given


1. Population mean, A
2. Population standard deviation, σ , or variance, σ 2
3. Signicance level
4. Sample mean, x̄
5. Sample size, n
6. Quantifying word.
I You have to work out
1. Null hypothesis, alternative hypotheis
2. Critical value(s), look it up in a table
3. Test statistic, σx̄−A

/ n
4. Decision - accept/reject H0 (sketch a picture)
5. Conclusion

You might also like