2000 unit 3 Filled In

1. Introduction to comparing multiple population means and the limitations of pairwise tests

This section introduces the challenges and drawbacks associated with comparing means across multiple populations, particularly highlighting the increased risk of Type I errors and the limited inferential power of relying solely on pairwise hypothesis tests.

1.1 The need for comparing multiple population means

In statistical analysis, the objective often extends beyond comparing a single population mean (as covered in Unit 1) or the means of two populations (as in Unit 2). Frequently, researchers need to compare the means of three or more populations to determine if significant differences exist among them. For instance, one might want to ascertain if the average performance across four different educational programs is the same: μ1=μ2=μ3=μ4\mu_1 = \mu_2 = \mu_3 = \mu_4 3.

1.2 Limitations of pairwise hypothesis testing

A common, albeit flawed, approach to comparing multiple population means is to conduct a series of pairwise hypothesis tests. If there are II populations, the number of unique pairwise comparisons is given by the combination formula (I2)\binom{I}{2}. For example, with four populations, one would need to perform six pairwise tests: H0:μ1=μ2H_0: \mu_1 = \mu_2 vs. Ha:μ1≠μ2H_a: \mu_1 \neq \mu_2, H0:μ1=μ3H_0: \mu_1 = \mu_3 vs. Ha:μ1≠μ3H_a: \mu_1 \neq \mu_3, and so on, up to H0:μ3=μ4H_0: \mu_3 = \mu_4 vs. Ha:μ3≠μ4H_a: \mu_3 \neq \mu_4 4.

1.2.1 Increased risk of Type I errors

Conducting multiple hypothesis tests significantly inflates the probability of committing at least one Type I error (falsely rejecting a true null hypothesis). If each pairwise test is conducted at a significance level ω=0.05\omega = 0.05, there is a 5% chance of a Type I error for each individual test. Assuming independence (which is an approximation in this context), the probability of correctly failing to reject the null hypothesis in all kk independent tests is (1−ω)k(1 - \omega)^k. For six pairwise tests with ω=0.05\omega = 0.05, this probability is 0.956≈0.7350.95^6 \approx 0.735. Consequently, the probability of making at least one Type I error across these six tests is 1−0.956≈0.2651 - 0.95^6 \approx 0.265, or 26.5%. This problem becomes more pronounced as the number of populations increases, leading to a rapid escalation in the number of pairwise tests and thus the overall risk of a Type I error. [5-6]

Reminder: As the number of populations (II) grows, the number of pairwise tests, (I2)\binom{I}{2}, increases quadratically. This exacerbates the multiple comparison problem, substantially raising the chance of a Type I error.

1.2.2 Limited inferential scope

Pairwise tests provide information about the likelihood of two specific means differing by a certain amount, given the null hypothesis that these two means are equal. However, this does not directly address the primary research question: whether there is evidence that all population means differ, or if at least one mean differs from the others, when considering all populations simultaneously 7.

Example: Consider side-by-side boxplots of four populations. If a pairwise test between population 1 and population 4 shows a significant difference, it might lead one to conclude that μ1≠μ4\mu_1 \neq \mu_4. However, when viewing all four distributions together, this difference might be expected due to chance variation across multiple samples. A test that considers all four means simultaneously provides a more appropriate context for assessing overall differences. [8-10]

1.3 Towards a simultaneous comparison of means

To address the limitations of pairwise testing, statistical methods for comparing multiple population means typically involve a two-step process:

  1. An overall test: This initial step aims to detect if there is any evidence of a difference among all the population means. This is generally a more straightforward procedure, though calculations might be complex. The hypotheses tested are:

    • H0:μ1=μ2=⋯=μIH_0: \mu_1 = \mu_2 = \dots = \mu_I (All population means are equal)
    • Ha:H_a: At least one μi\mu_i differs. (Not all population means are equal) [11-12]

    Important Note: The alternative hypothesis (HaH_a) is not that all means are different from each other (μ1≠μ2≠…≠μI\mu_1 \neq \mu_2 \neq \dots \neq \mu_I). Instead, it signifies that at least one mean deviates from the others. This could manifest in various ways, such as one mean being different while the rest are equal, or multiple means being different in various configurations. This "many-sided" alternative hypothesis requires a statistical approach that can detect any deviation from complete equality among all means 13.

  2. Follow-up analysis: If the overall test indicates a significant difference, a more detailed analysis is conducted to identify which specific means differ from each other and to estimate the magnitude of these differences. This follow-up analysis is more advanced and will not be formally covered in this introductory section, which focuses primarily on the overall test and heuristic examination of relationships 11.

2. Analysis of variance (ANOVA) and the F-distribution

This section introduces the Analysis of Variance (ANOVA) test as a method for comparing multiple population means, explaining its core idea of comparing variation between sample means to variation within samples, and introduces the F-distribution and its properties.

2.1 The core idea of ANOVA

Analysis of Variance (ANOVA) is a statistical method used to compare the means of three or more populations. The fundamental principle of ANOVA is to partition the total observed variation in the data into different sources of variation. Specifically, it compares the variation between the sample means to the variation within individual samples.

The underlying hypothesis being tested in ANOVA is:

  • Null Hypothesis (H0H_0): All population means are equal (μ1=μ2=⋯=μI\mu_1 = \mu_2 = \dots = \mu_I).
  • Alternative Hypothesis (HaH_a): At least one population mean differs from the others 14.

To perform an ANOVA test, several assumptions must be met:

  • Normality: The variable of interest follows a normal distribution in each population.
  • Homogeneity of variances: The variable of interest has a common standard deviation (σ\sigma) across all populations.
  • Independence: Each sample is a simple random sample from its respective population, or treatments are randomly assigned to individuals in an experiment. The samples must also be independent of each other 15.

2.1.1 Comparing sources of variation

If the null hypothesis (H0H_0) is true, meaning all population means are indeed equal, then all collected observations from all samples can be considered to come from the same underlying normal distribution. In this scenario, both the variation observed between sample means and the variation observed within individual samples should primarily reflect the inherent variability of the variable itself, quantified by the common standard deviation σ\sigma 16.

Consequently, if H0H_0 is true, there should not be a substantial difference between these two types of variation. Conversely, if there are significant differences among the population means, the variation observed between sample means will be considerably larger than the variation observed within the individual samples 17.

2.2 The F-test statistic

The ANOVA F-test statistic is designed to measure the difference between these two types of variation. It is calculated as the ratio of the variation between sample means to the variation within individual samples:

F=variation between sample meansvariation within individual samplesF = \frac{\text{variation between sample means}}{\text{variation within individual samples}}.

  • Small F value (close to 1): Indicates minimal difference between the two types of variation, suggesting weak evidence against H0H_0.
  • Large F value: Indicates that the variation between sample means is substantially larger than the variation within samples, providing strong evidence that the population means differ 18.

The precise formulas for calculating the "variation between sample means" and "variation within individual samples" are detailed in subsequent sections of the study guide.

Note: The F statistic is always non-negative because it is a ratio of variances, which are inherently non-negative.

2.3 The F-distribution

The F-test statistic follows an F-distribution. Similar to t-distributions, there is a family of F-distributions, but they are characterized by two types of degrees of freedom: the numerator degrees of freedom (nn) and the denominator degrees of freedom (dd). An F-distribution with nn numerator degrees of freedom and dd denominator degrees of freedom is denoted as Fn,dF_{n,d} 19.

2.3.1 Properties of the F-distribution

  • Shape: F-distributions are always right-skewed and strictly non-negative (i.e., F≥0F \ge 0) 20.
  • Asymptotic behavior: As both the numerator and denominator degrees of freedom increase, the F-distribution approaches a normal distribution.
  • Area as probability: The area under an F-distribution curve represents the probability of observing an F-statistic value within a specific interval.

Example: The F-distribution with 5 numerator degrees of freedom and 9 denominator degrees of freedom (F5,9F_{5,9}) is shown to be right-skewed. As degrees of freedom increase, the distribution becomes less skewed 21.

2.3.2 Critical values of the F-distribution

