1. Home
  2. Explore
  3. Statistics
  4. One-Way and Two-Way ANOVA

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

One-Way and Two-Way ANOVA

Transcript

This is B.Pharm, BP 701 T, Biostatistics and Research Methodology, Pack 4, Lecture 16: Parametric Tests II: ANOVA - One-Way and Two-Way; Welcome to TPS Pharmacy Lab. Hypothesis Testing in Regression and Correlation. In this lecture we will study this topic step by step, with diagrams, important notes, practice questions and exam questions. Keep your notebook ready. Three or more formulations, four storage conditions, five analysts - the moment a third group enters the study,

pairwise t-tests become the wrong tool: each extra test adds its own 5 percent risk of a false alarm, Analysis of variance - ANOVA - solves the problem by testing all the group means simultaneously in a single test, A formulator rarely compares only two means. and six pairwise tests among four groups carry a combined false-alarm risk of about 26 percent. This chapter develops one-way ANOVA (one factor) and two-way ANOVA (two factors) with their assumptions, procedures, ANOVA tables and fully solved pharmaceutical problems, introduces the F distribution by which the decisions are made, comparing the variation between the groups with the variation within them. and closes with the hypothesis tests of Unit III completed: testing whether a correlation coefficient and a regression slope differ significantly from zero.

The idea of ANOVA is a comparison of two kinds of variation, illustrated in Figure 1. Suppose three formulations give slightly different mean disintegration times. The variation within groups - how much tablets of the same formulation differ among themselves - estimates the background noise, sigma squared, Two explanations compete: the formulations genuinely differ, or the means differ only because individual tablets vary anyway. ANOVA measures both.

The variation between groups - how much the group means scatter around the grand mean - estimates the same noise if the null hypothesis (all group means equal) is true, The test ratio, F = mean square between groups / mean square within groups, is therefore near 1 when H0 is true and grows when the group means truly separate; Formally, the total variation of all observations about the grand mean, the total sum of squares (SST), splits exactly into two parts: SST = SSB + SSW,

and it does so whether or not the formulations differ. but it is inflated by any real differences between the groups. a sufficiently large F rejects H0. the sum of squares between groups plus the sum of squares within groups. Each sum of squares has its own degrees of freedom: for k groups and N total observations, df between = k - 1, df within = N - k, and df total = N - 1, which also add up.

The assumptions mirror those of the t-test, whose two-group case ANOVA contains: observations are independent and random, each population is approximately normal, Dividing each sum of squares by its df gives the mean squares, MSB and MSW, and F = MSB / MSW. and the group variances are approximately equal (homogeneity of variance). The null hypothesis is always H0: mu1 = mu2 = ...

= muk; the alternative is not that all means differ, but that at least one mean differs from the others - a point examiners check carefully. Note: Quote the partitioning idea in words: ANOVA asks whether the means scatter more than the noise inside the groups can explain. Let us look at this diagram carefully. The ANOVA idea: total variation splits into variation between groups and variation within groups. Go through every labelled part of the diagram one by one - diagrams like this are frequently asked in exams, so draw it in your notebook and practise it well. One-way ANOVA studies one factor - formulation, dose level, storage condition - at several levels (the groups). The procedure follows the standard steps. (1) State H0: all group means are equal, against H1: at least one differs. (2) Fix alpha, usually 0.05. (3) Compute the grand mean of all N observations.

(4) Compute SSB = sum over groups of ni x (group mean - grand mean) squared, and SSW = sum over all observations of (observation - its group mean) squared; check with SST = SSB + SSW. (5) Form the ANOVA table: source, sum of squares, df, mean square, F. (6) Read the table value of F at (k - 1, N - k) df and the chosen alpha. (7) Reject H0 if the calculated F exceeds the table F, and conclude in words. The ANOVA table is a fixed format that should be reproduced exactly in answers.

Its rows are: Between groups (SSB, k - 1 df, MSB = SSB/(k - 1)), Within groups or Error (SSW, N - k df, MSW = SSW/(N - k)), and Total (SST, N - 1 df). The F ratio is formed only from the first two rows. A useful internal check is available at every step: the sums of squares must satisfy SST = SSB + SSW exactly, and the degrees of freedom must satisfy (N - 1) = (k - 1) + (N - k).

If either check fails, the arithmetic is wrong and must be found before proceeding - examiners reward the check because it is what a careful analyst does with real data. Note: Present the ANOVA table in full in every numerical - a bare F value without the table loses most of the marks. Problem: the disintegration times (minutes) of 4 tablets from each of three formulations are: A: 8, 9, 7, 8; B: 10, 11, 9, 10; C: 12, 13, 11, 12.

Test at the 5 percent level whether the formulations differ in mean disintegration time. Step 1: H0: muA = muB = muC; H1: at least one mean differs; alpha = 0.05. Step 2: group means are A = 32/4 = 8, B = 40/4 = 10, C = 48/4 = 12; the grand mean of all 12 values is 120/12 = 10. Step 3: SSB = 4 x [(8 - 10) squared + (10 - 10) squared + (12 - 10) squared] = 4 x [4 + 0 + 4] = 32.

