Skip to main content

Exercise 2

This example was also used in interactive exercise 2 in Chapter 7. The aim of this exercise (exercise 2, Chapter 8) is to allow you to test your understanding of sections 4.1.2, 8.5 and 8.7 and illustrates why you may obtain negative values in a non-parametric ANOVA. .

Example W8.3: The inhibitory effect of oregano oil and selected antibiotics on certain bacteria

As part of a larger investigation an undergraduate examined the effectiveness of the essential oil from oregano in comparison with commercial antibiotics. Each substance (oregano oil etc) was added to a small disc of paper and placed on to agar plates inoculated either with Escherichia coli or Pseudomonas aeruginosa. After incubating the plates for 24 hours at 37°c the zone of inhibition was recorded. The zone of inhibition is the mean diameter (mm) of the area of clear agar around the discs containing the substance under test (Table W8.3). The size of the zone of inhibition indicates the area over which the bacteria have been killed or their growth inhibited. Eight replicate plates were used for each treatment.

Table W8.3: The mean diameter of the zone of inhibition (mm) produced on agar plates inoculated either with Escherichia coli or Pseudomonas aeruginosa as a result of treatment with either oregano essential oil or streptomycin

 

Mean diameter of

zone of inhibition (mm)

 

E. coli

P. aeruginosa

Streptomycin

17.0

12.0

 

16.0

11.0

 

16.0

11.0

 

15.0

10.0

 

16.0

10.0

 

16.0

11.0

 

16.0

11.0

 

17.0

11.0

Oregano oil

21.0

10.0

 

22.0

9.0

 

21.0

10.0

 

21.0

10.0

 

24.0

10.0

 

22.0

10.0

 

20.0

10.0

 

22.0

10.0



The scale of measurement used (mm) is an interval scale but there are only 8 replicates for each treatment so it is difficult to confirm that the data are parametric. If the data were parametric it could be analysed using a parametric two-way ANOVA. One criteria for using this parametric test is that the variances have to be homogeneous (7. 7.1) which can be confirmed using an Fmax test (BOX 7.5). When the Fmax test was carried out on this data it was clear that Fmax calculated (11.29) was greater than Fmax critical (8.44) at p = 0.05, so the variances are not homogeneous and this criterion is not met. Therefore the data will be analysed using non-parametric tests.

1

Q W2.1

The undergraduate decided to use a two-way non-parametric ANOVA to test general hypotheses. Write out in full the general hypotheses she was testing.

[If you would like to save a record of your answer, please type it into this Word document instead of the text box below]

Since this is a two-way ANOVA we are examining three pairs of hypotheses. The first relate to variable one (species of bacteria), the second to variable two (potential bactericide treatments) and the third to the possible interaction between the two variables.

(Columns)

H0: There is no difference between the medians of the 'mean diameter' of the zone of inhibition (mm) between Escherichia coli and Pseudomonas aeruginosa when treated with possible bactericides.

H1: There is a difference between the medians of the 'mean diameter' of the zone of inhibition (mm) between Escherichia coli and Pseudomonas aeruginosa when treated with possible bactericides.

(Rows)

H0: There is no difference between the medians of the 'mean diameter' of the zone of inhibition (mm) resulting from treatment by oregano oil compared to streptomycin on plates inoculated with bacteria.

H1: There is a difference between the medians of the 'mean diameter' of the zone of inhibition (mm) resulting from treatment by oregano oil compared to streptomycin on plates inoculated with bacteria.

(Interaction)

H0: There is no difference between the medians of the 'mean diameter' of the zone of inhibition (mm) due to an interaction between bacteria species and putative bactericide.

H1: There is a difference between the medians of the 'mean diameter' of the zone of inhibition (mm) due to an interaction between bacteria species and putative bactericide.

Check your answer

2

Q W2.2

Test the first and second of these pairs of hypotheses. What is the outcome? In the answer boxes below record Fcalculated to 2 decimal places.

[If you would like to save a record of your answer, please type it into this Word document]