Upper critical values for F-distributions are typically found in F-tables for various significance levels (ω\omega). An upper ω\omega critical value for the Fn,dF_{n,d} distribution is denoted as F→n,d,ωF_{\rightarrow n,d,\omega} 22.

Example: The upper 0.05 critical value for the F4,19F_{4,19} distribution (4 numerator degrees of freedom and 19 denominator degrees of freedom) is F→4,19,0.05=2.90F_{\rightarrow 4,19,0.05} = 2.90 23.

Critical values can also be determined using statistical software. For instance, in R, the qf() function can be used:

cv <- qf(0.05, df1 = 4, df2 = 19, lower.tail = FALSE)
cv
## 2.895107 [1](#page=1).

This output confirms the critical value for the upper 0.05 tail of the F4,19F_{4,19} distribution is approximately 2.895 24.

3. Calculating the ANOVA F-statistic and conducting hypothesis tests with examples (part 1)

This section details the step-by-step calculation of the Analysis of Variance (ANOVA) F-statistic and its application in hypothesis testing, illustrated with a practical example.

3.1 Introduction to ANOVA and hypothesis testing

ANOVA is a statistical method used to compare the means of two or more groups. It addresses the null hypothesis that all population means are equal (H0:μ1=μ2=⋯=μIH_0: \mu_1 = \mu_2 = \dots = \mu_I) against the alternative hypothesis that at least one population mean differs (HaH_a: at least one μi\mu_i differs). This process is typically conducted using a hypothesis test with a specified level of significance (ω\omega).

Example: To illustrate the calculation of the F-statistic and the hypothesis testing procedure, we consider an example involving the effectiveness of three different diets (omnivore, vegetarian, vegan) on reducing systolic blood pressure. Seven adults were assigned to the omnivore diet (diet 1), seven to the vegetarian diet (diet 2), and six to the vegan diet (diet 3). The decrease in systolic blood pressure was measured after three months for each subject. We aim to test H0:μ1=μ2=μ3H_0: \mu_1 = \mu_2 = \mu_3 against HaH_a: at least one μi\mu_i differs, using a 5% level of significance and the P-value method 25.

3.1.1 Defining populations and samples

It is crucial to clearly identify the populations of interest and ensure that the samples are representative of these populations for the inference to be valid. In experiments, volunteers are used, and the focus is on ensuring they do not systematically differ from the broader population. 26 27.

3.1.2 Data and preliminary calculations

The experiment yields data on the decrease in systolic blood pressure (in mm Hg) for each diet group. Preliminary calculations provide sample sizes (nin_i), sample means (xˉi\bar{x}_i), and sample standard deviations (sis_i) for each group.

Dietnin_ixˉi\bar{x}_isis_i
Diet 179.142.91
Diet 275.572.51
Diet 3611.172.86

3.1.3 Checking assumptions

Visualizations like side-by-side boxplots help assess the data's distribution. Two key assumptions for ANOVA are:

  1. Equal variances: The highest sample standard deviation divided by the lowest sample standard deviation should be less than or equal to 2. In this example, 2.912.51=1.16\frac{2.91}{2.51} = 1.16, which is less than 2, supporting the assumption of equal population variances 31.
  2. Normality: The distributions within each group should be approximately normal. While one group's distribution might appear slightly skewed, it is often considered reasonable given small sample sizes, allowing for the assumption of normality 32.

3.1.4 Hypothesis test steps

The hypothesis test follows a structured approach:

  1. Level of significance (ω\omega): Set at 0.05 for this example.
  2. Hypotheses:
    • Null Hypothesis (H0H_0): μ1=μ2=μ3\mu_1 = \mu_2 = \mu_3
    • Alternative Hypothesis (HaH_a): At least one μi\mu_i differs.
  3. Decision Rule: Reject H0H_0 if the P-value is less than ω\omega (0.05) 33.

3.2 Calculating the ANOVA F-statistic

The F-statistic is the core test statistic in ANOVA, comparing the variance between groups to the variance within groups. It is calculated as the ratio of the Mean Square for Groups (MSG) to the Mean Square for Error (MSE).

3.2.1 Overall mean calculation

The overall mean (xˉˉ\bar{\bar{x}}) is the weighted average of the sample means, with weights being their respective sample sizes. xˉˉ=∑i=1InixˉiN\bar{\bar{x}} = \frac{\sum_{i=1}^{I} n_i \bar{x}_i}{N} Where II is the number of groups and NN is the total sample size (N=∑i=1IniN = \sum_{i=1}^{I} n_i).

For the example: I=3I = 3, N=7+7+6=20N = 7 + 7 + 6 = 20. xˉˉ=7(9.14)+7(5.57)+6(11.17)20=63.98+38.99+67.0220=17020=8.50\bar{\bar{x}} = \frac{7(9.14) + 7(5.57) + 6(11.17)}{20} = \frac{63.98 + 38.99 + 67.02}{20} = \frac{170}{20} = 8.50 Under H0H_0, xˉˉ\bar{\bar{x}} is the best estimate of the common population mean μ\mu. 34 35.

3.2.2 Sum of Squares for Groups (SSG)

SSG measures the variation between the sample means and the overall mean, weighted by sample sizes. SSG=∑i=1Ini(xˉi−xˉˉ)2SSG = \sum_{i=1}^{I} n_i (\bar{x}_i - \bar{\bar{x}})^2 For the example: SSG=7(9.14−8.50)2+7(5.57−8.50)2+6(11.17−8.50)2SSG = 7(9.14 - 8.50)^2 + 7(5.57 - 8.50)^2 + 6(11.17 - 8.50)^2 SSG=7(0.64)2+7(−2.93)2+6(2.67)2SSG = 7(0.64)^2 + 7(-2.93)^2 + 6(2.67)^2 SSG=7(0.4096)+7(8.5849)+6(7.1289)SSG = 7(0.4096) + 7(8.5849) + 6(7.1289) SSG=2.8672+60.0943+42.7734=105.7349SSG = 2.8672 + 60.0943 + 42.7734 = 105.7349

3.2.3 Mean Square for Groups (MSG)

MSG is the SSG divided by the degrees of freedom for groups (I−1I-1). It represents the average variation between sample means. MSG=SSGI−1MSG = \frac{SSG}{I-1} For the example: MSG=105.73493−1=105.73492=52.8675MSG = \frac{105.7349}{3-1} = \frac{105.7349}{2} = 52.8675

3.2.4 Sum of Squares for Error (SSE)

SSE measures the variation within individual samples. It is a pooled measure of the sum of squared deviations from each sample mean. SSE=∑i=1I(ni−1)si2SSE = \sum_{i=1}^{I} (n_i - 1)s_i^2 For the example: SSE=(7−1)(2.91)2+(7−1)(2.51)2+(6−1)(2.86)2SSE = (7-1)(2.91)^2 + (7-1)(2.51)^2 + (6-1)(2.86)^2 SSE=6(8.4681)+6(6.3001)+5(8.1796)SSE = 6(8.4681) + 6(6.3001) + 5(8.1796) SSE=50.8086+37.8006+40.898=129.5072SSE = 50.8086 + 37.8006 + 40.898 = 129.5072

3.2.5 Mean Square for Error (MSE)

MSE is the SSE divided by the degrees of freedom for error (N−IN-I). It represents the average variation within each group. MSE=SSEN−IMSE = \frac{SSE}{N-I} For the example: MSE=129.507220−3=129.507217=7.6181MSE = \frac{129.5072}{20-3} = \frac{129.5072}{17} = 7.6181 The MSE is an extension of the pooled sample variance (sp2s_p^2) from the two-sample case, and its square root (MSE\sqrt{MSE}) provides the best estimate of the common population standard deviation (σ\sigma). 39 40.

3.2.6 The F-statistic formula

The F-statistic is the ratio of MSG to MSE. F=MSGMSEF = \frac{MSG}{MSE} For the example: F=52.86757.6181≈6.94F = \frac{52.8675}{7.6181} \approx 6.94 This F-statistic follows an F-distribution with I−1I-1 numerator degrees of freedom and N−IN-I denominator degrees of freedom. In this case, it's an FF distribution with 2 numerator degrees of freedom and 17 denominator degrees of freedom. 41.

