Solved Exercises on Introduction to One-Way ANOVA

Master one-way ANOVA: comparing means across multiple groups with detailed statistical analysis through these 5 exercises.

Solution: Exercises 1 to 3
1 Basic One-Way ANOVA
Exercise 1
A researcher compares test scores from three different teaching methods. Method A: 85, 87, 82, 88, 86; Method B: 78, 80, 76, 82, 79; Method C: 92, 90, 94, 91, 89. Test at α = 0.05 whether there are significant differences in mean test scores.
Definition:

One-way ANOVA: A statistical method to test whether the means of three or more groups are equal.

One-Way ANOVA Methodology:
  1. State null and alternative hypotheses
  2. Calculate group means and overall mean
  3. Compute sum of squares (between, within, total)
  4. Calculate mean squares
  5. Compute F-statistic
  6. Determine critical value or p-value
  7. Make decision and draw conclusion
Step 1: State hypotheses

H₀: μ_A = μ_B = μ_C (all means are equal)

H₁: At least one mean differs

Step 2: Calculate group means

Method A: (85+87+82+88+86)/5 = 85.6

Method B: (78+80+76+82+79)/5 = 79.0

Method C: (92+90+94+91+89)/5 = 91.2

Step 3: Calculate overall mean

Overall mean: (85.6 + 79.0 + 91.2)/3 = 85.27

Step 4: Calculate sum of squares between groups (SSB)

SSB = Σn_i(ȳ_i - ȳ)²

SSB = 5(85.6-85.27)² + 5(79.0-85.27)² + 5(91.2-85.27)²

SSB = 5(0.11) + 5(39.24) + 5(35.49) = 0.55 + 196.2 + 177.45 = 374.2

Step 5: Calculate sum of squares within groups (SSW)

SSW = ΣΣ(y_ij - ȳ_i)²

Method A: (85-85.6)² + ... + (86-85.6)² = 21.2

Method B: (78-79)² + ... + (79-79)² = 20.0

Method C: (92-91.2)² + ... + (89-91.2)² = 17.2

SSW = 21.2 + 20.0 + 17.2 = 58.4

Step 6: Calculate degrees of freedom

df_between = k - 1 = 3 - 1 = 2

df_within = N - k = 15 - 3 = 12

Step 7: Calculate mean squares

MSB = SSB/df_between = 374.2/2 = 187.1

MSW = SSW/df_within = 58.4/12 = 4.87

Step 8: Calculate F-statistic

F = MSB/MSW = 187.1/4.87 = 38.4

Step 9: Determine critical value

F_critical(2, 12) at α = 0.05 = 3.89

Step 10: Make decision

Since F = 38.4 > 3.89, we reject H₀

F = 38.4, df = (2, 12), reject H₀ at α = 0.05
Final answer:

We reject the null hypothesis. There are significant differences in mean test scores among the three teaching methods at α = 0.05.

Applied rules:

• ANOVA principle: Compare between-group to within-group variance

• F-test: F = MSB/MSW

• Decision rule: Reject H₀ if F > F_critical

ANOVA Summary:

• Between groups SS = 374.2, df = 2, MS = 187.1

• Within groups SS = 58.4, df = 12, MS = 4.87

• F-statistic = 38.4, p-value < 0.001

2 ANOVA with Equal Sample Sizes
Exercise 2
A study compares the effectiveness of four different fertilizers on plant growth. Each fertilizer was applied to 6 plants: Fertilizer A: 12, 14, 13, 15, 14, 12; Fertilizer B: 10, 11, 12, 11, 10, 12; Fertilizer C: 16, 17, 15, 16, 17, 15; Fertilizer D: 13, 14, 13, 14, 15, 13. Test at α = 0.01 whether there are differences in mean growth.
Definition:

Equal sample sizes: When each group has the same number of observations, calculations are simplified.

Step 1: Calculate group means