Columns: Difference between bacteria species; Fcalcuated =
Rows: Difference between bactericides; Fcalcuated =

Columns: Difference between bacteria species; Fcalcuated = 22.72

Rows: Difference between bactericides; Fcalcuated = -0.3

Check your answer

Below we have shown how to calculate the three figures:

Columns

Rows

Interaction

[Note that there isn't an easy way to do any of these calculations in Excel, SPSS or Minitab.]

Full calculation for the Columns hypotheses

  1. Hypotheses to be tested

H0: There is no difference between the medians of the 'mean diameter' of the zone of inhibition (mm) between Escherichia coli and Pseudomonas aeruginosa when treated with possible bactericides.

H1: There is a difference between the medians of the 'mean diameter' of the zone of inhibition (mm) between Escherichia coli and Pseudomonas aeruginosa when treated with possible bactericides.

  1. To work out K calculated.

i, ii and iii Table W8.4.

There are two columns E. coli and P. aeruginosa and 16 observations in each column.

Table W8.4: Calculation table for two-way non-parametric ANOVA test: General hypotheses (columns) examining the mean diameter of the zone of inhibition (mm) produced on agar plates inoculated either with E. coli or P. aeruginosa as a result of treatment with either oregano essential oil or streptomycin

 

E.

coli

P. aeruginosa

 
 

Mean diameter of zone of inhibition (mm)

Rank

Mean diameter of zone of inhibition (mm)

Rank

Streptomycin

17.0
16 .0
16.0
15.0
16.0
16.0
16.0
17.0

23
20
20
17
20
20
20
23

12.0
11.0
11.0
10.0
10.0
11.0
11.0
11.0

16
13
13
6
6
13
13
13

Oregano oil

21.0
22.0
21.0
21.0
24.0
22.0
20.0
22.0

27
30
27
27
32
30
25
30

10.0
9.0
10.0
10.0
10.0
10.0
10.0
10.0

6
1
6
6
6
6
6
6

Totals for the columns

n

R

R2

R over n

16

391

152881

9555.0625

n

R

R2

R over n

16

136

18496

1156



iv.

R over n

Σ (R2/n) = 9555.0625 + 1156 = 10711.0625

N = 16 + 16 = 32

v. Kcalculated columns

= K (calculated columns) = K (calculated columns)

= (10711.0625 × 0.01136) - 99

= 121.71662 - 99 = 22.71662

  1. To find K critical
Using a table of critical values for chi-squared and p = 0.05. The degrees of freedom (degrees of freedom) = number of columns - 1. This is a two-tailed test.

degrees of freedom= 2 - 1 = 1

Kcritical columns = 3.84 at p = 0.05

  1. The rule

K calculated columns (22.72) is more than Kcritical (3.84). You may therefore reject the null hypothesis (H0).

In fact at p = 0.001, Kcritical = 10.83. Therefore, we can reject the null hypothesis at this higher level of significance.

  1. What does this mean in real terms?

There is a highly significant difference (K = 22.72, p = 0.001) medians of the 'mean diameter' of the zone of inhibition (mm) between Escherichia coli and Pseudomonas aeruginosa when treated with possible bactericides.

Full calculation for the Rows hypotheses

  1. Hypotheses to be tested

H0: There is no difference between the medians of the 'mean diameter' of the zone of inhibition (mm) resulting from treatment by oregano oil compared to streptomycin on plates inoculated with bacteria.

H1: There is a difference between the medians of the 'mean diameter' of the zone of inhibition (mm) resulting from treatment by oregano oil compared to streptomycin on plates inoculated with bacteria.

  1. To work out K calculated.

i, ii. Table W8.5.

There are two rows 'streptomycin' and 'oregano oil' each with 16 observations in the row.

Table W8.5: Calculation table for two-way non-parametric ANOVA test: General hypotheses (columns) examining the mean diameter of the zone of inhibition (mm) produced on agar plates inoculated either with E. coli or P. aeruginosa as a result of treatment with either oregano essential oil or streptomycin

   

Mean diameter of zone of inhibition (mm)

Rank

Terms for calculation

 

Streptomycin

E.coli

17.0
16.0
16.0
15.0
16.0
16.0
16.0
17.0

23
20
20
17
20
20
20
23

n

R

R2

R over n

16

256

65536

4096

 

P. aeruginosa

12.0
11.0
11.0
10.0
10.0
11.0
11.0
11.0

16
13
13
6
6
13
13
13

   

Oregano oil

E.coli

21.0
22.0
21.0
21.0
24.0
22.0
20.0
22.0

27
30
27
27
32
30
25
30

n

R

R2

R over n

16

271

73441

4590.0625

 

P. aeruginosa

10.0
9.0
10.0
10.0
10.0
10.0
10.0
10.0

6
1
6
6
6
6
6
6

   


iii.

R over n

ΣR2/n = 4096 + 4590.0625 = 8686.0625

Σn = N = 16 + 16 = 32

iv. Kcalculated rows

= K (calculated rows) = K (calculated rows)

= (8686.0625 × 0.01136) - 99 = 98.70526 - 99 = -0.2947

  1. To find K critical

Using a table of critical values for (2 and p = 0.05. The degrees of freedom (degrees of freedom) = number of columns - 1. This is a two-tailed test.

Since degrees of freedom= 2 - 1 = 1, then Kcritical rows = 3.84 at p = 0.05

  1. The rule

Kcalculated rows (-0.2947) is less than Kcritical (3.84). You may not reject the null hypothesis (H0).

  1. What does this mean in real terms?

There is no significant difference (K = -0.3, p = 0.05) between the medians of the 'mean diameter' of the zone of inhibition (mm) resulting from treatment by oregano oil compared to streptomycin on plates inoculated with bacteria.

Full calculation for the Interaction hypotheses

  1. Hypotheses to be tested

H0: There is no difference between the medians of the 'mean diameter' of the zone of inhibition (mm) due to an interaction between bacteria species and putative bactericide.

H1: There is a difference between the medians of the 'mean diameter' of the zone of inhibition (mm) due to an interaction between bacteria species and putative bactericide.

  1. To work out K calculated

i. Table W8.6. There are four samples A - D, each with 8 observations.

Table W8.6: Calculation table for two-way non-parametric ANOVA test: General hypotheses (interaction) examining the mean diameter of the zone of inhibition (mm) produced on agar plates inoculated either with E. coli or P. aeruginosa as a result of treatment with either oregano essential oil or streptomycin

 

E.

coli

P. aeruginosa

 
 

Mean diameter of zone of inhibition (mm)

Rank

Mean diameter of zone of inhibition (mm)

Rank

Streptomycin

17.0

16 .0

16.0

15.0

16.0

16.0

16.0

17.0

23

20

20

17

20

20

20

23

12.0

11.0

11.0

10.0

10.0

11.0

11.0

11.0

16

13

13

6

6

13

13

13

Totals for the sample

A

n

R

R2

RA2/nA

A

8

163

26569

3321.125

B

n

R

R2

RB2/nB

B

8

93

8649

1081.125

Oregano oil

21.0

22.0

21.0

21.0

24.0

22.0

20.0

22.0

27

30

27

27

32

30

25

30

10.0

9.0

10.0

10.0

10.0

10.0

10.0

10.0

6

1

6

6

6

6

6

6

Totals for the sample

C

n

R

R2

RC2/nC

C

8

228

51984

6498

D

n

R

R2

RD2/nD

D

8

43

1849

231.125



ii. ΣR2/n = 3321.125 + 1081.125 + 6498 + 231.125 = 11131.375

iii. N = 8 + 8 + 8 + 8 = 32

iv. Kcalculated total = K (calculated total)

= K (calculated total) = K (calculated total)

= 126.4929 - 99 = 27.4929

v.

Kinteraction

Kcolumns = 22.71662

Krows = -0.2947

Ktotal = 27.4929

Kinteraction = 27.4929 - 22.71662 - (-0.2947) = 5.07098

  1. To find K critical

degrees of freedomfor Ktotal= 4 - 1 = 3

degrees of freedomfor Kbacteria= 4 - 1 = 3

degrees of freedomfor Kbactericides = 4 - 1 = 3

degrees of freedomfor Kinteraction= 4 - 1 = 3

Therefore, the critical value for Kinteraction at p = 0.05 and × = 1 is 3.84.

  1. The rule

Kcalculated interaction (5.07) is more than Kcritical (3.84) so you may reject the null hypothesis.

  1. What does this mean in real terms?

There is a significant difference (Kcalculated interaction 5.07, p = 0.05) between the medians of the 'mean diameter' of the zone of inhibition (mm) due to an interaction between bacteria species and putative bactericide.

3

Q W2.3

When testing the hypotheses relating to the rows the result is a negative number. Negative numbers can arise in this calculation if you have a number of tied ranks. If you examine table W8.4 you will see that only 4 of the 32 values do not have a tied rank. It is not therefore possible to continue with this test.

As a result the student decided to use the Scheirer-Ray-Hare test to examine these data. Are the criteria for using this test met?

[If you would like to save a record of your answer, please type it into this Word document]

a) Yes
b) No
Correct.