3.3 Determining the P-value and making a decision

The P-value in an ANOVA F-test is the probability of observing an F-statistic as extreme as, or more extreme than, the one calculated, assuming the null hypothesis is true. This is always the area to the right of the calculated F-statistic under the F-distribution curve.

3.3.1 P-value calculation

For the example, the P-value is P(F2,17≥6.94)P(F_{2,17} \ge 6.94). Using an F-distribution table, we find critical values:

  • P(F2,17≥6.11)=0.010P(F_{2,17} \ge 6.11) = 0.010
  • P(F2,17≥10.66)=0.001P(F_{2,17} \ge 10.66) = 0.001

Since our calculated F-statistic of 6.94 falls between 6.11 and 10.66, our P-value is between 0.001 and 0.01.

3.3.2 Decision and conclusion

Because the P-value (between 0.001 and 0.01) is less than the significance level ω=0.05\omega = 0.05, we reject the null hypothesis (H0H_0). This indicates that there is statistically significant evidence to conclude that at least one of the diet means for reducing systolic blood pressure differs among the three diets.

Important Note: A high F-statistic suggests that the variation between sample means is considerably larger than the variation within individual samples, providing strong evidence for the alternative hypothesis 43.

3.3.3 ANOVA table

The results of an ANOVA are often summarized in an ANOVA table, which systematically presents the sources of variation, degrees of freedom, sum of squares, mean squares, the F-statistic, and the P-value.

42 44.

Tip: The total sum of squares (SSTotal) is the sum of SSG and SSE (SSTotal=SSG+SSESSTotal = SSG + SSE). It represents the total variation in the data. The total degrees of freedom are N−1N-1.

4. Calculating the ANOVA F-statistic and conducting hypothesis tests with examples (part 2)

This section details the practical application of the ANOVA F-statistic in hypothesis testing, focusing on calculation, interpretation, and the use of the ANOVA table, complemented by R code examples.

4.1 Understanding the ANOVA Table

The ANOVA (Analysis of Variance) table serves as a comprehensive summary of the calculations required for an ANOVA F-test. It systematically breaks down the total variation in the data into components attributable to different sources.

The standard ANOVA table structure is as follows:

Where:

  • II represents the number of groups or populations being compared.
  • NN represents the total number of observations across all groups.
  • SSG is the Sum of Squares for Groups, measuring the variation between the group means.
  • SSE is the Sum of Squares for Error, measuring the variation within each group (unexplained variance).
  • SST is the Total Sum of Squares, representing the total variation in the data.
  • MSG is the Mean Square for Groups, which is the variance estimate for the groups.
  • MSE is the Mean Square for Error, which is the variance estimate for the errors (within-group variance).

4.1.1 Example: Blood Pressure Data and the ANOVA Table

Using the blood pressure example, the calculated ANOVA table provides a clear overview of the test results:

This table shows that the F-statistic, calculated as MSG/MSE (52.8675 / 7.6181), is 6.94. This value is then compared against an F-distribution to determine the p-value for the hypothesis test.

Tip: The ANOVA table consolidates all essential components for hypothesis testing, making interpretation more straightforward and facilitating comparisons between different sources of variation.

4.2 Hypothesis Testing with the F-statistic

The F-statistic derived from the ANOVA table is the test statistic for comparing the means of two or more groups. The hypothesis test aims to determine if there is a statistically significant difference among the population means.

The null hypothesis (H0H_0) and alternative hypothesis (HaH_a) are typically stated as:

  • H0H_0: The population means of all groups are equal (μ1=μ2=⋯=μI\mu_1 = \mu_2 = \dots = \mu_I).
  • HaH_a: At least one population mean differs from the others.

4.2.1 P-value Method for Hypothesis Testing

The p-value approach involves comparing the calculated p-value to a predetermined significance level (α\alpha).

Example (Blood Pressure): In the blood pressure example, if the calculated p-value was between 0.001 and 0.01, and the significance level α\alpha was 0.05, we would reject H0H_0 because the p-value < α\alpha. This leads to the conclusion that there is sufficient evidence to suggest that at least one of the population mean decreases in blood pressure differs among the three diets.

4.2.2 Critical Value Method for Hypothesis Testing

Alternatively, the critical value method compares the calculated F-statistic to a critical F-value from the F-distribution.

Example (Blood Pressure): For the blood pressure example, if the critical F-value for α=0.05\alpha = 0.05 and degrees of freedom dfgroup=2df_{group}=2 and dferror=17df_{error}=17 was Fcrit=3.59F_{\text{crit}} = 3.59, the decision rule would be to reject H0H_0 if the calculated F-statistic is greater than or equal to 3.59. Since the calculated F-statistic was 6.94, which is greater than 3.59, we would reject H0H_0.

Important: The ANOVA F-test only indicates that at least one mean is different; it does not specify which means differ or by how much. Further post-hoc analyses are required for such detailed comparisons.

4.3 Conducting ANOVA with R

Statistical software like R simplifies ANOVA calculations. The aov() function is used to fit an ANOVA model, and summary() displays the ANOVA table.

Example (Blood Pressure in R):

bp <- c(8,14,9,5,11,10,7,3,5,10,4,5,8,4,7,11,13,9,15,12)
diets <- c("1","1","1","1","1","1","1","2","2","2","2","2","2","2","3","3","3","3","3","3")
aov.model <- aov(bp ~ diets)
summary(aov.model)

The output would show a table similar to the manual calculation, including the F-value and the corresponding p-value (Pr(>F)). For this example, the output indicates an F-value of 6.936 and a p-value of 0.00627, supporting the rejection of H0H_0.

4.3.1 Checking Assumptions in R: Levene's Test

Before performing an ANOVA, it is crucial to check for homogeneity of variances, meaning that the population variances of the groups are roughly equal. Levene's test is commonly used for this purpose.

Example (Blood Pressure Levene's Test in R):

library(car) # Load the car package for leveneTest
leveneTest(bp ~ diets)

The Levene's Test output provides a p-value. If this p-value is large (e.g., > 0.05), we fail to reject the null hypothesis of equal variances, suggesting that the ANOVA assumptions are met. In the blood pressure example, the p-value of 0.866 indicates that there is insufficient evidence to suggest that the population variances differ, making ANOVA appropriate.

4.3.2 Data Visualization and Summary Statistics in R

R can also be used to visualize data and compute descriptive statistics for each group, aiding in the understanding and interpretation of the results.

Example (Blood Pressure Summary Statistics in R):

df <- data.frame(diets, bp) # Create a data frame
aggregate(df$bp, list(df$diets), FUN=mean) # Calculate mean for each diet
aggregate(df$bp, list(df$diets), FUN=sd)   # Calculate standard deviation for each diet

These functions provide the mean and standard deviation of blood pressure decrease for each diet group, offering insights into the group differences.

4.4 Another ANOVA Example: Hotel Rates

This section demonstrates an ANOVA test applied to hotel room rates across different regions of Canada.

4.4.1 Problem Setup and Data

The objective is to test whether the true mean room rate is equal for four regions: West, Central, East, and Maritimes.

Example (Hotel Data in R):

area <- c("West","West","West","West","West","West","West","West", "Central","Central","Central","East","East","East","East","East","East","East", "Maritimes","Maritimes","Maritimes", "Maritimes", "Maritimes", "Maritimes")
rate <- c(258, 198, 297, 217,239,260,260,203,190,107,156, 272,210,299,250,245,301,299,195,190,223,200,250,200)
hotelrates <- data.frame(area, rate)

The data frame hotelrates contains the room rates (rate) for hotels in different geographical areas (area).

4.4.2 Assumption Checks

Before conducting the ANOVA, assumptions must be verified. A boxplot of the hotel rates by area can visually assess the distribution and potential differences in means and variances.

Example (Hotel Rates Boxplot in R):

boxplot(hotelrates$rate ~ hotelrates$area,
        main="Hotel Rates", ylab="EUR", xlab="Area")

The boxplot helps to visually identify any outliers or significant differences in the central tendencies and spreads of the room rates across the regions. For this dataset, visual inspection suggests potential differences in means. Despite some skewness, the small sample sizes lead to the assumption of normality for this analysis.

To check for homogeneity of variances, sample standard deviations for each region are calculated:

Example (Hotel Rates Standard Deviations in R):

aggregate(hotelrates$rate, list(hotelrates$area), FUN=sd)

The sample standard deviations are: Central (41.73 euros), East (34.75 euros), Maritimes (22.77 euros), and West (33.84 euros). These values are relatively close, suggesting that the assumption of equal population variances is reasonable for this dataset.

5. Calculating the ANOVA F-statistic and conducting hypothesis tests with examples (part 3)

This section details the step-by-step calculation of the ANOVA F-statistic and its application in hypothesis testing, supported by practical examples and R code.

5.1 Assumptions for ANOVA

Before conducting an ANOVA F-test, several assumptions must be met to ensure the validity of the results.

  • Normality: The data within each population (group) should follow a normal distribution. This assumption is often assessed using visual methods like boxplots and QQ-plots, or formal statistical tests.
  • Homogeneity of Variances (Homoscedasticity): The population variances of the groups should be equal. This can be informally checked by comparing sample standard deviations or formally assessed using tests like Levene's test.
  • Independence: Observations within each group and between groups must be independent of each other. For experimental data, this means random assignment of individuals to groups. For observational data, it means the samples are simple random samples.

Important: The ANOVA F-test is relatively robust to minor violations of the normality assumption, especially with larger sample sizes. However, significant deviations from equal variances can impact the results.

5.2 Hypothesis Testing Framework for ANOVA

The core of ANOVA involves testing hypotheses about the means of multiple populations.

  • Level of Significance (α\alpha): This is the probability of rejecting the null hypothesis when it is true, typically set at 0.05.
  • Hypotheses:
    • Null Hypothesis (H0H_0): The population means of all groups are equal (μ1=μ2=⋯=μI\mu_1 = \mu_2 = \dots = \mu_I).
    • Alternative Hypothesis (HaH_a): At least one population mean differs from the others.
  • Decision Rule:
    • P-value Method: Reject H0H_0 if the P-value is less than or equal to α\alpha.
    • Critical Value Method: Reject H0H_0 if the calculated F-statistic is greater than the critical F-value from the F-distribution table.

5.3 Calculating the ANOVA F-statistic

The F-statistic is the ratio of the variance between groups to the variance within groups. It is calculated as:

F=MSGMSEF = \frac{MSG}{MSE}

Where:

  • MSGMSG is the Mean Square for Groups.
  • MSEMSE is the Mean Square for Error.

To calculate MSGMSG and MSEMSE, several intermediate values are needed:

  1. Sample Means (xˉi\bar{x}_i): The average value for each group.

  2. Overall Mean (xˉˉ\bar{\bar{x}}): The weighted average of all group means, where weights are the sample sizes of each group. xˉˉ=∑i=1InixˉiN\bar{\bar{x}} = \frac{\sum_{i=1}^{I} n_i \bar{x}_i}{N} Where II is the number of groups, nin_i is the sample size of group ii, and N=∑i=1IniN = \sum_{i=1}^{I} n_i is the total sample size.

  3. Sum of Squares for Groups (SSG): Measures the variability between the group means and the overall mean. SSG=∑i=1Ini(xˉi−xˉˉ)2SSG = \sum_{i=1}^{I} n_i (\bar{x}_i - \bar{\bar{x}})^2

  4. Mean Square for Groups (MSG): The average variability between groups. MSG=SSGI−1MSG = \frac{SSG}{I - 1} The degrees of freedom for groups is dfgroups=I−1df_{groups} = I - 1.

  5. Sum of Squares for Error (SSE): Measures the variability within each group, pooled across all groups. It is often calculated using the sample variances (si2s_i^2). SSE=∑i=1I(ni−1)si2SSE = \sum_{i=1}^{I} (n_i - 1)s_i^2

  6. Mean Square for Error (MSE): The average variability within groups. MSE=SSEN−IMSE = \frac{SSE}{N - I} The degrees of freedom for error is dferror=N−Idf_{error} = N - I.

Note: The sum of squares for total (SSTSST) is the sum of SSGSSG and SSESSE: SST=SSG+SSESST = SSG + SSE. Its degrees of freedom are dftotal=N−1df_{total} = N - 1.

5.3.1 Example: Hotel Room Rates

Let's apply these calculations to the hotel room rate data.

  • Data: Four groups (areas) with sample sizes: Central (n1=3n_1=3), East (n2=7n_2=7), Maritimes (n3=6n_3=6), West (n4=8n_4=8). Total sample size N=24N=24.
  • Sample Means: xˉ1=151.00\bar{x}_1 = 151.00, xˉ2=268.00\bar{x}_2 = 268.00, xˉ3=209.67\bar{x}_3 = 209.67, xˉ4=241.50\bar{x}_4 = 241.50.
  • Sample Standard Deviations: s1=41.73s_1 = 41.73, s2=34.75s_2 = 34.75, s3=22.77s_3 = 22.77, s4=33.84s_4 = 33.84.
  1. Overall Mean (xˉˉ\bar{\bar{x}}): xˉˉ=3+7+6(209.67)+8(241.5)24=229.9583\bar{\bar{x}} = \frac{3 + 7 + 6(209.67) + 8(241.5)}{24} = 229.9583 .

  2. Sum of Squares for Groups (SSG): SSG=3(151−229.958)2+7(268−229.958)2+6(209.67−229.958)2+8(241.5−229.958)2SSG = 3(151 - 229.958)^2 + 7(268 - 229.958)^2 + 6(209.67 - 229.958)^2 + 8(241.5 - 229.958)^2 SSG≈32369.62SSG \approx 32369.62

  3. Mean Square for Groups (MSG): MSG=32369.624−1=32369.623≈10789.87MSG = \frac{32369.62}{4 - 1} = \frac{32369.62}{3} \approx 10789.87

  4. Sum of Squares for Error (SSE): SSE=(3−1)(41.73)2+(7−1)(34.75)2+(6−1)(22.77)2+(8−1)(33.84)2SSE = (3-1)(41.73)^2 + (7-1)(34.75)^2 + (6-1)(22.77)^2 + (8-1)(33.84)^2 SSE=2(1741.6) +6(1207.5) +5(518.5) +7(1145.1)SSE = 2(1741.6)\ + 6(1207.5)\ + 5(518.5)\ + 7(1145.1) SSE≈21337.35SSE \approx 21337.35

  5. Mean Square for Error (MSE): MSE=21337.3524−4=21337.3520≈1066.87MSE = \frac{21337.35}{24 - 4} = \frac{21337.35}{20} \approx 1066.87

  6. F-statistic: F=10789.871066.87≈10.11F = \frac{10789.87}{1066.87} \approx 10.11

5.3.2 The ANOVA Table

The ANOVA table is a standard way to summarize the calculations.

For the hotel example:

5.4 Conducting the Hypothesis Test (Hotel Example)

Using the calculated F-statistic and ANOVA table:

  1. Level of Significance (α\alpha): 0.05

  2. Hypotheses:

    • H0:μ1=μ2=μ3=μ4H_0: \mu_1 = \mu_2 = \mu_3 = \mu_4 (Mean room rates are equal across all areas)
    • Ha:H_a: At least one mean room rate differs.
  3. Test Statistic: F=10.11F = 10.11

  4. P-value: We need to find P(F3,20≥10.11)P(F_{3,20} \ge 10.11). Using F-tables or software, this P-value is less than 0.001.

    Tip: If you don't have access to an F-table that shows very small P-values, you can compare the calculated F-statistic to critical values for common alpha levels. For df1=3df_1=3 and df2=20df_2=20, the critical value at α=0.05\alpha=0.05 is approximately 3.10. Since 10.11>3.1010.11 > 3.10, we would reject H0H_0.

  5. Conclusion: Since the P-value ( < 0.001) is less than α\alpha (0.05), we reject the null hypothesis. We have sufficient evidence to conclude that at least one of the population mean room rates differs among the four areas.

5.5 Using R for ANOVA

R can efficiently perform ANOVA calculations and generate the ANOVA table.

# Assuming your data is in a dataframe named 'hotelrates' with columns 'rate' and 'area'
# Load necessary libraries if not already loaded (e.g., for leveneTest)
# library(car)

# Check for homogeneity of variances (optional but good practice)
# leveneTest(rate ~ area, data = hotelrates)
# The Levene test output might show a P-value > 0.05, supporting equal variances.

# Perform ANOVA
aov_model <- aov(rate ~ area, data = hotelrates)
summary(aov_model)

The R output for summary(aov_model) provides the ANOVA table:

## Df Sum Sq Mean Sq F value Pr(>F)
## area 3 32370 10790 10.11 0.00029 ***
## Residuals 20 21337 1067

This output confirms the calculated F-statistic (10.11) and provides a P-value (0.00029), which is less than 0.05, leading to the same conclusion.

5.6 Practice Problems

5.6.1 Assumption Identification

Question: Which of the following assumptions is NOT required for the ANOVA F-test? A. All populations have a normal distribution. B. All population variances are the same. C. All sample variances are the same. D. All samples are independent. E. All samples are simple random samples (or, in the case of an experiment, individuals are randomly assigned to groups).

Answer: C. While equal population variances are assumed (homoscedasticity), the equality of sample variances is not a strict requirement but rather a condition to check to support the population variance assumption.

5.6.2 Parameter Identification

Question: A student collects voltage readings from a solar electric system on sunny, cloudy, and rainy days.

Sunny DaysCloudy DaysRainy Days
13.512.712.1
13.012.512.2
13.913.011.9
14.012.812.4
13.812.612.0

What are II, nin_i (for i=1,2,3i=1, 2, 3), and NN?

Solution:

  • II (number of groups) = 3 (Sunny, Cloudy, Rainy)
  • n1n_1 (sample size for Sunny Days) = 5
  • n2n_2 (sample size for Cloudy Days) = 5
  • n3n_3 (sample size for Rainy Days) = 5
  • NN (total sample size) = n1+n2+n3=5+5+5=15n_1 + n_2 + n_3 = 5 + 5 + 5 = 15. Thus, the answer is I=3I=3, ni=5n_i=5, and N=15N=15.

5.6.3 Test Statistic Calculation

Question: Using the data from the previous practice problem, an ANOVA F-test is to be conducted. The ANOVA table has some missing values:

What is the value of the test statistic?

Solution:

  • Degrees of Freedom:

    • dfgroups=I−1df_{groups} = I - 1. From the problem context, I=3I=3, so dfgroups=3−1=2df_{groups} = 3 - 1 = 2.
    • dferror=N−Idf_{error} = N - I. We know dferror=12df_{error} = 12 and I=3I=3, so 12=N−312 = N - 3, which gives N=15N = 15. This matches our previous calculation.
    • dftotal=N−1=15−1=14df_{total} = N - 1 = 15 - 1 = 14. This also matches dfgroups+dferror=2+12=14df_{groups} + df_{error} = 2 + 12 = 14.
  • Sum of Squares:

    • SST=SSG+SSESST = SSG + SSE. We have SST=6.81SST = 6.81 and SSG=5.86SSG = 5.86.
    • SSE=SST−SSG=6.81−5.86=0.95SSE = SST - SSG = 6.81 - 5.86 = 0.95.
  • Mean Squares:

    • MSG=SSGdfgroups=5.862=2.93MSG = \frac{SSG}{df_{groups}} = \frac{5.86}{2} = 2.93.
    • MSE=SSEdferror=0.9512≈0.07917MSE = \frac{SSE}{df_{error}} = \frac{0.95}{12} \approx 0.07917.
  • F-statistic:

    • F=MSGMSE=2.930.07917≈37.01F = \frac{MSG}{MSE} = \frac{2.93}{0.07917} \approx 37.01.

The value of the test statistic is approximately 37.01.

6. Calculating the ANOVA F-statistic and conducting hypothesis tests with examples (part 4)

This section details the computational steps involved in calculating the ANOVA F-statistic and performing hypothesis tests, illustrated with practical examples and R code.

6.1 Step-by-step calculation of the ANOVA F-statistic

The Analysis of Variance (ANOVA) F-statistic is a key component in comparing means across multiple groups. Its calculation involves breaking down the total variation in the data into components attributable to between-group differences (groups) and within-group variability (error).

6.1.1 Calculating Sum of Squares for Groups (SSG)

The Sum of Squares for Groups (SSG) quantifies the variation between the means of the different groups and the overall mean of all observations.

The formula for SSG is: SSG=∑i=1Ini(xˉi−xˉˉ)2\text{SSG} = \sum_{i=1}^{I} n_i (\bar{x}_i - \bar{\bar{x}})^2 where:

  • II is the number of groups.
  • nin_i is the sample size of group ii.
  • xˉi\bar{x}_i is the sample mean of group ii.
  • xˉˉ\bar{\bar{x}} is the overall mean of all observations across all groups.

Example Calculation (GPA): Given three groups (universities) with sample sizes n1=5n_1=5, n2=6n_2=6, n3=4n_3=4, and their respective means xˉ1=2.91\bar{x}_1 = 2.91, xˉ2=3.74\bar{x}_2 = 3.74, xˉ3=3.31\bar{x}_3 = 3.31. The overall mean xˉˉ=3.35\bar{\bar{x}} = 3.35.

SSG=5(2.91−3.35)2+6(3.74−3.35)2+4(3.31−3.35)2\text{SSG} = 5(2.91 - 3.35)^2 + 6(3.74 - 3.35)^2 + 4(3.31 - 3.35)^2 SSG=5(−0.44)2+6(0.39)2+4(−0.04)2\text{SSG} = 5(-0.44)^2 + 6(0.39)^2 + 4(-0.04)^2 SSG=5(0.1936)+6(0.1521)+4(0.0016)\text{SSG} = 5(0.1936) + 6(0.1521) + 4(0.0016) SSG=0.968+0.9126+0.0064=1.887\text{SSG} = 0.968 + 0.9126 + 0.0064 = 1.887

6.1.2 Calculating Mean Square for Groups (MSG)

The Mean Square for Groups (MSG) is the SSG divided by its corresponding degrees of freedom. It represents the average variance between groups.

The formula for MSG is: MSG=SSGI−1\text{MSG} = \frac{\text{SSG}}{I - 1} where:

  • II is the number of groups.

Example Calculation (GPA): For the GPA example, there are I=3I=3 groups. MSG=1.8873−1=1.8872=0.9435\text{MSG} = \frac{1.887}{3 - 1} = \frac{1.887}{2} = 0.9435

6.1.3 Calculating Sum of Squares for Error (SSE)

The Sum of Squares for Error (SSE), also known as Sum of Squares Within, quantifies the variability of the observations within each group. It is calculated by summing the within-group variances, adjusted by their degrees of freedom.

The formula for SSE is: SSE=∑i=1I(ni−1)si2\text{SSE} = \sum_{i=1}^{I} (n_i - 1)s_i^2 where:

  • II is the number of groups.
  • nin_i is the sample size of group ii.
  • si2s_i^2 is the sample variance of group ii.

Example Calculation (GPA): Using the sample variances for the GPA example: s12=(0.344)2s_1^2 = (0.344)^2, s22=(0.471)2s_2^2 = (0.471)^2, s32=(0.596)2s_3^2 = (0.596)^2. SSE=(5−1)(0.344)2+(6−1)(0.471)2+(4−1)(0.596)2\text{SSE} = (5 - 1)(0.344)^2 + (6 - 1)(0.471)^2 + (4 - 1)(0.596)^2 SSE=4(0.118336)+5(0.221841)+3(0.355216)\text{SSE} = 4(0.118336) + 5(0.221841) + 3(0.355216) SSE=0.473344+1.109205+1.065648=2.6482\text{SSE} = 0.473344 + 1.109205 + 1.065648 = 2.6482

6.1.4 Calculating Mean Square for Error (MSE)

The Mean Square for Error (MSE), also known as Mean Square Within, is the SSE divided by its corresponding degrees of freedom. It represents the average variance within groups, serving as an estimate of the common population variance σ2\sigma^2 under the null hypothesis.

The formula for MSE is: MSE=SSEN−I\text{MSE} = \frac{\text{SSE}}{N - I} where:

  • NN is the total sample size (N=∑niN = \sum n_i).
  • II is the number of groups.

Example Calculation (GPA): The total sample size is N=5+6+4=15N = 5 + 6 + 4 = 15. MSE=2.648215−3=2.648212=0.2207\text{MSE} = \frac{2.6482}{15 - 3} = \frac{2.6482}{12} = 0.2207

6.1.5 Calculating the F-statistic

The F-statistic is the ratio of the Mean Square for Groups (MSG) to the Mean Square for Error (MSE). A larger F-statistic suggests that the variation between groups is large relative to the variation within groups, providing evidence against the null hypothesis.

The formula for the F-statistic is: F=MSGMSEF = \frac{\text{MSG}}{\text{MSE}}

Example Calculation (GPA): F=0.94350.2207=4.28F = \frac{0.9435}{0.2207} = 4.28

Note: If the null hypothesis (H0:μ1=μ2=⋯=μIH_0: \mu_1 = \mu_2 = \dots = \mu_I) is true, the F-statistic follows an F-distribution with I−1I-1 numerator degrees of freedom and N−IN-I denominator degrees of freedom.

6.2 Constructing the ANOVA table

The ANOVA table is a standardized way to summarize the results of an ANOVA test. It presents the sources of variation, degrees of freedom (df), Sum of Squares (SS), Mean Squares (MS), and the F-statistic.

The general structure of an ANOVA table is:

Example ANOVA Table (GPA):

6.3 Conducting hypothesis tests with ANOVA

The ANOVA test allows us to determine if there is a statistically significant difference among the means of three or more independent groups. The process follows the standard hypothesis testing framework.

6.3.1 Setting the level of significance and formulating hypotheses

  • Level of significance (α\alpha): This is the probability of rejecting the null hypothesis when it is actually true. Common values are 0.05 or 0.01.
  • Null Hypothesis (H0H_0): States that all population means are equal. H0:μ1=μ2=⋯=μIH_0: \mu_1 = \mu_2 = \dots = \mu_I.
  • Alternative Hypothesis (HaH_a): States that at least one population mean is different from the others. HaH_a: At least one μi\mu_i differs.

Example (GPA):

  • α=0.05\alpha = 0.05
  • H0:μ1=μ2=μ3H_0: \mu_1 = \mu_2 = \mu_3 (The mean GPAs for the three universities are equal)
  • HaH_a: At least one μi\mu_i differs (At least one of the mean GPAs differs among the three universities)

6.3.2 Determining the decision rule

The decision rule can be established using either the P-value approach or the critical value approach.

  • P-value approach: Reject H0H_0 if the P-value is less than or equal to α\alpha.
  • Critical value approach: Reject H0H_0 if the calculated F-statistic is greater than or equal to the critical F-value from the F-distribution table, with the appropriate degrees of freedom.

Example (GPA):

  • P-value approach: Reject H0H_0 if P-value ≤0.05\le 0.05.
  • Critical value approach: Reject H0H_0 if F≥FcriticalF \ge F_{\text{critical}}. The critical F-value for α=0.05\alpha = 0.05, with 2 numerator and 12 denominator degrees of freedom (F2,12,0.05F_{2,12,0.05}), is approximately 3.89. Therefore, reject H0H_0 if F≥3.89F \ge 3.89. 86 94.

6.3.3 Calculating the P-value

The P-value is the probability of observing an F-statistic as extreme as, or more extreme than, the one calculated, assuming the null hypothesis is true. It can be found using statistical software or F-distribution tables.

Example Calculation (GPA): The calculated F-statistic is 4.28, with df1=2df_1 = 2 and df2=12df_2 = 12. We want to find P(F2,12≥4.28)P(F_{2,12} \ge 4.28). From F-tables:

  • P(F2,12≥3.89)=0.05P(F_{2,12} \ge 3.89) = 0.05
  • P(F2,12≥5.10)=0.025P(F_{2,12} \ge 5.10) = 0.025

Since 3.89<4.28<5.103.89 < 4.28 < 5.10, the P-value is between 0.025 and 0.05. This P-value is less than the significance level of 0.05.

6.3.4 Making a conclusion

Based on the decision rule, a conclusion is drawn regarding the null hypothesis.

Example Conclusion (GPA): Since the P-value (between 0.025 and 0.05) is less than or equal to α=0.05\alpha = 0.05, we reject the null hypothesis. There is sufficient evidence at the 5% significance level to conclude that at least one of the mean GPAs differs among the three universities.

Interpretation of the P-value: The P-value represents the probability of observing the data, or more extreme data, if there were truly no difference in the mean GPAs across the three universities. A small P-value suggests that our observed data is unlikely under the assumption of no difference, thus leading us to reject H0H_0.

6.4 ANOVA using R code

Statistical software like R can automate the ANOVA calculations and hypothesis testing.

Example R Code (GPA): First, create a data frame with the university and grade data.

universities <- c("A", "A", "A", "A", "A", "B", "B",
                  "B", "B", "B", "B", "C", "C",
                  "C", "C")
grade <- c(2.97, 2.63, 3.05, 3.38, 2.52,
           4.28, 3.56, 3.88, 4.07, 3.72, 2.93,
           3.46, 4.01, 2.58, 3.17)
gradegpas <- data.frame(universities, grade)
gradegpas

Use aggregate to compute group means and standard deviations, which correspond to the preliminary calculations.

aggregate(gradegpas$grade, list(gradegpas$universities), FUN=mean)
# Group.1 x
# 1 A 2.910
# 2 B 3.740
# 3 C 3.305

aggregate(gradegpas$grade, list(gradegpas$universities), FUN=sd)
# Group.1 x
# 1 A 0.3444561
# 2 B 0.4709565
# 3 C 0.5957908

Perform the ANOVA using the aov() function and summary() to display the ANOVA table.

aovgpa <- aov(grade ~ universities, data = gradegpas)
summary(aovgpa)
# Df Sum Sq Mean Sq F value Pr(>F)
# universities 2 1.889 0.9443 4.278 0.0396 *
# Residuals 12 2.648 0.2207
# ---
# Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

The R output directly provides the F-statistic (4.278), degrees of freedom (2 for universities, 12 for Residuals), and the P-value (0.0396).

To obtain the P-value manually using R:

pvalue <- pf(4.278, 2, 12, lower.tail = FALSE)
pvalue
# 0.03957818.

To obtain the critical F-value:

critvalue <- qf(0.05, 2, 12, lower.tail = FALSE)
critvalue
# 3.885294 [1](#page=1).

These R calculations confirm the manual results.

6.5 Practice problems and interpretation

ANOVA is a powerful tool, and understanding its application through practice problems is crucial.

Practice Problem 1 (Hypotheses): When comparing the performance of four salesmen using an ANOVA F test, the appropriate hypotheses are:

  • H0H_0: All population means are equal.
  • HaH_a: At least one population mean differs from the others.

Options concerning sample means or variances are incorrect for comparing population means. Option E is incorrect because the alternative hypothesis for ANOVA should state at least one differs, not all differ. 100.

Practice Problem 2 (Critical Value): For an ANOVA F test comparing four salesmen with sample sizes nA=3n_A=3, nB=4n_B=4, nC=3n_C=3, nD=2n_D=2, giving a total N=3+4+3+2=12N = 3+4+3+2=12. The number of groups is I=4I=4.

  • Numerator degrees of freedom: I−1=4−1=3I - 1 = 4 - 1 = 3.
  • Denominator degrees of freedom: N−I=12−4=8N - I = 12 - 4 = 8.

The 5% critical value for the ANOVA F test (F3,8,0.05F_{3,8,0.05}) is approximately 4.07. 101.

Practice Problem 3 (Sum of Squares for Groups): Given an ANOVA table where the Group MS is 42.00 and the Group df is 3.

  • We know MSGroups=SSGdfGroupsMS_{\text{Groups}} = \frac{SSG}{df_{\text{Groups}}}.
  • Therefore, SSG=MSGroups×dfGroups=42.00×3=126.00SSG = MS_{\text{Groups}} \times df_{\text{Groups}} = 42.00 \times 3 = 126.00. 102.

Practice Problem 4 (Mean Square for Error): Given an ANOVA table with Total SS = 196.00 and SSG = 126.00, and Error df = 8.

  • We know SST=SSG+SSESST = SSG + SSE.
  • So, SSE=SST−SSG=196.00−126.00=70.00SSE = SST - SSG = 196.00 - 126.00 = 70.00.
  • Then, MSE=SSEdfError=70.008=8.75MSE = \frac{SSE}{df_{\text{Error}}} = \frac{70.00}{8} = 8.75. 103.

Practice Problem 5 (Estimate of Common Population Variance): Recall that in ANOVA, we assume common variance (σ2\sigma^2) across populations. The best estimate of this common population variance is the Mean Square for Error (MSE).

In the previous example, MSE=8.75MSE = 8.75. Therefore, the estimate of the common population variance σ2\sigma^2 is 8.75. 104.

7. Calculating the ANOVA F-statistic and conducting hypothesis tests with examples (part 5)

This section focuses on the practical application of ANOVA by detailing the calculation of the F-statistic, its interpretation within an ANOVA table, and conducting hypothesis tests using the calculated P-value.

7.1 Calculating the F-statistic and understanding the ANOVA table

The Analysis of Variance (ANOVA) F-statistic is a key component in determining whether there are statistically significant differences between the means of three or more groups. It is calculated as the ratio of the variance between groups to the variance within groups. The ANOVA table provides a structured summary of the different sources of variation in the data.

The core components of the ANOVA table are:

  • Source: Identifies the origin of the variation (Groups/Between, Error/Within, Total).
  • df (Degrees of Freedom): Represents the number of independent pieces of information used to estimate a parameter.
    • Degrees of Freedom for Groups (dfgroupsdf_{groups}) = Number of groups - 1.
    • Degrees of Freedom for Error (dferrordf_{error}) = Total number of observations - Number of groups.
    • Degrees of Freedom for Total (dftotaldf_{total}) = Total number of observations - 1.
  • SS (Sum of Squares): Measures the total variation within each source.
    • SSgroupsSS_{groups}: The variation between the means of the different groups.
    • SSerrorSS_{error}: The variation within each group (unexplained variance).
    • SStotalSS_{total}: The total variation in the data.
  • MS (Mean Square): An estimate of variance. It is calculated by dividing the Sum of Squares by its corresponding Degrees of Freedom.
    • MSgroups=SSgroupsdfgroupsMS_{groups} = \frac{SS_{groups}}{df_{groups}}
    • MSerror=SSerrordferrorMS_{error} = \frac{SS_{error}}{df_{error}}
  • F: The F-statistic, which is the ratio of the Mean Square for Groups to the Mean Square for Error.
    • F=MSgroupsMSerrorF = \frac{MS_{groups}}{MS_{error}}

The F-statistic is used to test the null hypothesis (H0H_0) that all group means are equal against the alternative hypothesis (HaH_a) that at least one group mean is different. A larger F-statistic indicates a greater difference between group means relative to the variation within groups.

7.1.1 Example calculation and interpretation

Consider the following ANOVA table with some missing values:

To calculate the F-statistic, we first need to ensure all MS values are present. We are given SSgroups=126.00SS_{groups} = 126.00 and dfgroups=3df_{groups} = 3, so MSgroups=126.003=42.00MS_{groups} = \frac{126.00}{3} = 42.00. We are also given SSerror=70.00SS_{error} = 70.00 and dferror=8df_{error} = 8, so MSerror=70.008=8.75MS_{error} = \frac{70.00}{8} = 8.75.

Now, we can calculate the F-statistic: F=MSgroupsMSerror=42.008.75=4.80F = \frac{MS_{groups}}{MS_{error}} = \frac{42.00}{8.75} = 4.80 So, the F-statistic is 4.80.

7.2 Conducting hypothesis tests using the P-value

Once the F-statistic is calculated, it is compared to a critical value from the F-distribution or used to determine a P-value. The P-value represents the probability of observing an F-statistic as extreme as, or more extreme than, the one calculated, assuming the null hypothesis is true.

Important: The P-value is used to make a decision about rejecting or failing to reject the null hypothesis. If the P-value is less than the chosen significance level (alpha, α\alpha), we reject H0H_0.

In the provided example, the calculated F-statistic is 4.80 with dfgroups=3df_{groups} = 3 and dferror=8df_{error} = 8. The P-value is determined by finding the area in the tail of the F-distribution (F3,8F_{3, 8}) that corresponds to this F-value.

The document states that:

  • P(F3,8>4.07)=0.05P(F_{3, 8} > 4.07) = 0.05
  • P(F3,8>5.42)=0.025P(F_{3, 8} > 5.42) = 0.025

Since our calculated F-statistic of 4.80 falls between 4.07 and 5.42, the P-value must lie between 0.025 and 0.05.

Example: Given the options for the P-value: A between 0.001 and 0.010 B between 0.050 and 0.100 C between 0.010 and 0.025 D greater than 0.100 E between 0.025 and 0.050

Based on our calculation, the P-value is between 0.025 and 0.050, making option E the correct choice 105.

If we were to set a significance level, for instance, α=0.05\alpha = 0.05, we would compare our P-value to this alpha. Since the P-value (between 0.025 and 0.050) is less than or equal to α=0.05\alpha=0.05, we would reject the null hypothesis, concluding that there is a statistically significant difference between at least two of the group means.

8. Confidence intervals in ANOVA and comparing ANOVA with the pooled two-sample t-test

This section details the construction of confidence intervals for individual population means and the differences between two population means within an ANOVA framework, and establishes the equivalence between ANOVA and the pooled two-sample t-test when comparing exactly two means.

8.1 Confidence intervals for individual population means in ANOVA

Within the ANOVA framework, we can construct confidence intervals for individual population means (μi\mu_i). These intervals provide a range of plausible values for a specific population mean, assuming the ANOVA assumptions are met, particularly the homogeneity of variances.

The formula for a 100(1−ϵ)%100(1 - \epsilon)\% confidence interval for μi\mu_i is given by: xˉi±tϵ/2,N−IMSEni\bar{x}_i \pm t_{\epsilon/2, N-I} \sqrt{\frac{MSE}{n_i}}

Where:

  • xˉi\bar{x}_i is the sample mean for group ii.
  • tϵ/2,N−It_{\epsilon/2, N-I} is the upper ϵ/2\epsilon/2 critical value from the tt-distribution with N−IN-I degrees of freedom. NN is the total number of observations across all groups, and II is the number of groups.
  • MSEMSE (Mean Squared Error) is the pooled estimate of the common population variance, denoted as sp2s_p^2. It represents our best guess for the common population variance (ω2\omega^2).
  • nin_i is the sample size for group ii.

Rationale for using MSE: The core assumption of ANOVA is that all populations share a common standard deviation (ω\omega). Therefore, to estimate this common population standard deviation, we utilize the pooled estimate sp=MSEs_p = \sqrt{MSE}. This pooled estimate is derived from all NN observations across all groups, providing a more robust and reliable estimate of ω\omega compared to using the standard deviation of a single sample (sis_i). This approach aligns with the unified variance assumption underlying ANOVA.

Example: To calculate a 95% confidence interval for the true mean GPA of students at University A, given xˉ1=2.91\bar{x}_1 = 2.91, n1=5n_1 = 5, and MSE=0.2207MSE = 0.2207, with N=15N=15 and I=3I=3. The degrees of freedom for the tt-distribution are N−I=15−3=12N-I = 15-3 = 12. The critical tt-value for ϵ/2=0.025\epsilon/2 = 0.025 with 12 degrees of freedom is t0.025,12=2.179t_{0.025, 12} = 2.179. The interval is: 2.91±2.1790.22075=2.91±2.179(0.2101)≈2.91±0.462.91 \pm 2.179 \sqrt{\frac{0.2207}{5}} = 2.91 \pm 2.179(0.2101) \approx 2.91 \pm 0.46. This yields a 95% confidence interval of (2.45,3.37)(2.45, 3.37) for the mean GPA of students at University A 109.

8.2 Confidence intervals for the difference between two population means

Confidence intervals can also be constructed for the difference between any two population means, μi−μj\mu_i - \mu_j. This is achieved by adapting the formula for a confidence interval for the difference between two independent means, utilizing the pooled variance estimate from ANOVA.

The formula for a 100(1−ϵ)%100(1 - \epsilon)\% confidence interval for μi−μj\mu_i - \mu_j is: (xˉi−xˉj)±tϵ/2,N−Isp2(1ni+1nj)(\bar{x}_i - \bar{x}_j) \pm t_{\epsilon/2, N-I} \sqrt{s_p^2 \left(\frac{1}{n_i} + \frac{1}{n_j}\right)}

Where:

  • xˉi\bar{x}_i and xˉj\bar{x}_j are the sample means for groups ii and jj, respectively.
  • tϵ/2,N−It_{\epsilon/2, N-I} is the upper ϵ/2\epsilon/2 critical value from the tt-distribution with N−IN-I degrees of freedom.
  • sp2=MSEs_p^2 = MSE is the pooled estimate of the common population variance.
  • nin_i and njn_j are the sample sizes for groups ii and jj, respectively.

Example: To calculate a 90% confidence interval for the difference in mean GPA between Universities B and C, given xˉ2=3.74\bar{x}_2 = 3.74, n2=6n_2 = 6, xˉ3=3.31\bar{x}_3 = 3.31, n3=4n_3 = 4, and MSE=0.2207MSE = 0.2207. The degrees of freedom are N−I=12N-I = 12. The critical tt-value for ϵ/2=0.05\epsilon/2 = 0.05 with 12 degrees of freedom is t0.05,12=1.782t_{0.05, 12} = 1.782. The interval is: (3.74−3.31)±1.7820.2207(16+14)(3.74 - 3.31) \pm 1.782 \sqrt{0.2207 \left(\frac{1}{6} + \frac{1}{4}\right)} =0.43±1.7820.2207(0.1667+0.25)= 0.43 \pm 1.782 \sqrt{0.2207 (0.1667 + 0.25)} =0.43±1.7820.2207(0.4167)= 0.43 \pm 1.782 \sqrt{0.2207 (0.4167)} =0.43±1.7820.09196= 0.43 \pm 1.782 \sqrt{0.09196} =0.43±1.782(0.3032)= 0.43 \pm 1.782 (0.3032) =0.43±0.54= 0.43 \pm 0.54. This yields a 90% confidence interval of (−0.11,0.97)(-0.11, 0.97) for the difference in mean GPA between Universities B and C 111.

8.3 Equivalence of ANOVA and the pooled two-sample t-test

When comparing exactly two population means (I=2I=2), ANOVA and the pooled two-sample tt-test are fundamentally equivalent. Both methods aim to determine if there is a statistically significant difference between the means of two groups, under the assumption of equal variances.

The equivalence can be observed in the following aspects:

  • Hypotheses:
    • ANOVA: H0:μ1=μ2H_0: \mu_1 = \mu_2 vs. Ha:μ1≠μ2H_a: \mu_1 \neq \mu_2
    • Pooled two-sample tt-test: H0:μ1=μ2H_0: \mu_1 = \mu_2 vs. Ha:μ1≠μ2H_a: \mu_1 \neq \mu_2
  • Pooled Variance Estimate: The pooled estimate of the common variance (sp2s_p^2) calculated in both methods is identical. In ANOVA, this is the MSEMSE, and in the pooled tt-test, it is sp2s_p^2. sp2=MSE=SSEtotalN−Is_p^2 = MSE = \frac{SSE_{total}}{N-I} When I=2I=2, N−I=n1+n2−2N-I = n_1 + n_2 - 2, which is the degrees of freedom for the pooled tt-test.
  • Test Statistics: The test statistics are related by squaring. The FF-statistic from ANOVA is equal to the square of the tt-statistic from the pooled two-sample tt-test: F=t2F = t^2
  • P-values: Consequently, the PP-values obtained from both tests are identical.

Example: Consider an experiment comparing memory scores between a group that read a list of words (Group 1, n1=10n_1=10) and a group that heard the list (Group 2, n2=9n_2=9). A pooled two-sample tt-test yielded sp2=116.92s_p^2 = 116.92 and t=2.21t = 2.21, with a PP-value of 0.04080.0408. Performing an ANOVA FF-test for the same data:

  • MSE=116.92MSE = 116.92 (identical to sp2s_p^2).
  • The ANOVA FF-statistic is calculated as F=MSTMSEF = \frac{MST}{MSE}, where MSTMST is the Mean Squared Treatment. From the ANOVA output, MST=573.2MST = 573.2.
  • F=573.2116.92≈4.901F = \frac{573.2}{116.92} \approx 4.901.
  • This FF-statistic is the square of the tt-statistic: t2=(2.21)2≈4.8841t^2 = (2.21)^2 \approx 4.8841 (slight discrepancy due to rounding in the example's reported tt-value).
  • The PP-value from the ANOVA test is 0.04080.0408, identical to the PP-value from the pooled tt-test 118.

This equivalence simplifies the analysis when comparing only two groups, as either method provides the same inferential conclusion. The ANOVA framework naturally extends this to more than two groups, whereas the pooled tt-test is limited to two groups.

Important: When the FF-statistic from an ANOVA comparing two groups is FF, the corresponding tt-statistic for the pooled two-sample tt-test will be t=Ft = \sqrt{F} (for a two-tailed test, considering the absolute value of tt). The PP-values from both tests are identical. For instance, if an ANOVA FF-test yields a test statistic of 7.20 and a PP-value of 0.02, a pooled two-sample tt-test would have a test statistic of t=7.20≈2.68t = \sqrt{7.20} \approx 2.68 and the same PP-value of 0.02 119.

9. Robustness of ANOVA procedures

ANOVA procedures demonstrate considerable robustness against violations of underlying assumptions, particularly concerning normality and equal variances.

9.1 Robustness to normality assumption

ANOVA procedures are notably resilient to deviations from the normality assumption for population distributions. The key factor is the approximate normality of the sampling distribution of the means. This condition is often met, especially with larger sample sizes, due to the Central Limit Theorem (CLT). The CLT posits that as sample size increases, the distribution of sample means will approach a normal distribution, regardless of the shape of the parent population distribution.

Important: The Central Limit Theorem is critical for ensuring the validity of ANOVA results even when individual group data are not perfectly normally distributed, provided sample sizes are sufficiently large.

9.2 Robustness to unequal population variances

ANOVA is also relatively insensitive to the presence of unequal population variances (or standard deviations) across the groups being compared. This robustness is enhanced when the sample sizes for all groups are equal or similar. Even if the populations do not share a common variance, the ANOVA test can still yield fairly accurate results.

Tip: While ANOVA is robust to unequal variances, significant disparities in sample sizes can exacerbate the impact of this violation. When possible, aim for balanced sample sizes across groups to maximize robustness 120.

Assumption ViolationRobustness LevelCondition for Enhanced Robustness
Non-normalityHighLarge sample sizes (CLT applies)
Unequal population variancesModerate to HighEqual or similar sample sizes

Common mistakes to avoid

  • Review all topics thoroughly before exams
  • Pay attention to formulas and key definitions
  • Practice with examples provided in each section
  • Don't memorize without understanding the underlying concepts

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also