Fertilizer A: (12+14+13+15+14+12)/6 = 13.33

Fertilizer B: (10+11+12+11+10+12)/6 = 11.00

Fertilizer C: (16+17+15+16+17+15)/6 = 16.00

Fertilizer D: (13+14+13+14+15+13)/6 = 13.67

Step 2: Calculate overall mean

Overall mean: (13.33 + 11.00 + 16.00 + 13.67)/4 = 13.50

Step 3: Calculate SSB

SSB = 6(13.33-13.5)² + 6(11.0-13.5)² + 6(16.0-13.5)² + 6(13.67-13.5)²

SSB = 6(0.028) + 6(6.25) + 6(6.25) + 6(0.028) = 0.17 + 37.5 + 37.5 + 0.17 = 75.34

Step 4: Calculate SSW

Fertilizer A: (12-13.33)² + ... + (12-13.33)² = 6.67

Fertilizer B: (10-11)² + ... + (12-11)² = 4.00

Fertilizer C: (16-16)² + ... + (15-16)² = 4.00

Fertilizer D: (13-13.67)² + ... + (13-13.67)² = 3.33

SSW = 6.67 + 4.00 + 4.00 + 3.33 = 18.00

Step 5: Calculate degrees of freedom

df_between = 4 - 1 = 3

df_within = 24 - 4 = 20

Step 6: Calculate mean squares

MSB = 75.34/3 = 25.11

MSW = 18.00/20 = 0.90

Step 7: Calculate F-statistic

F = 25.11/0.90 = 27.90

Step 8: Determine critical value

F_critical(3, 20) at α = 0.01 = 4.94

Step 9: Make decision

Since F = 27.90 > 4.94, we reject H₀

F = 27.90, df = (3, 20), reject H₀ at α = 0.01
Final answer:

We reject the null hypothesis. There are significant differences in mean plant growth among the four fertilizers at α = 0.01.

Applied rules:

• Equal sample sizes: Simplifies SSB calculation

• Higher α: Stricter significance level requires larger F

• Statistical significance: Evidence of differences exists

ANOVA Summary:

• Between groups SS = 75.34, df = 3, MS = 25.11

• Within groups SS = 18.00, df = 20, MS = 0.90

• F-statistic = 27.90, p-value < 0.001

3 No Significant Difference Case
Exercise 3
A study compares reaction times for three different lighting conditions. Condition 1: 250, 255, 248, 252; Condition 2: 249, 253, 251, 250; Condition 3: 252, 248, 251, 253. Test at α = 0.05 whether there are significant differences in mean reaction times.
Definition:

Non-significant result: When F-statistic is less than critical value, we fail to reject the null hypothesis.

Step 1: Calculate group means

Condition 1: (250+255+248+252)/4 = 251.25

Condition 2: (249+253+251+250)/4 = 250.75

Condition 3: (252+248+251+253)/4 = 251.00

Step 2: Calculate overall mean

Overall mean: (251.25 + 250.75 + 251.00)/3 = 251.00

Step 3: Calculate SSB

SSB = 4(251.25-251)² + 4(250.75-251)² + 4(251.00-251)²

SSB = 4(0.0625) + 4(0.0625) + 4(0) = 0.25 + 0.25 + 0 = 0.50

Step 4: Calculate SSW

Condition 1: (250-251.25)² + ... + (252-251.25)² = 12.75

Condition 2: (249-250.75)² + ... + (250-250.75)² = 6.75

Condition 3: (252-251)² + ... + (253-251)² = 10.00

SSW = 12.75 + 6.75 + 10.00 = 29.50

Step 5: Calculate degrees of freedom

df_between = 3 - 1 = 2

df_within = 12 - 3 = 9

Step 6: Calculate mean squares

MSB = 0.50/2 = 0.25

MSW = 29.50/9 = 3.28

Step 7: Calculate F-statistic

F = 0.25/3.28 = 0.076

Step 8: Determine critical value

F_critical(2, 9) at α = 0.05 = 4.26

Step 9: Make decision

Since F = 0.076 < 4.26, we fail to reject H₀

Step 10: Draw conclusion

There is insufficient evidence to conclude that lighting conditions significantly affect reaction time.

F = 0.076 < 4.26, fail to reject H₀
Final answer:

We fail to reject the null hypothesis. There is no significant difference in mean reaction times among the three lighting conditions at α = 0.05.

Applied rules:

• Non-significant result: Fails to reject H₀

• No evidence: Insufficient evidence of differences

• Not proof: Failing to reject ≠ proving equality

ANOVA Summary:

• Between groups SS = 0.50, df = 2, MS = 0.25

• Within groups SS = 29.50, df = 9, MS = 3.28

• F-statistic = 0.076, p-value > 0.05

ANOVA Principles and Formulas
\( F = \frac{MSB}{MSW} = \frac{\frac{SSB}{df_{between}}}{\frac{SSW}{df_{within}}} \)
F-Statistic Formula
Sum of Squares
\( SST = SSB + SSW \)
Total = Between + Within
Degrees of Freedom
\( df_{total} = df_{between} + df_{within} \)
Total decomposition
Between Groups
\( SSB = \sum n_i(\bar{y}_i - \bar{y})^2 \)
Variance between groups
Within Groups
\( SSW = \sum \sum (y_{ij} - \bar{y}_i)^2 \)
Variance within groups
Key definitions:

Analysis of Variance (ANOVA): A statistical method to compare means of multiple groups simultaneously.

Null hypothesis (H₀): All group means are equal.

Alternative hypothesis (H₁): At least one group mean differs from others.

Sum of squares between (SSB): Measures variation between group means and overall mean.

Sum of squares within (SSW): Measures variation within each group.

F-statistic: Ratio of between-group variance to within-group variance.

Complete ANOVA Methodology:
  1. Verify assumptions: Normality, equal variances, independence
  2. State hypotheses: H₀: μ₁ = μ₂ = ... = μₖ vs H₁: Not all means equal
  3. Calculate group statistics: Means and standard deviations
  4. Compute sums of squares: SSB, SSW, SST
  5. Calculate degrees of freedom: df_between, df_within, df_total
  6. Compute mean squares: MSB = SSB/df_between, MSW = SSW/df_within
  7. Calculate F-statistic: F = MSB/MSW
  8. Make decision: Compare F with critical value or p-value
  9. Draw conclusion: Interpret results in context
Tip 1: Always check ANOVA assumptions before conducting the test.
Tip 2: The F-statistic measures the ratio of between-group to within-group variation.
Tip 3: Large F-values indicate significant differences between groups.
Tip 4: ANOVA tells us if differences exist, but not which specific groups differ.
Tip 5: Post-hoc tests are needed to identify which groups differ significantly.

Common applications: Psychology, medicine, agriculture, manufacturing, education research.
Limitations: Requires assumptions, doesn't identify specific differences, sensitive to outliers.
ANOVA assumptions:

• Independence: Observations within and between groups are independent

• Normality: Data in each group is normally distributed

• Equal variances: Homogeneity of variance across groups

Important considerations:

• ANOVA assumes equal variances across groups

• Large sample sizes help meet normality assumption

• Outliers can significantly affect results

• ANOVA is robust to minor assumption violations

Solution: Exercises 4 to 5
4 P-Value Approach
Exercise 4
A company tests three different training programs. Program 1: 80, 82, 78, 84, 81; Program 2: 85, 87, 83, 86, 84; Program 3: 79, 81, 77, 83, 80. Use the p-value approach at α = 0.05.
Definition:

P-value approach: Compare the calculated p-value with the significance level α to make a decision.

Step 1: Calculate group means

Program 1: (80+82+78+84+81)/5 = 81.0

Program 2: (85+87+83+86+84)/5 = 85.0

Program 3: (79+81+77+83+80)/5 = 80.0

Step 2: Calculate overall mean

Overall mean: (81.0 + 85.0 + 80.0)/3 = 82.0

Step 3: Calculate SSB

SSB = 5(81.0-82.0)² + 5(85.0-82.0)² + 5(80.0-82.0)²

SSB = 5(1) + 5(9) + 5(4) = 5 + 45 + 20 = 70

Step 4: Calculate SSW

Program 1: (80-81)² + ... + (81-81)² = 20

Program 2: (85-85)² + ... + (84-85)² = 10

Program 3: (79-80)² + ... + (80-80)² = 20

SSW = 20 + 10 + 20 = 50

Step 5: Calculate mean squares

df_between = 3 - 1 = 2

df_within = 15 - 3 = 12

MSB = 70/2 = 35

MSW = 50/12 = 4.17

Step 6: Calculate F-statistic

F = 35/4.17 = 8.39

Step 7: Find p-value

Using F-distribution with df = (2, 12)

p-value ≈ 0.005

Step 8: Make decision

Since p-value (0.005) < α (0.05), we reject H₀

p-value = 0.005 < 0.05, reject H₀
Final answer:

We reject the null hypothesis. There are significant differences in mean performance among the three training programs at α = 0.05.

Applied rules:

• P-value method: Compare p-value with α

• Decision rule: Reject H₀ if p-value ≤ α

• Statistical significance: Strong evidence of differences

5 ANOVA Table Construction
Exercise 5
Complete the ANOVA table for a study comparing four treatments with 8 subjects each: SSB = 120, SSW = 240. Complete the table and test at α = 0.05.
Definition:

ANOVA table: Organized summary of ANOVA calculations showing sources of variation, degrees of freedom, sum of squares, mean squares, and F-statistic.

Step 1: Calculate degrees of freedom

df_between = k - 1 = 4 - 1 = 3

df_within = N - k = 32 - 4 = 28

df_total = N - 1 = 32 - 1 = 31

Step 2: Calculate total sum of squares

SST = SSB + SSW = 120 + 240 = 360

Step 3: Calculate mean squares

MSB = SSB/df_between = 120/3 = 40

MSW = SSW/df_within = 240/28 = 8.57

Step 4: Calculate F-statistic

F = MSB/MSW = 40/8.57 = 4.67

Step 5: Determine critical value

F_critical(3, 28) at α = 0.05 = 2.95

Step 6: Make decision

Since F = 4.67 > 2.95, we reject H₀

Step 7: Complete ANOVA table
Source df SS MS F
Between 3 120 40 4.67
Within 28 240 8.57
Total 31 360
F = 4.67, df = (3, 28), reject H₀ at α = 0.05
Final answer:

We reject the null hypothesis. There are significant differences among the four treatment means at α = 0.05.

Applied rules:

• ANOVA table: Organized presentation of results

• Relationships: df_total = df_between + df_within

• Decision making: Compare F with critical value

Detailed Concepts and Applications
\( MSB = \frac{\sum_{i=1}^{k} n_i(\bar{y}_i - \bar{y})^2}{k-1}, \quad MSW = \frac{\sum_{i=1}^{k} \sum_{j=1}^{n_i} (y_{ij} - \bar{y}_i)^2}{N-k} \)
Mean Square Formulas
Key definitions:

Experimental design: The framework for organizing data collection to enable statistical analysis.

Factor: The variable being manipulated (independent variable) in an experiment.

Levels: The different values or categories of a factor.

Treatment groups: The groups defined by the different levels of the factor.

Response variable: The dependent variable being measured.

Randomization: Assigning subjects to treatment groups randomly to minimize bias.