Criterion

Is it met?

1. Wish to test for differences in population medians.

Yes.

2. Have two treatment variables each with at least two categories.

Yes. The two variables are 'species of bacteria' and 'possible bactericides'

3. The design is orthogonal.

Yes. Every species of bacteria is tested with each bactericide.

4. Have non-parametric data that can be ranked.

Yes. The scale of measurement is mm which is an interval scale which is ordered in numerical order.



Incorrect.

Criterion

Is it met?

1. Wish to test for differences in population medians.

Yes.

2. Have two treatment variables each with at least two categories.

Yes. The two variables are 'species of bacteria' and 'possible bactericides'

3. The design is orthogonal.

Yes. Every species of bacteria is tested with each bactericide.

4. Have non-parametric data that can be ranked.

Yes. The scale of measurement is mm which is an interval scale which is ordered in numerical order.



Check your answer

4

Q W2.4

Carry out the Scheirer- Ray- Hare test and complete this ANOVA table. Have you completed the table?

a) Yes
b) No

Table W8.8: ANOVA table for analysis of data from Example W8.3. The inhibitory effect of oregano oil and selected antibiotics on certain bacteria

Source of variation

SS

degrees of freedom

s2

Hcalculated

Hcritical

p

Between species

(columns)

2032.03

1

 

23.95

10.83

0.001

Between bactericides

(rows)

7.03

1

 

0.083

3.84

0.05

Interaction

Species × bactericides.

413.31

1

 

4.87

3.84

0.05

Total

2629.97

31

84.84

     


Complete the table before checking our answer!
Check your answer

Check our full calculation to see how the numbers in table W8.8 were obtained.

We have also shown how to calculate this using the following software packages:

Excel

[Note that there isn't an easy way to do this calculation in SPSS or Minitab.]

Full calculation for Q W2.4

  1. General hypotheses to be tested

(Columns)

H0: There is no difference between the medians of the 'mean diameter' of the zone of inhibition (mm) between Escherichia coli and Pseudomonas aeruginosa when treated with possible bactericides.

H1: There is a difference between the medians of the 'mean diameter' of the zone of inhibition (mm) between Escherichia coli and Pseudomonas aeruginosa when treated with possible bactericides.

(Rows)

H0: There is no difference between the medians of the 'mean diameter' of the zone of inhibition (mm) resulting from treatment by oregano oil compared to streptomycin on plates inoculated with bacteria.

H1: There is a difference between the medians of the 'mean diameter' of the zone of inhibition (mm) resulting from treatment by oregano oil compared to streptomycin on plates inoculated with bacteria.

(Interaction)

H0: There is no difference between the medians of the 'mean diameter' of the zone of inhibition (mm) due to an interaction between bacteria species and putative bactericide.

H1: There is a difference between the medians of the 'mean diameter' of the zone of inhibition (mm) due to an interaction between bacteria species and putative bactericide.

  1. How to work out F calculated
    1. Calculate general terms

In this test we use only the ranks that have been assigned to each observation and not the actual observations (Table W8.7).

Table W8.7: Calculation table for a Sheirer-Ray-Hare test using the ranks for observations from Example W8.3. The inhibitory effect of oregano oil and selected antibiotics on certain bacteria

 

E. coli

P. aeruginosa

 

Rank

Rank

Streptomycin

23
20
20
17
20
20
20
23

16
13
13
6
6
13
13
13

Summary terms for each sample

n = 8

sum of x = 163

sum of x squared = 3347

s = 1.92261

mean = 20.375

n = 8

sum of x= 93

sum of x squared= 1173

s = 3.6228

mean = 11.625

Oregano oil

27
30
27
27
32
30
25
30

6
1
6
6
6
6
6
6

Summary terms for each sample

n = 8

sum of x = 228

sum of x squared = 6536

s = 2.32993

mean = 28.5

n = 8

sum of x= 43

sum of x squared= 253

s = 1.76777

mean = 5.375


  1. First add together every observation in the complete data set (grand total) ∑xT.

    23 + 20 + 20 + ........... 6 + 6 + 6 = 527
  1. Square each and every observation and add all these squared values together ∑x2T

    232 + 202+ 202 + ........... 62 + 62 + 62 = 11309
  1. Add all the observations in a sample (∑xs). This is the sample total. Do this for each sample. Square each sample total (∑xs)2. Add these together. Divide this by the number of observations in a sample (ns).

    Step 3 calculation

  2. For each column add all the observations together (∑xc) and square the total (∑xc)2 . Add these squared column values together and divide this total by the number of observations in the column (nc).

    Step 4 calculation
  1. For each row add all the observations (∑xR) and square the total (∑xR)2. Add these squared values together and divide this value by the number of observations in the row (nR).

    Step 5 calculation
  1. Square the result from step 1 and divide this by N. N is the total number of observations in all the samples.

    5272/32= 8679.03125
    1. Calculate the Sums of Squares (SS)
  1. SSTotal = result from step 2 - result from step 6

= 11309 - 8679.03125 = 2629.96875

  1. SSsamples = result from step 3 - result from step 6

= 11131.375 - 8679.03125 = 2452.34375

  1. SStreatment 1 columns = result from step 4 - result from step 6

= 10711.0625 - 8679.03125 = 2032.03125

  1. SStreatment 2 rows = result from step 5 - result from step 6

= 8686.0625 - 8679.03125 = 7.03125

  1. SSInteraction = result from step 8 - result from step 9 - result from step 10

= 2452.34375 - 2032.03125 - 7.03125 = 413.31125

  1. SSwithin = result from 7 - result from 8

= 2629.96875 - 2452.34375 = 177.625

    1. Construct and complete an ANOVA calculation table
  1. Draw an ANOVA table
  2. Transfer the results from the calculations for SStreatment 1 columns, SStreatment 2 rows, SSwithin, and SStotal into the ANOVA Table in column 1 (see Table W8.8).
  1. Calculate the degrees of freedom (degrees of freedom)
degrees of freedomtreatment 1 columns = number of columns - 1 = 2 - 1 = 1 degrees of freedomtreatment 2 rows = number of rows - 1 = 2 - 1 = 1 degrees of freedominteraction = (number of columns - 1)(number of rows - 1)

= (2 - 1) × (2 - 1) = 1

degrees of freedomwithin = N - (number of rows × number of columns)

= 32 - (2 × 2) = 32 - 4 = 28

degrees of freedomtotal = N - 1 = 32 - 1 = 31

Enter these results in column 2. (Table W8.8)

Table W8.8: ANOVA table for analysis of data from Example W8.3. The inhibitory effect of oregano oil and selected antibiotics on certain bacteria., showing how some of the terms are calculated

Source of variation

SS

degrees of freedom

s2

Hcalculated

Hcritical

p

Between species

(columns)

2032.03125

1

 

2032.03125 ÷ 84.83770

= 23.95198

10.83

0.001

Between bactericides

(rows)

7.03125

1

 

7.03125 ÷ 84.83770

= 0.08288

3.84

0.05

Interaction

Species × bactericides.

413.31125

1

 

413.31125 ÷ 84.83770

= 4.87178

3.84

0.05

             

Total

2629.96875

31

84.83770

     


At this point the analysis diverges from that described for a two-way parametric ANOVA in Chapter 7 and you should refer to 8.7.2. Firstly an s2Total is calculated by adding all the SS values together and dividing the total by the Total degrees of freedom (Table W8.8).

s2Total = 2629.96875 / 31 = 84.83770

  1. To work out the values for Hcalculated

H values are calculated instead of an F value as SS/s2Total (Table W8.8).

  1. To find Fcritical

The critical values for H are found in a chi-squared table for the degrees of freedom associated with the SS (Table W8.8).

  1. The rule

The Rule is the same as that given for the parametric two-way ANOVA (7.7, BOX 7.6) in that if Hcalculated is greater than Hcritical then you may reject the null hypothesis.

In our example it can be seen that there is a highly significant difference (H = 23.95, p = 0.01) between the median diameter (mm) of the zone of inhibition between species of bacteria when treated with bactericides; there is no significant difference (H = 0.08, p = 0.05) in the effectiveness of the bactericides; but there is a significant interaction (H = 4.87, 0.05 > p > 0.01) between the bacteria species and their response to the bactericides.

  1. What does this mean in real terms?

This investigation has demonstrated that oregano oil can act as an effective bactericide under laboratory conditions but the effectiveness of the bactericides is dependent on the species of bacteria.

How to calculate Q W2.4 in Excel

There is no direct way of completing this calculation this using Excel. However the ANOVA two way with replication data analysis tool can be used to calculate the SS values and thus shortcut the calculation.

Step 1: Put the data into the spreadsheet using appropriate row and column headings

Excel: Step 1

Step 2: From the top tool bar select, Tools then Data Analysis from the drop down menu.

Step 3: In the Data Analysis box, scroll down and select the Analysis Tool: Anova: Two-Factor With Replication. Click OK.

Excel: Step 3

Step 4: Input values as indicated in the box.

Excel: Step 4

Ensure that the cursor is flashing in the Input Range box. Input the cell references of the data by clicking on cell A2 (this includes the data or sample label) and dragging down and across the entire data set. The area on the spreadsheet will now be highlighted and the cell references shown in the input box.

Step 5: Click in the box marked Rows per sample: and type in 8 for the number of rows of values for each sample

Step 6: The default value for alpha (p) is 0.05 but this can be changed if required, but you will not normally require to do so.

Step 7: Next, select the output options. To return the output data below the input data, select 'OutputRange:' and then click in the box (the cursor will now flash in the box). Scroll over an area where you want the results to be displayed. Note that you could just select a couple of cells - Excel will determine the actual size that it requires for the results table. Note too, that it is essential to click in the box as well as selecting the 'Output Range' button. If this is not done the location is entered into the 'Input Range' box and the analysis cannot be completed.

Step 8: You can choose to have the results entered on to a 'New Worksheet Ply', in which case the results will be given on a fresh sheet, accessed by the tabs at the bottom of the current sheet. Alternatively a 'New Workbook' can be selected. We have opted to put the results table beneath the original data on the spreadsheet.

Step 9: Click OK and the Results table will be returned.

Excel: Step 9

Step 10: Select the required values from the results table. Here we only require the SS values for Sample, Columns and Interaction from the ANOVA table.

Step 11: Then continue as in Table W8.8. ANOVA table for analysis of data from Example W8.3.

[Note that there isn't an easy way to do this calculation in SPSS or Minitab.]

5

Q W2.5

How do the outcomes from the non-parametric ANOVA and the Scheirer-Ray-Hare test compare?

[If you would like to save a record of your answer, please type it into this Word document instead of the text box below]

The outcomes from the hypotheses testing is the same in all cases and the calculated values (K and H) are very similar. Check your answer