Step 4: SSW: within A the deviations from 8 are 0, 1, -1, 0, squares summing to 2; within B, deviations from 10 give 2; within C, deviations from 12 give 2; so SSW = 2 + 2 + 2 = 6. Check: SST computed directly from all values about the grand mean 10 is 38, and SSB + SSW = 32 + 6 = 38 - the check holds. Step 5: the ANOVA table.

Between groups: SS = 32, df = 3 - 1 = 2, MS = 32/2 = 16. Within groups: SS = 6, df = 12 - 3 = 9, MS = 6/9 = 0.667. Total: SS = 38, df = 11. F = MSB / MSW = 16 / 0.667 = 24.0. Conclusion: the three formulations differ significantly in mean disintegration time at the 5 percent level; the group means (8, Step 6: the table value of F at (2, 9) df and 5 percent is 4.26. Step 7: since the calculated F (24.0) far exceeds the table value (4.26), H0 is rejected.

ANOVA itself does not say which pairs differ - if that question matters, a post-hoc multiple-comparison procedure (such as Tukey's test) is applied after a significant F, 10 and 12 minutes) show formulation A disintegrating fastest and C slowest. under its own error control. Note: The check SST = SSB + SSW caught the arithmetic before the table was built - always show it.

Its power is economy plus insight: one experiment estimates the effect of each factor and, when each combination is replicated, Two-way ANOVA studies two factors simultaneously - for example, formulation (factor A) and storage temperature (factor B) in a stability study. also their interaction - whether the effect of one factor depends on the level of the other. With one observation per combination (the unreplicated case used here), there is no separate interaction estimate,

The total sum of squares now splits into four parts: SST = SSA + SSB + SSAB (interaction) + SSE (error), with degrees of freedom splitting in parallel. and the remainder after the two factor sums of squares serves as the error: SST = SSA + SSB + SSE. Solved problem: the assay (percent of label claim) of three formulations stored at three temperatures for a fixed period, one determination per combination,

Each factor is tested by its own F ratio, factor mean square divided by the error mean square, against the table F at its own df. is: Formulation A: 96 (25 C), 93 (40 C), 87 (60 C); Formulation B: 91, 88, 85; Formulation C: 89, 83, 80. Row (formulation) means: A = 92, B = 88, C = 84. Column (temperature) means: 25 C = 92, 40 C = 88, 60 C = 84. Grand mean = 792/9 = 88. SSA (formulations) = 3 x [(92 - 88) squared + (88 - 88) squared + (84 - 88) squared] = 3 x 32 = 96.

SSB (temperatures) = 3 x [(92 - 88) squared + (88 - 88) squared + (84 - 88) squared] = 96. SST, from all nine values about 88, is 198. Therefore SSE = 198 - 96 - 96 = 6. ANOVA table: Formulations: SS 96, df 2, MS 48, F = 48/1.5 = 32.0. Temperatures: SS 96, df 2, MS 48, F = 32.0. Error: SS 6, df (3 - 1)(3 - 1) = 4, MS 1.5. Total: SS 198, df 8. Conclusion: formulation and storage temperature both significantly affect the assay at the 5 percent level - potency falls as temperature rises,

The table F at (2, 4) df and 5 percent is 6.94; both calculated F values (32.0) exceed it, so both null hypotheses are rejected. and formulation A retains the highest assay at every temperature. Note: Two F decisions are made from one table - state the conclusion for each factor separately. The F statistic is a ratio of two variance estimates, so it cannot be negative and its distribution is skewed to the right, starting at zero and stretching out in a long tail,

The F distribution is a family of curves fixed by two degrees of freedom: the numerator df (of the mean square in the top of the ratio, as Figure 2 shows. here the between-groups or factor mean square) and the denominator df (of the error mean square). F tables are therefore entered with the pair of df, numerator first, and most tables give values at the 5 percent and 1 percent levels. Reading examples used in this chapter make the method plain: for the one-way problem the df pair is (2, 9) and the 5 percent table value is 4.26; for the two-way problem it is (2, 4) and the value is 6.94 - note how the critical value rises as the error df falls, because a variance estimated from few observations is itself uncertain,

Under H0 the ratio hovers near 1; values moderately above 1 occur by chance, and only values beyond the table value are unlikely enough (probability alpha) to reject H0. so stronger evidence is demanded. Two practical points complete the picture. Second, a significant F is the beginning, not the end, of the analysis: the investigator next asks which means differ (post-hoc tests),

whether the assumptions held (residual examination), and whether the differences are large enough to matter pharmaceutically - statistical significance and practical importance remain s First, ANOVA and the t-test are the same family: with exactly two groups, F = t squared, and the decisions agree. parate questions. Note: Always quote F with its two df - 'F(2, 9) = 24.0' - a bare F value cannot be checked against any table.

Let us look at this diagram carefully. The F distribution: a right-skewed curve with the rejection region beyond the table value of F. Unit III produced two numbers that now need testing: the correlation coefficient r and the slope b of the regression line. To test H0: the population correlation rho = 0, the statistic is: t = r x square root of (n - 2) / square root of (1 - r squared), with df = n - 2,

A sample r of 0.85 looks impressive, but with few pairs it could arise by chance from an uncorrelated population; the test decides. where r is the sample correlation coefficient and n the number of pairs. Solved example: a study of dissolution versus bioavailability in 12 formulations gives r = 0.85. Then t = 0.85 x square root of 10 / square root of (1 - 0.7225) = 0.85 x 3.162 / square root of 0.2775 = 2.688 / 0.527 = 5.10.

The table value at 10 df and 5 percent is 2.228; since 5.10 exceeds it, H0 is rejected - the correlation is highly significant, and an in vitro-in vivo relationship is supported. For H0: the population slope beta = 0 (no linear relationship), the statistic is t = b / SE(b), Solved example: a calibration-type regression of response on concentration over 12 points gives b = 1.85 with SE(b) = 0.37; t = 1.85 / 0.37 = 5.00, which exceeds 2.228 at 10 df,

The slope of the regression line is tested the same way. where b is the calculated slope and SE(b) its standard error from the regression analysis, again with df = n - 2. This is no coincidence: in simple linear regression the test for the slope and the test for the correlation are the same test in two forms, The intercept can likewise be tested against a hypothesised value, so the slope is significantly different from zero. and their t values agree when computed from the same data (the small difference above is rounding in the two illustrations). and the overall regression is tested by an F test in the regression ANOVA table - the same F machinery as Sections 1 to 5, which is why examiners treat this unit as one connected story. Note: A large r from a small n can still be non-significant - never report r without its test when a conclusion is drawn from it.

Now try these practice questions yourself. Question 1: An ANOVA of four tablet presses (5 tablets each) gives SSB = 40 with 3 df and SSW = 60 with 16 df. Complete the ANOVA table, calculate F, and take the decision at the 5 percent level (table F for (3, 16) df = 3.24). Question 2: State H0 and H1 for an ANOVA comparing the potency of five brands of the same drug.

How many pairwise t-tests would be needed to compare all pairs of brands, and why is that approach rejected? Question 3: A correlation study on 10 pairs of observations gives r = 0.62. Set up the test of significance of r, stating the formula, the degrees of freedom and the table value to be used (t for 8 df at 5 percent = 2.306). Question 5: Explain the statement 'F = t squared' and verify it for the dissolution data of Chapter 3, where t = 2.92: what F would a two-group ANOVA give,

Question 4: In a two-way ANOVA on 3 machines and 4 operators with one observation per combination, state the degrees of freedom for machines, operators, error and total. and what are its two degrees of freedom? Write the answers in your notebook before moving ahead. Let us summarise this lecture. ANOVA tests several means in a single test by partitioning the total variation: SST = SSB + SSW, with F = MSB / MSW compared against the table F at (k - 1, N - k) degrees of freedom.

In the disintegration problem the group means 8, 10 and 12 minutes gave SSB = 32, SSW = 6 and F = 24.0 against a table value of 4.26 - a significant difference. Two-way ANOVA separates two factors in one experiment; in the stability example both formulation and temperature gave F = 32.0 against 6.94, both significant. The F distribution is right-skewed, fixed by two degrees of freedom, and with two groups F = t squared.

The same machinery tests correlation (r = 0.85, n = 12 gives t = 5.10, significant) and the regression slope (t = b / SE(b)). Finally, these are the ten important exam questions from this lecture. Question 1: Why is ANOVA preferred to repeated t-tests when more than two means are compared? Quantify the error inflation for four groups. Question 2: Explain the partitioning of the total sum of squares in one-way ANOVA and the meaning of each component.

Question 3: State the assumptions of ANOVA and the exact form of its null and alternative hypotheses. Question 4: The disintegration times of three formulations (n = 4 each) are A: 8, 9, 7, 8; B: 10, 11, 9, 10; C: 12, 13, 11, 12. Carry out one-way ANOVA at the 5 percent level (table F for (2, 9) df = 4.26). Question 5: Draw the format of the one-way ANOVA table and explain how each entry is calculated.

Question 6: What is two-way ANOVA? Distinguish it from one-way ANOVA and state the advantages of studying two factors in one experiment. Question 7: In a stability study the assays of three formulations at three temperatures give row means 92, 88, 84, column means 92, 88, 84, grand mean 88, SSA = 96, SSB = 96, SSE = 6. Complete the two-way ANOVA table and test both factors at the 5 percent level (table F for (2, 4) df = 6.94).

Question 8: Describe the F distribution and explain how the F table is entered. Why does the critical value increase when the error degrees of freedom decrease? Question 9: How is the significance of a correlation coefficient tested? A study of 12 pairs gives r = 0.85; test its significance at the 5 percent level (t for 10 df = 2.228). Question 10: Explain the test for the significance of a regression slope and its relationship with the test for correlation in simple linear regression. Prepare all of them well. Thank you for watching TPS Pharmacy Lab. In the next lecture we will study: Non-Parametric Tests: Mann-Whitney U, Wilcoxon Signed Rank, Kruskal-Wallis, Friedman and Chi-Square Tests.

Revise the notes, practise the diagrams, and prepare the exam questions. Like, share and subscribe for the full B.Pharm series. See you in the next lecture.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent