Statistics 2nd ed

factorial-design

Factorial ANOVA

factorial layout
factorial means interaction
factorial interaction

Goal. Test the effects of Method (Lecture vs. Online) and Time (Early vs. Late) on exam scores, and whether there is an interaction between Method and Time.

Design & Experiment

  • Factor A (Method): Lecture vs. Online
  • Factor B (Time): Early vs. Late
  • Balanced design: \(n=5\) per cell ⇒ total \(N=20\).

Students are randomly assigned to one of four cells (Method × Time). After a short module, all students take the same 100-point exam.

Figure 1: 2 × 2 layout (Method × Time).


Data

Scores by cell (five students per cell):

MethodTimeScoresCell Mean
LectureEarly686870727270.0
LectureLate767678808078.0
OnlineEarly707072747472.0
OnlineLate717173757573.0

Within each cell the sample variance is 4 (SD = 2), so the within-cell sum of squares is \((n-1)s^2 = 4\times4 = 16\) per cell.

Figure 2: Means with SEM by Time, separate lines for Method.

Figure 3: Interaction plot (Lecture rises sharply; Online nearly flat).


Step 1 — Marginal Means and Grand Mean

Cell means: \[ \bar X_{\text{Lecture,Early}}=70,\; \bar X_{\text{Lecture,Late}}=78,\; \bar X_{\text{Online,Early}}=72,\; \bar X_{\text{Online,Late}}=73. \] Marginal means: \[ \bar X_{\text{Lecture}}=\frac{70+78}{2}=74,\quad \bar X_{\text{Online}}=\frac{72+73}{2}=72.5; \qquad \bar X_{\text{Early}}=\frac{70+72}{2}=71,\quad \bar X_{\text{Late}}=\frac{78+73}{2}=75.5. \] Grand mean: \[ \bar X=\frac{70+78+72+73}{4}=73.25. \]


Step 2 — Sums of Squares (Between)

Balanced design formulas (with \(n\) per cell, \(a=b=2\)):

  • \(SS_A = nb \sum_a(\bar X_{a\cdot}-\bar X)^2\), here \(nb=10\).
  • \(SS_B = na \sum_b(\bar X_{\cdot b}-\bar X)^2\), here \(na=10\).
  • \(SS_{AB} = n \sum_{a,b}\big(\bar X_{ab}-\bar X_{a\cdot}-\bar X_{\cdot b}+\bar X\big)^2\), here \(n=5\).

Compute each term:

Factor A (Method): \[ \begin{aligned} SS_A &= 10\Big[(74-73.25)^2 + (72.5-73.25)^2\Big]\\ &= 10\big[0.75^2 + (-0.75)^2\big] = 10(0.5625+0.5625)=\mathbf{11.25}. \end{aligned} \]

Factor B (Time): \[ \begin{aligned} SS_B &= 10\Big[(71-73.25)^2 + (75.5-73.25)^2\Big]\\ &= 10\big[(-2.25)^2 + (2.25)^2\big] = 10(5.0625+5.0625)=\mathbf{101.25}. \end{aligned} \]

Interaction \(A\times B\): For each cell compute \(d_{ab}=\bar X_{ab}-\bar X_{a\cdot}-\bar X_{\cdot b}+\bar X\). Here each \(d_{ab}=\pm1.75\) so \(d_{ab}^2=3.0625\) and there are four cells: \[ SS_{AB}=5\times(4\times3.0625)=\mathbf{61.25}. \]


Step 3 — Within-Group (Error) and Total SS

Within each cell, \((n-1)s^2=16\). With 4 cells: \[ SS_{\text{within}}=\mathbf{64.00}. \]

Total: \[ SS_{\text{total}}=SS_A+SS_B+SS_{AB}+SS_{\text{within}} =11.25+101.25+61.25+64.00=\mathbf{238.75}. \]


Step 4 — Degrees of Freedom & Mean Squares

\[ \begin{aligned} &df_A=a-1=1,\quad df_B=b-1=1,\quad df_{AB}=(a-1)(b-1)=1,\\ &df_{\text{within}}=N-ab=20-4=\mathbf{16},\quad df_{\text{total}}=N-1=19. \end{aligned} \] \[ MS_A=\frac{11.25}{1}=11.25,\quad MS_B=\frac{101.25}{1}=101.25,\quad MS_{AB}=\frac{61.25}{1}=61.25,\quad MS_{\text{within}}=\frac{64.00}{16}=\mathbf{4.00}. \]


Step 5 — F Tests & p-values

\[ F_A=\frac{MS_A}{MS_{\text{within}}}=\frac{11.25}{4}= \mathbf{2.8125},\qquad F_B=\frac{MS_B}{MS_{\text{within}}}=\frac{101.25}{4}= \mathbf{25.3125},\qquad F_{AB}=\frac{MS_{AB}}{MS_{\text{within}}}=\frac{61.25}{4}= \mathbf{15.3125}. \] With \(df_1=1\), \(df_2=16\): \[ p_A \approx 0.11\;(\text{n.s.}),\quad p_B < 0.001,\quad p_{AB} \approx 0.001. \]


ANOVA Summary Table

SourceSSdfMSFp
Method (A)11.25111.252.8125≈ 0.11
Time (B)101.251101.2525.3125< 0.001
A × B61.25161.2515.3125≈ 0.001
Within (Error)64.00164.00
Total238.7519

Interpretation

Main effect of Time (B) is significant: Late > Early on average. Main effect of Method (A) is not significant at conventional levels. The interaction (A × B) is significant: Lecture improves markedly from Early→Late, while Online changes little—non-parallel lines in the interaction plot.

Figure 4: Interaction plot highlighting non-parallel lines.

Assumptions (checklist)

  • Independence of observations within and across cells.
  • Approximately normal scores within each cell.
  • Homogeneity of variances across cells (here, each cell variance ≈ 4).

Practice self-test quiz

In the space below, please find practice problems and self-test quizzes. For full access, please signup free.

Part 4 — Applications (Cases and Examples)


Welcome to Part 4 — Applications (Cases and Examples) of this free online high school statistics textbook. This hands-on section brings statistical concepts to life through detailed, worked-out case studies and real-world examples. High school students explore complete applications of hypothesis testing—including t-tests, ANOVA designs, chi-square tests, and non-parametric methods—covering everything from formulating research questions and selecting the appropriate test to performing calculations, interpreting results, and drawing meaningful conclusions.

Ideal for AP Statistics practice and pre-college preparation, Part 4 features 10 comprehensive cases with step-by-step explanations, formulas, data examples, and practical scenarios (e.g., comparing teaching methods, stress reduction programs, and categorical associations). These worked examples reinforce descriptive statistics, inferential statistics, and critical statistical thinking in an engaging, example-driven format.

Case Studies in Part 4: Applications

  1. Case 1: Independent t-Test – Comparing two independent groups (e.g., different teaching methods).
  2. Case 2: Paired t-Test – Analyzing before-and-after data in the same subjects.
  3. Case 3: One-Way ANOVA – Testing differences across three or more groups.
  4. Case 4: Factorial ANOVA (2×2 Design) – Examining main effects and interactions.
  5. Case 5: Repeated-Measures ANOVA – Handling multiple measurements on the same subjects.
  6. Case 6: Mixed ANOVA – Combining between-subjects and within-subjects factors.
  7. Case 7: Chi-Square Goodness-of-Fit – Assessing observed vs. expected frequencies.
  8. Case 8: Chi-Square Test of Independence – Exploring relationships in categorical data.
  9. Case 9: Mann-Whitney U Test – Non-parametric alternative for two independent samples.
  10. Case 10: Wilcoxon Signed-Rank Test – Non-parametric option for paired data.

A practice self-test quiz is also available to reinforce learning (optional signup for full interactive access). Dive into these free high school statistics applications for real-world insight into hypothesis testing, statistical analysis examples, and building confidence with data interpretation!

Case 1 — Independent t-test (Two Groups)

Scenario: A teacher compares math scores of students taught by lecture vs. interactive software.

Question: Are the two teaching methods different in average score?

Design/Test: Independent-samples t-test.

Worked Example:

  • Group A (Lecture): mean = 78, SD = 10, n = 20
  • Group B (Software): mean = 85, SD = 12, n = 20

Formula:
$$t = \frac{\bar{X}_1 - \bar{X}_2}{\sqrt{\tfrac{s_1^2}{n_1} + \tfrac{s_2^2}{n_2}}}$$

In words:
$$t = \frac{\text{mean}_1 - \text{mean}_2}{\sqrt{\tfrac{\text{variance}_1}{n_1} + \tfrac{\text{variance}_2}{n_2}}}$$

Plugging in values:
$$t = \frac{78 - 85}{\sqrt{\tfrac{100}{20} + \tfrac{144}{20}}} = \frac{-7}{\sqrt{12.2}} = \frac{-7}{3.49} = -2.01$$

Degrees of freedom = 38.


Case 2 — Paired t-test (Before and After)

Scenario: Students take a memory test before and after a week of practice.

Question: Did scores improve after training?

Design/Test: Paired-samples t-test.

Worked Example:

Differences (After – Before): 2, 4, 3, 5, 6

  • Mean difference:
    $$\bar{D} = \frac{2+4+3+5+6}{5} = 4$$
  • Standard deviation of differences: $$s_D = 1.58$$

Formula:
$$t = \frac{\bar{D}}{s_D / \sqrt{n}}$$

Plugging in values:
$$t = \frac{4}{1.58/\sqrt{5}} = \frac{4}{0.71} = 5.63$$

Degrees of freedom = 4.


Case 3 — One-way ANOVA (Three Groups)

Scenario: A psychologist tests meditation, exercise, and music as stress-reduction methods.

Question: Do the methods differ in mean stress score?

Design/Test: One-way ANOVA.

Worked Example:

  • Group means: Meditation = 65, Exercise = 70, Music = 80
  • $$SS_{\text{between}} = 300, , df_{\text{between}} = 2, , MS_{\text{between}} = 150$$
  • $$SS_{\text{within}} = 200, , df_{\text{within}} = 12, , MS_{\text{within}} = 16.7$$

Formula:
$$F = \frac{MS_{\text{between}}}{MS_{\text{within}}}$$

$$F = \frac{150}{16.7} = 9.0, \quad df = (2,12)$$


Case 4 — Factorial ANOVA (2 × 2 Design)

Scenario: A researcher studies teaching method (Lecture vs. Online) × Time of Day (Morning vs. Afternoon).

Question: Do method, time, or their interaction affect performance?

Design/Test: Two-way (factorial) ANOVA.

Worked Example (summary):

  • Lecture: Morning = 70, Afternoon = 90
  • Online: Morning = 80, Afternoon = 80

Interaction: Lecture scores rise with time, Online stays flat.

Formulas:

  • $$df_A = a - 1, , df_B = b - 1, , df_{A \times B} = (a-1)(b-1), , df_{\text{within}} = N - ab$$

Case 5 — Repeated-Measures ANOVA

Scenario: Five students are tested across three conditions.

Question: Do scores differ across conditions?

Design/Test: Repeated-measures ANOVA.

Worked Example (summary):

  • Means increase steadily: 70 → 75 → 80
  • df:
    $$df_{\text{rows}} = n - 1, \quad df_{\text{columns}} = k - 1, \quad df_{\text{error}} = (n-1)(k-1)$$

Formula:
$$F = \frac{MS_{\text{columns}}}{MS_{\text{error}}}$$


Case 6 — Mixed ANOVA

Scenario: Two groups (Drug, Placebo) tested across three weeks.

Question: Is there an effect of group, time, or interaction?

Design/Test: Mixed (split-plot) ANOVA.

Worked Example (summary):

  • Drug: 70 → 80 → 90
  • Placebo: 70 → 72 → 74
  • Drug improves over time, Placebo stays flat.

Formula:
$$F = \frac{MS_{\text{effect}}}{MS_{\text{error}}}$$


Case 7 — Chi-square Goodness-of-Fit

Scenario: A survey asks students to choose a favorite subject: Math, Science, or English.

Question: Is the distribution of responses different from equal chance?

Design/Test: Chi-square goodness-of-fit test.

Formula:
$$\chi^2 = \sum \frac{(O - E)^2}{E}$$

In words:
$$\chi^2 = \frac{\text{(Observed - Expected)}^2}{\text{Expected}}, , \text{summed across categories}$$


Case 8 — Chi-square Test of Independence

Scenario: A researcher tests whether gender (Male, Female) is related to sport preference (Soccer, Basketball, Tennis).

Question: Is there an association between gender and sport?

Design/Test: Chi-square test of independence.

Formula:
$$\chi^2 = \sum \frac{(O - E)^2}{E}$$


Case 9 — Mann–Whitney U Test

Scenario: Students in two different schools are ranked by teacher ratings.

Question: Do the two groups differ in median rank?

Design/Test: Mann–Whitney U test (non-parametric).

Formula:
$$U = n_1 n_2 + \frac{n_1 (n_1 + 1)}{2} - R_1$$

Where $$R_1$$ = sum of ranks for group 1.


Case 10 — Wilcoxon Signed-Rank Test

Scenario: The same students are ranked before and after training.

Question: Did the ranks change?

Design/Test: Wilcoxon signed-rank test (non-parametric).

Formula (summary):

  • Compute differences (After – Before).
  • Rank the absolute differences.
  • Assign signs and sum.
  • Test statistic = smaller of the two signed sums.

Practice self-test quiz

In the space below, please find practice problems and self-test quizzes. For full access, please signup free.

Identify the Design


Case 1

Scenario: A teacher compares test scores of students in two different classrooms (Class A vs. Class B).
Question: Are the two groups significantly different in mean score?
Answer: Independent-samples t-test.


Case 2

Scenario: A researcher tests the same group of students before and after tutoring.
Question: Did their scores improve after the program?
Answer: Paired-samples t-test (dependent t-test).


Case 3

Scenario: Three groups of students use different study methods: flashcards, highlighting, and practice tests.
Question: Do the study methods lead to different mean scores?
Answer: One-way ANOVA.


Case 4

Scenario: A psychologist measures anxiety scores in patients given three different drugs.
Question: Do the drugs produce different mean anxiety scores?
Answer: One-way ANOVA.


Case 5

Scenario: A study compares two groups of athletes: runners vs. swimmers, on reaction time.
Question: Are the two sports groups different in mean reaction time?
Answer: Independent-samples t-test.


Case 6

Scenario: Students are tested at three times: beginning, middle, and end of the semester.
Question: Did their scores change over time?
Answer: Repeated-measures ANOVA.


Case 7

Scenario: Two teaching methods (Lecture, Online) are tested across two times of day (Morning, Afternoon).
Question: What are the effects of method, time, and their interaction?
Answer: Two-way (factorial) ANOVA.


Case 8

Scenario: A company compares productivity of three work shifts (Day, Evening, Night) across two departments (Sales, Service).
Question: Are there main effects of shift and department, and is there an interaction?
Answer: Two-way (factorial) ANOVA.


Case 9

Scenario: Students are randomly assigned to a control or experimental group, and both groups are measured three times (Weeks 1, 2, 3).
Question: Is there an effect of group, time, and interaction?
Answer: Mixed (split-plot) ANOVA.


Case 10

Scenario: A survey asks students to choose their favorite subject: Math, Science, or English.
Question: Is the distribution of responses different from chance?
Answer: Chi-square goodness-of-fit test.


Case 11

Scenario: A researcher studies whether gender (Male, Female) is related to preference for sports (Soccer, Basketball, Tennis).
Question: Is there an association between gender and sport preference?
Answer: Chi-square test of independence.


Case 12

Scenario: Students are ranked by teacher ratings: 1st, 2nd, 3rd, etc. Two different teaching methods are compared on these ranks.
Question: Do the groups differ in median ranks?
Answer: Mann–Whitney U test (non-parametric).


Case 13

Scenario: The same students are ranked before and after a training program.
Question: Did the ranks change after training?
Answer: Wilcoxon signed-rank test (non-parametric).

Practice self-test quiz

In the space below, please find practice problems and self-test quizzes. For full access, please signup free.

Lecture 7 — Factorial Designs (Two-way ANOVA)

2x2 factorial layout
2x2 interaction
2x2 anova summary table

A factorial design includes two or more factors studied at once.
This allows us to test not only the effect of each factor separately, but also whether the factors interact.


Example: 2 × 2 Design

  • Factor A: Teaching method (Lecture, Online)
  • Factor B: Time of day (Morning, Afternoon)

This design has 4 groups (2 levels of A × 2 levels of B).

We can test:

  1. The main effect of Factor A (method).
  2. The main effect of Factor B (time).
  3. The interaction between method and time.

The ANOVA Partition

For a 2 × 2 design:

  • Main effect A: $$df_A = a - 1$$
  • Main effect B: $$df_B = b - 1$$
  • Interaction A × B: $$df_{A \times B} = (a - 1)(b - 1)$$
  • Error (within): $$df_{\text{within}} = N - ab$$

Where $$a$$ = levels of Factor A, $$b$$ = levels of Factor B, $$N$$ = total number of observations.


Interaction

An interaction occurs when the effect of one factor depends on the level of the other factor.

  • If lines in a plot are parallel, there is no interaction.
  • If lines cross or diverge, there is an interaction.

Example

Suppose means are:

  • Lecture: Morning = 70, Afternoon = 90
  • Online: Morning = 80, Afternoon = 80

Here:

  • Main effect of method: Online > Lecture overall
  • Main effect of time: Afternoon > Morning overall
  • Interaction: Lecture scores rise with time, Online scores stay flat → non-parallel lines.

Visuals

Figure L7.1 — Factorial Layout (2 × 2). A 2 × 2 grid: Method × Time.

Figure L7.2 — Interaction Plot. Lecture line slopes upward, Online line flat. Caption: “Lines not parallel = interaction.”

Figure L7.3 — ANOVA Summary Table for 2 × 2 design. Source | SS | df | MS | F | p.


Why This Matters

Factorial designs let us test more than one factor at a time.
They are efficient and powerful, and the concept of interaction is central in science.
Two-way ANOVA is the foundation for more complex designs, including repeated measures and mixed ANOVA.

Practice self-test quiz

In the space below, please find practice problems and self-test quizzes. For full access, please signup free.