Advanced ANOVA Methodology:
  1. Design planning: Plan the experiment with appropriate sample sizes
  2. Randomization: Randomly assign subjects to treatment groups
  3. Data collection: Gather data according to experimental protocol
  4. Descriptive analysis: Calculate group statistics and visualize data
  5. Assumption checking: Test normality and equal variance assumptions
  6. ANOVA computation: Calculate all ANOVA components
  7. Statistical inference: Conduct hypothesis test
  8. Post-hoc analysis: If significant, determine which groups differ
  9. Practical interpretation: Connect statistical findings to real-world implications
Tip 1: Always visualize your data with boxplots or bar charts before ANOVA.
Tip 2: Use Levene's test to check for equal variances assumption.
Tip 3: Consider Welch's ANOVA if variances are unequal.
Tip 4: Power analysis helps determine adequate sample sizes.
Tip 5: Effect size measures (eta-squared) complement significance tests.

Common applications: Clinical trials, agricultural experiments, industrial quality control, educational research, psychological studies.
Advanced considerations: Two-way ANOVA, repeated measures, factorial designs, mixed models, nonparametric alternatives.
Key principles and guidelines:

• ANOVA principle: Compare systematic variation to random variation

• Multiple comparisons: Control family-wise error rate

• Effect size: Report practical significance along with statistical significance

• Assumption checking: Verify conditions before inference

• Interpretation: Connect statistical results to research question

Additional considerations:

• ANOVA can be extended to multiple factors and interactions

• Post-hoc tests (Tukey's HSD, Bonferroni) identify specific differences

• Effect size measures help assess practical significance

• Consider alternatives if assumptions are severely violated

Questions & Answers

Question: Why can't I just use multiple t-tests instead of ANOVA to compare multiple groups?

Answer: Using multiple t-tests instead of ANOVA creates a problem called "multiple comparisons" or "family-wise error rate inflation":

  • Increased Type I error: If you test at α = 0.05 for each comparison, the overall probability of making at least one Type I error increases dramatically
  • For 3 groups: 3 comparisons would result in approximately 14% chance of at least one false positive
  • For 4 groups: 6 comparisons would result in approximately 26% chance of at least one false positive

ANOVA controls the overall Type I error rate at the desired level (e.g., 5%). It tests all group means simultaneously while maintaining the pre-specified significance level.

If ANOVA finds significant differences, post-hoc tests can then be used to identify which specific groups differ, with appropriate corrections for multiple comparisons.

ANOVA is more efficient and maintains the intended error rate when comparing multiple groups.

Question: What does the F-statistic really measure in ANOVA?

Answer: The F-statistic measures the ratio of two sources of variation:

  • Numerator (MSB): Variation between group means (systematic variation due to treatment effects)
  • Denominator (MSW): Variation within groups (random variation or error)

F = (Variation due to treatment) / (Random variation)

The interpretation:

  • F ≈ 1: Between-group variation is similar to within-group variation (no evidence of treatment effects)
  • F >> 1: Between-group variation is much larger than within-group variation (evidence of treatment effects)

Under the null hypothesis (all means equal), F follows an F-distribution. Large F-values provide evidence against the null hypothesis.

Essentially, F measures whether the differences between group means are larger than what would be expected due to random variation alone.

Question: What should I do if ANOVA shows significant differences between groups?

Answer: When ANOVA shows significant differences, you need to determine which specific groups differ:

  • Post-hoc tests: Conduct pairwise comparisons between groups
  • Common methods: Tukey's HSD (Honestly Significant Difference), Bonferroni correction, Scheffe's method
  • Pairwise t-tests: With appropriate multiple comparison corrections

The most common approach is Tukey's HSD:

  • Controls the family-wise error rate
  • Compares all possible pairs of means
  • Uses a critical value that accounts for multiple comparisons

Alternatively, you can perform planned contrasts if you had specific comparisons in mind before seeing the data.

Also consider calculating effect sizes (such as eta-squared) to assess the practical significance of the differences.

Remember that statistical significance doesn't necessarily imply practical importance.