Tests for Variances

22
SADC Course in Statistics Tests for Variances (Session 11)

description

Tests for Variances. (Session 11). Learning Objectives. By the end of this session, you will be able to: identify situations where testing for a population variance, or comparing variances, may be applicable - PowerPoint PPT Presentation

Transcript of Tests for Variances

Page 1: Tests for Variances

SADC Course in Statistics

Tests for Variances

(Session 11)

Page 2: Tests for Variances

2To put your footer here go to View > Header and Footer

Learning Objectives

By the end of this session, you will be able to:

• identify situations where testing for a population variance, or comparing variances, may be applicable

• conduct a chi-square test for a single population variance or an F-test for comparing two population variances

• interpret results of tests concerning population variances

Page 3: Tests for Variances

3To put your footer here go to View > Header and Footer

Session ContentsIn this session you will• be shown why in some applications the

study of population means alone is not adequate

• be introduced to the chi-square and F tests for testing one population variance and comparing two population variances respectively

• see examples of the applicability of these tests

Page 4: Tests for Variances

4To put your footer here go to View > Header and Footer

Is the packing machine working properly?• Suppose people have lodged complaints

about the weight of the 12.5 Kg mealie-meal bags.

• A consultant took a sample of mealie-meal bags and did not find any problem with the average weight. That is, she could not reject the null hypothesis that the population mean weight = 12.5 Kg

What could be the problem?

Page 5: Tests for Variances

5To put your footer here go to View > Header and Footer

• Although the mean is OK in the above example, there could be a problem with the variance

• Packaging plants are designed to operate within certain specified precision

• Ideally it would be desirable to have the machine pack exactly 12.5 Kg in every bag but this is practically impossible. So a certain pre-specified variation is tolerated

Why study variance?

Page 6: Tests for Variances

6To put your footer here go to View > Header and Footer

• After years of operation it is always important to check whether the machine variation is still at the initially set level of precision (say )

• This implies testing the hypothesis

against the alternative

20

20 : H

20

20

21 : H

Testing for a single variance

2

Page 7: Tests for Variances

7To put your footer here go to View > Header and Footer

• A similar problem could occur if a factory manager is considering whether to buy packaging Machine A or Machine B.

• During test runs, Machine A produced sample variance while Machine B produced sample variance .

Question:

• Are these variances significantly different?

2As

2Bs

Comparing variances

Page 8: Tests for Variances

8To put your footer here go to View > Header and Footer

• Suppose the population variances for weights of mealie-meal bags packaged from machines A and B are respectively

and .

• We can answer the question concerning whether the variances are different by testing the null hypothesis

against the alternative .

We will return to this later in the session.

220 : BAH

2A

221 : BAH

2B

Test for comparing variances

Page 9: Tests for Variances

9To put your footer here go to View > Header and Footer

Other applicationsOther applications where testing for variancemay be important includes the following:• Foreign exchange stability is important in

any economy. Too much variation of a currency is not good.

• Price stability of other commodities is also important.

Question:Can you name other possible areas of application where testing that the variation remains stable at a pre-set value is important?

Page 10: Tests for Variances

10To put your footer here go to View > Header and Footer

The chi-square test

• This test applies when we want to test for a single variance.

• The null hypothesis is of the form

• Need to test this against the alternative

• The test is based on the comparison between and using the ratio

20

20 : H

20

21 : H

2s 20

20

2)1(

sn

Page 11: Tests for Variances

11To put your footer here go to View > Header and Footer

• Calculate the chi-square test statistic

Under H0, this is known to have a chi-square distribution with n-1 degrees of freedom.

• Compare this with chi-square tables, or use statistics software to get the p-value.

• Here, p-value = where is a chi-square random variable.

22

20

1( n )sX

2 21nP( X ) 2

1n

Conducting the test

Page 12: Tests for Variances

12To put your footer here go to View > Header and Footer

Form of Chi-square distribution

Value of calculated test-statistic

Shaded area represent the p-value

21n

Page 13: Tests for Variances

13To put your footer here go to View > Header and Footer

Back to Example

• Suppose the mealie-meal packaging machine is designed to operate with precision of .

• Suppose that data from a sample of 12 mealie-meal bags gave .

• Does the data indicate a significant increase in the variation?

2 20 0 0016. Kg

2 20 0025s . Kg

Page 14: Tests for Variances

14To put your footer here go to View > Header and Footer

Test computations and results

• The calculated chi-square value

• The p-value (based on a chi-square with 11 d.f.) is

indicating no significant increase in the variance.

22

20

11 0 00251 17 2

0 0016

s * .X ( n ) .

.

143.0)2.17( 2 P

Page 15: Tests for Variances

15To put your footer here go to View > Header and Footer

The F-test• The F-test is used for comparing two

variances, say and .

• The hypothesis being tested is

with either a one-sided alternative ; ;

or a two-sided alternative

220 : BAH

221 : BAH

221 : BAH

2A 2

B

2 21 A BH :

Page 16: Tests for Variances

16To put your footer here go to View > Header and Footer

The F-test• The null hypothesis is rejected, for large

values of the F-statistic below, in the case of a one-sided test

2

1 1 2

1

1A B

A

An ,n

B

B

sn

F .sn

• For a 2-sided test, need to pay attention to both sides of the F-distribution (see below).

Page 17: Tests for Variances

17To put your footer here go to View > Header and Footer

Example of an F-distribution

99.234.0

1% region (0.5% x2)

24 19,F

0.49 2.11

To use just the upper tail value, ensure F-ratio is calculated so it is >1, then use upper tail of the 2½% F-tabled value when testing at 5% significance.

Page 18: Tests for Variances

18To put your footer here go to View > Header and Footer

Numerical Example• Suppose 20 items produced on test trial of

Machine A gave

while 27 items produced by Machine B gave

• Does the data provide evidence that the working precision of the two machines are significantly different?

0016.02 Bs

0035.02 As

Page 19: Tests for Variances

19To put your footer here go to View > Header and Footer

Computations

• The value of the F-statistic is

• The p-value is 0.01 (from statistics software).

This indicate a significant difference in variance.

2

1 1 2

0 00351 19 2 990 0016

261A B

A

An ,n

B

B

s .nF .

.sn

Page 20: Tests for Variances

20To put your footer here go to View > Header and Footer

Tests for comparing several variances• Levene’s test – is robust in the face of

departures from normality. It is used automatically in some software before conducting other tests which are based on the assumption of equal variance

• Bartlett’s test – based on a chi-square statistic. The test is dependent on meeting the assumption of normality. It is therefore weaker than Levene’s test.

Page 21: Tests for Variances

21To put your footer here go to View > Header and Footer

References

• Gallagher, J. (2006) The F-test for comparing two normal variances: correct and incorrect calculation of the two-sided p-value. Teaching Statistics, 28, 58-60.

(this gives an example to show that some statistics software packages can give incorrect p-values for F-values close to 1.)

Page 22: Tests for Variances

22To put your footer here go to View > Header and Footer

Some practical work follows…