Skip to main content

Two-Way Analysis of Variance (ANOVA)

Unit Overview

Course: MPC-006 Statistics in Psychology ยท Block 3 ยท Unit 4
Pages: 96โ€“112 ยท ๐Ÿ“„ Download PDF
Prerequisite: One-Way ANOVA | t-Test for Independent & Correlated Samples


From One Factor to Two: Why We Need Two-Way ANOVAโ€‹

One-way ANOVA answers: "Do groups differ on this outcome variable?" โ€” but it can only examine one independent variable (IV) at a time. Real-world behaviour is shaped by multiple factors acting simultaneously, and often the combination of factors produces an effect that neither factor alone could predict.

Consider a pharmaceutical company testing a new drug to reduce smoking:

  1. What is the independent effect of Drug A on smoking?
  2. What is the independent effect of Drug B on smoking?
  3. What is the joint (interaction) effect of Drug A ร— Drug B together?

No single one-way ANOVA can answer all three questions. We need Two-Way ANOVA โ€” a technique that simultaneously tests:

  • The main effect of Factor A (e.g., Type of Personality)
  • The main effect of Factor B (e.g., Level of Anxiety)
  • The interaction effect A ร— B (the combined influence of both factors)

This is the essence of factorial experimental designs โ€” studying how variables interact, not just act in isolation.

Historical Note

Two-way (and multi-way) ANOVA grew from Fisher's foundational agricultural research in the 1920s, where he needed to simultaneously test the effect of multiple soil treatments and crop varieties. The extension to psychology was pioneered by researchers at American universities in the 1940sโ€“50s. Wikipedia: Factorial experiment


The Structure of Two-Way ANOVAโ€‹

Factorial Design Notationโ€‹

Two-way ANOVA uses a factorial design notation: a ร— b, where:

  • a = number of levels of Factor A
  • b = number of levels of Factor B
  • Total cells = a ร— b
DesignFactorsCellsExample
2 ร— 22 IVs, 2 levels each4Gender ร— Anxiety (each High/Low)
3 ร— 2IVโ‚ has 3 levels, IVโ‚‚ has 26SES (High/Average/Low) ร— Gender
4 ร— 3IVโ‚ has 4 levels, IVโ‚‚ has 3124 teaching methods ร— 3 intelligence levels

Three Effects Tested Simultaneouslyโ€‹


The Two-Way ANOVA Summary Tableโ€‹

Source of VariancedfSSMSSF Ratio
Among All Groups(kโˆ’1)SS_Aโ€”โ€”
Between Groups: Factor A(k_a โˆ’ 1)SS_BFactorAMSS_AFโ‚ = MSS_A / MSS_W
Between Groups: Factor B(k_b โˆ’ 1)SS_BFactorBMSS_BFโ‚‚ = MSS_B / MSS_W
Interaction A ร— B(k_aโˆ’1)(k_bโˆ’1)SS_AxBMSS_AxBFโ‚ƒ = MSS_AxB / MSS_W
Within Groups (Error)(N โˆ’ k)SS_WMSS_Wโ€”
TotalN โˆ’ 1SS_Tโ€”โ€”

The within-groups (error) variance is the denominator for all three F-ratios โ€” it represents the variability that cannot be attributed to any experimental factor.


Variance Partitioning in Two-Way ANOVAโ€‹

The total variance is carved into more components than in one-way ANOVA:

SSTotal=SSBetweenโ€‰Groups+SSWithinโ€‰GroupsSS_{Total} = SS_{Between\,Groups} + SS_{Within\,Groups}

SSBetweenโ€‰Groups=SSFactorโ€‰A+SSFactorโ€‰B+SSAร—BSS_{Between\,Groups} = SS_{Factor\,A} + SS_{Factor\,B} + SS_{A \times B}

Therefore:

SST=SSA+SSB+SSAร—B+SSWSS_T = SS_A + SS_B + SS_{A \times B} + SS_W

This elegant partition means that two-way ANOVA accounts for more sources of variance than one-way ANOVA, leaving a smaller (and more accurate) error term. This increases statistical power โ€” the ability to detect true effects.


Step-by-Step Computationโ€‹

Notation for a 2 ร— 2 Designโ€‹

SymbolMeaning
kkTotal number of cells/groups
kak_aLevels of Factor A
kbk_bLevels of Factor B
nnCases per cell
NNTotal cases = kร—nk \times n
โˆ‘X1,โˆ‘X2...\sum X_1, \sum X_2 ...Cell sums
CxCxCorrection term

The Computation Stepsโ€‹

Step 1: Correction Term Cx=(โˆ‘X)2NCx = \frac{(\sum X)^2}{N}

Step 2: Total Sum of Squares SST=โˆ‘X2โˆ’CxSS_T = \sum X^2 - Cx

Step 3: Sum of Squares Among All Groups (treats all kk cells as separate groups) SSAmong=(โˆ‘X1)2n+(โˆ‘X2)2n+โ‹ฏ+(โˆ‘Xk)2nโˆ’CxSS_{Among} = \frac{(\sum X_1)^2}{n} + \frac{(\sum X_2)^2}{n} + \cdots + \frac{(\sum X_k)^2}{n} - Cx

Step 4: SS for Factor A (combine cells that share the same level of A) SSA=(โˆ‘XA1)2nA1+(โˆ‘XA2)2nA2+โ‹ฏโˆ’CxSS_A = \frac{(\sum X_{A_1})^2}{n_{A_1}} + \frac{(\sum X_{A_2})^2}{n_{A_2}} + \cdots - Cx

Step 5: SS for Factor B (combine cells that share the same level of B) SSB=(โˆ‘XB1)2nB1+(โˆ‘XB2)2nB2+โ‹ฏโˆ’CxSS_B = \frac{(\sum X_{B_1})^2}{n_{B_1}} + \frac{(\sum X_{B_2})^2}{n_{B_2}} + \cdots - Cx

Step 6: Interaction SS SSAร—B=SSAmongโˆ’SSAโˆ’SSBSS_{A \times B} = SS_{Among} - SS_A - SS_B

Step 7: Within-Groups SS (Error) SSW=SSTโˆ’SSAmongSS_W = SS_T - SS_{Among}

Step 8: Degrees of Freedom

  • dfA=kaโˆ’1df_A = k_a - 1
  • dfB=kbโˆ’1df_B = k_b - 1
  • dfAร—B=(kaโˆ’1)(kbโˆ’1)df_{A \times B} = (k_a - 1)(k_b - 1)
  • dfW=Nโˆ’kdf_W = N - k
  • dfT=Nโˆ’1df_T = N - 1

Step 9: Mean Squares MSSA=SSAdfA,MSSB=SSBdfB,MSSAร—B=SSAร—BdfAร—B,MSSW=SSWdfWMSS_A = \frac{SS_A}{df_A}, \quad MSS_B = \frac{SS_B}{df_B}, \quad MSS_{A \times B} = \frac{SS_{A \times B}}{df_{A \times B}}, \quad MSS_W = \frac{SS_W}{df_W}

Step 10: F-Ratios FA=MSSAMSSW,FB=MSSBMSSW,FAร—B=MSSAร—BMSSWF_A = \frac{MSS_A}{MSS_W}, \quad F_B = \frac{MSS_B}{MSS_W}, \quad F_{A \times B} = \frac{MSS_{A \times B}}{MSS_W}


Worked Example 1: Anxiety ร— Personality Type on Academic Achievementโ€‹

Source: PDF p. 99โ€“102

A researcher studied 20 undergraduates in a 2 ร— 2 design (Type of Personality ร— Level of Anxiety). Academic achievement scores:

High AnxietyLow Anxiety
Extroverts12, 13, 14, 15, 1414, 14, 13, 15, 15
Introverts14, 16, 16, 16, 1511, 10, 12, 12, 16

Cell Statistics:

CellฮฃM
Extroverts ร— High Anxiety (Xโ‚)6813.60
Extroverts ร— Low Anxiety (Xโ‚‚)7114.20
Introverts ร— High Anxiety (Xโ‚ƒ)7715.40
Introverts ร— Low Anxiety (Xโ‚„)6112.20

k=4k = 4, n=5n = 5, N=20N = 20

Step 1: Cx=(68+71+77+61)220=277220=7672920=3836.45Cx = \frac{(68+71+77+61)^2}{20} = \frac{277^2}{20} = \frac{76729}{20} = 3836.45

Step 2: โˆ‘X2=930+1011+1189+765=3895\sum X^2 = 930 + 1011 + 1189 + 765 = 3895
SST=3895โˆ’3836.45=58.55SS_T = 3895 - 3836.45 = 58.55

Step 3: SSAmong=682+712+772+6125โˆ’3836.45=4624+5041+5929+37215โˆ’3836.45=3863.00โˆ’3836.45=26.55SS_{Among} = \frac{68^2+71^2+77^2+61^2}{5} - 3836.45 = \frac{4624+5041+5929+3721}{5} - 3836.45 = 3863.00 - 3836.45 = 26.55

Step 4 (Personality Type โ€” rows):
Extroverts total = 68 + 71 = 139 (n = 10); Introverts total = 77 + 61 = 138 (n = 10)
SSPersonality=139210+138210โˆ’3836.45=1932.10+1904.40โˆ’3836.45=0.05SS_{Personality} = \frac{139^2}{10} + \frac{138^2}{10} - 3836.45 = 1932.10 + 1904.40 - 3836.45 = 0.05

Step 5 (Anxiety Level โ€” columns):
High Anxiety total = 68 + 77 = 145 (n = 10); Low Anxiety total = 71 + 61 = 132 (n = 10)
SSAnxiety=145210+132210โˆ’3836.45=2102.50+1742.40โˆ’3836.45=8.45SS_{Anxiety} = \frac{145^2}{10} + \frac{132^2}{10} - 3836.45 = 2102.50 + 1742.40 - 3836.45 = 8.45

Step 6: SSAร—B=26.55โˆ’0.05โˆ’8.45=18.05SS_{A \times B} = 26.55 - 0.05 - 8.45 = 18.05

Step 7: SSW=58.55โˆ’26.55=32.00SS_W = 58.55 - 26.55 = 32.00

Summary Table:

SourcedfSSMSSF
Among Groups326.55โ€”โ€”
Personality Type (A)10.050.050.025
Anxiety Level (B)18.458.454.225
A ร— B Interaction118.0518.059.025
Within Groups (Error)1632.002.00โ€”
Total1958.55โ€”โ€”

Critical F values (dfโ‚ = 1, dfโ‚‚ = 16): Fโ‚€โ‚… = 4.49, Fโ‚€โ‚ = 8.53

Decisions:

  • Personality Type: F = 0.025 < 4.49 โ†’ Not significant โ€” personality type alone does not affect academic achievement
  • Anxiety Level: F = 4.225 < 4.49 โ†’ Not significant โ€” anxiety level alone does not affect academic achievement
  • Interaction A ร— B: F = 9.025 > 8.53 โ†’ Significant at .01 level โœ… โ€” the combination of personality type and anxiety level matters!

Interpretation: Although neither personality type nor anxiety individually predicts achievement, their joint effect does. Specifically: Introverts with high anxiety perform best (M = 15.40), while Introverts with low anxiety perform worst (M = 12.20). Extroverts show a more moderate, reversed pattern. This cross-over interaction is the hallmark of a significant A ร— B effect.


Worked Example 2: Sex ร— Intelligence on Mathematical Creativityโ€‹

Source: PDF p. 103โ€“106

40 high school students in a 2 ร— 2 design: Sex (Boys/Girls) ร— Intelligence (High/Low). Dependent variable: mathematical creativity test scores.

Cell Summary:

CellnฮฃM
Boys ร— High Intelligence1015315.30
Boys ร— Low Intelligence1013713.70
Girls ร— High Intelligence1013913.90
Girls ร— Low Intelligence1011111.10

Key Computations:

Cx=(153+137+139+111)240=540240=7290Cx = \frac{(153+137+139+111)^2}{40} = \frac{540^2}{40} = 7290

SST=(2381+1889+1939+1247)โˆ’7290=166SS_T = (2381+1889+1939+1247) - 7290 = 166

SSAmong=1532+1372+1392+111210โˆ’7290=92SS_{Among} = \frac{153^2+137^2+139^2+111^2}{10} - 7290 = 92

SSSex=(153+137)220+(139+111)220โˆ’7290=2902+250220โˆ’7290=40.00SS_{Sex} = \frac{(153+137)^2}{20} + \frac{(139+111)^2}{20} - 7290 = \frac{290^2+250^2}{20} - 7290 = 40.00

SSIntelligence=(153+139)220+(137+111)220โˆ’7290=2922+248220โˆ’7290=48.40SS_{Intelligence} = \frac{(153+139)^2}{20} + \frac{(137+111)^2}{20} - 7290 = \frac{292^2+248^2}{20} - 7290 = 48.40

SSAร—B=92โˆ’40โˆ’48.40=3.60SS_{A \times B} = 92 - 40 - 48.40 = 3.60

SSW=166โˆ’92=74.00;MSSW=7436=2.056SS_W = 166 - 92 = 74.00; \quad MSS_W = \frac{74}{36} = 2.056

Summary Table:

SourcedfSSMSSF
Sex (A)140.0040.0019.46 โœ…
Intelligence (B)148.4048.4023.54 โœ…
Sex ร— Intelligence (Aร—B)13.603.601.75 โŒ
Within Groups (Error)3674.002.056โ€”
Total39166.00โ€”โ€”

Critical F (dfโ‚ = 1, dfโ‚‚ = 36): Fโ‚€โ‚… = 4.12, Fโ‚€โ‚ = 7.42

Decisions:

  • Sex: F = 19.46 > 7.42 โ†’ Significant at .01 โ€” Boys score higher in mathematical creativity (M = 14.50 vs 12.50)
  • Intelligence: F = 23.54 > 7.42 โ†’ Significant at .01 โ€” High-intelligence students score higher (M = 14.60 vs 12.40)
  • Sex ร— Intelligence: F = 1.75 < 4.12 โ†’ Not significant โ€” the advantage of high intelligence is roughly equal for both boys and girls

Understanding Interaction Effectsโ€‹

The interaction effect is the most conceptually rich aspect of two-way ANOVA. It answers: "Does the effect of Factor A depend on the level of Factor B?"

Visualising Interaction: Parallel vs Crossing Linesโ€‹

Rule of thumb for interaction graphs:

  • Parallel lines โ†’ No interaction (the effect of A is the same at every level of B)
  • Non-parallel / crossing lines โ†’ Possible or significant interaction

Practical Examples of Interactionโ€‹

DomainFactor AFactor BPossible Interaction
ClinicalDrug dosagePatient age groupDrug effective for adults but not children
EducationTeaching methodIntelligence levelDiscussion works for bright students; drilling works for others
OrganisationalWork scheduleJob typeFlexible hours boosts satisfaction for creative jobs but not routine ones
DevelopmentalParenting styleChild temperamentAuthoritative parenting helps anxious children more than easy-going ones

The fertiliser analogy from the PDF is instructive: Urea and Phosphate each have independent effects on crop growth, but their combined application in the right ratio produces results neither achieves alone โ€” the joint effect (interaction) is not predictable from individual effects.

Wikipedia: Interaction (statistics)


Decision Rules for Two-Way ANOVA Resultsโ€‹

Three possible outcomes and what to do:

All three obtained F values (F_A, F_B, F_AxB) are below the critical value.

Conclusion: Neither variable alone nor in combination has a significant effect on the dependent variable. Retain all null hypotheses. No post-hoc tests needed. Report results and stop.

Example: In Example 2, if the interaction F (1.75) had also been non-significant, you would conclude that neither sex, intelligence, nor their combination affects mathematical creativity.


One-Way vs Two-Way ANOVA: A Comparisonโ€‹

FeatureOne-Way ANOVATwo-Way ANOVA
Independent variables12
Effects tested1 (main effect)3 (2 main + 1 interaction)
Design typeSimple random designFactorial design
Interaction analysisNot possibleCore feature
F-ratios computed13
EfficiencyTests one IV at a timeTests two IVs simultaneously
Statistical powerLower (error includes B variance)Higher (partitions more variance)
ComplexityModerateHigh

Key insight: Two-way ANOVA is more efficient than running two separate one-way ANOVAs because: (a) it controls for the second factor when testing the first, and (b) it reveals interaction effects that separate analyses cannot detect.


Assumptions of Two-Way ANOVAโ€‹

Two-way ANOVA inherits all the assumptions of one-way ANOVA:

  1. Normality: The dependent variable is normally distributed within each cell
  2. Homogeneity of variance: All cells have equal population variance (Levene's test)
  3. Independence: Observations are independent within and across cells
  4. Equal cell sizes (balanced design): Makes computation simpler and the test more robust

Additional consideration for two-way designs: With very small cell sizes (n < 5), the test is especially sensitive to violations. Balanced designs (equal n per cell) are strongly preferred.

Wikipedia: Analysis of variance โ€” Assumptions


Merits and Limitationsโ€‹

  • Tests two main effects and one interaction in a single analysis โ€” three hypotheses for the price of one
  • Reveals interaction effects that would be completely invisible to separate one-way ANOVAs
  • Higher statistical power than one-way ANOVA โ€” partitioning the B variance out of error reduces the error term
  • Ideal for factorial designs (2ร—2, 3ร—2, 4ร—3 etc.) which closely mimic real-world multi-causal phenomena
  • Produces a richer interpretation: not just "does A matter?" but "does A matter more at some levels of B?"
  • Foundation for more complex designs: three-way ANOVA, MANCOVA, mixed-model ANOVA all build on this

Indian Research Contextโ€‹

Two-way ANOVA is the backbone of much factorial research in Indian educational and social psychology:

Educational Psychology: Studies examining the joint effects of gender ร— school type (government vs private) on academic performance are ubiquitous in Indian M.Ed. dissertations. Frequently, the interaction reveals that gender gaps are larger in private schools than government ones โ€” a finding invisible to separate one-way analyses.

Clinical Psychology: Indian clinical researchers have used 2ร—2 designs to study how diagnosis ร— socioeconomic status jointly affect treatment adherence โ€” finding significant interactions at NIMHANS, PGI Chandigarh, and affiliated centres.

Developmental Psychology: Research on parenting style ร— child birth order as predictors of adolescent self-concept is a recurring theme in Indian family psychology, reflecting the culturally distinct role of joint families and sibling hierarchies in India.

Occupational Psychology: Studies on job sector (public vs private) ร— gender as determinants of work-life balance report consistent interaction effects, with gender differentials far more pronounced in the private sector โ€” a pattern with significant policy implications.


Real-World Applicationsโ€‹

  • Pharmacology RCTs: Testing drug efficacy across gender ร— dosage cells โ€” the interaction reveals if a drug works differently for men vs women
  • Educational interventions: Instruction method ร— learning style combinations to personalise teaching
  • Neuropsychology: Memory training ร— age group interactions in cognitive rehabilitation
  • Consumer psychology: Ad format ร— product category interactions in purchase decision research
  • Health psychology: Exercise type ร— dietary regimen combinations in weight loss interventions

Memory Aidsโ€‹

๐Ÿง  The "Main + Interaction" Triangleโ€‹

         Two-Way ANOVA
/ \
Main Effect A Main Effect B
\ /
Interaction
(A ร— B)

Two-Way ANOVA always gives you THREE effects. Never forget the third โ€” the interaction.

๐ŸŽต Parallel Lines Ruleโ€‹

Parallel lines = No interaction (the gap stays the same)
Crossing lines = Interaction present (the relationship reverses)
"Lines that cross mean factors interact; lines that don't means they act apart."

๐Ÿ”ข df Quick Reference for 2ร—2 Designsโ€‹

Effectdf
Factor A (2 levels)2โˆ’1=12-1=1
Factor B (2 levels)2โˆ’1=12-1=1
A ร— B interaction1ร—1=11 \times 1=1
Within groups (N=20)20โˆ’4=1620-4=16
Total (N=20)1919

โšก Interaction vs Main Effect Quick Ruleโ€‹

If main effects are not significant but interaction is significant โ†’ The factors only matter together, not alone (Example 1: Personality ร— Anxiety)
If main effects are significant but interaction is not โ†’ The factors work additively, not jointly (Example 2: Sex + Intelligence)


External Resourcesโ€‹

๐Ÿ“– Essential Readingโ€‹

๐ŸŽ“ Video Lecturesโ€‹

๐Ÿ“š Research Papers (2020โ€“2025)โ€‹

  • Lakens, D. (2022). Sample size justification. Collabra: Psychology, 8(1). [doi:10.1525/collabra.33267] โ€” covers power for factorial designs
  • Maxwell, S.E., Delaney, H.D., & Kelley, K. (2018). Designing Experiments and Analyzing Data: A Model Comparison Perspective (3rd ed.). Routledge. โ€” standard advanced reference for factorial ANOVA
  • Shieh, G. (2020). Power analysis for two-way balanced ANOVA. Journal of Statistical Computation and Simulation, 90(7). โ€” for planning two-way designs

๐Ÿ›  Online Toolsโ€‹


Self-Assessment Questionsโ€‹

๐ŸŸข Knowledge (Recall)โ€‹

  1. Define two-way ANOVA and explain how it differs from one-way ANOVA. What additional information does it provide?

  2. Name the three effects tested in a two-way ANOVA. Define each one clearly.

  3. State the formula for the interaction sum of squares (SSAร—BSS_{A \times B}) in terms of other SS components. Why is the interaction variance calculated this way?

๐ŸŸก Comprehension (Understanding)โ€‹

  1. Explain the interaction effect using a concrete example from psychology. What does it mean when two lines on an interaction graph are parallel versus when they cross?

  2. In Example 1 (Anxiety ร— Personality), the main effects of both factors were non-significant, yet the interaction was highly significant at .01 level. How is this possible? What does this tell us about the relationship between personality type, anxiety, and academic achievement?

  3. Compare Example 1 and Example 2 in terms of their interaction findings. In which example do the two factors act additively? In which do they interact? How do the graphs for each differ?

๐Ÿ”ด Application (Problem-Solving)โ€‹

  1. Solve this problem: A researcher studies the effect of teaching method (Traditional vs Activity-based) and class size (Small: โ‰ค20 vs Large: >40) on student satisfaction scores. Data from a 2ร—2 design with n = 6 per cell:
TraditionalActivity-Based
Small Class14, 13, 15, 12, 14, 1317, 18, 16, 19, 17, 18
Large Class10, 11, 9, 12, 10, 1012, 13, 11, 14, 12, 12

Apply two-way ANOVA. Calculate CxCx, SSTSS_T, SSAmongSS_{Among}, SSMethodSS_{Method}, SSClassSizeSS_{ClassSize}, SSMร—CSS_{M \times C}, and SSWSS_W. Complete the summary table and determine significance for each effect.


Summaryโ€‹

ConceptKey Point
Two-way ANOVATests 2 main effects + 1 interaction simultaneously
Factorial designa ร— b notation (levels of A ร— levels of B)
Main effectEffect of one IV while controlling for the other
Interaction effectEffect of A depends on the level of B (and vice versa)
SSAร—BSS_{A \times B}SSAmongโˆ’SSAโˆ’SSBSS_{Among} - SS_A - SS_B
Parallel lines (graph)No interaction โ€” effects are additive
Crossing lines (graph)Significant interaction โ€” effects are multiplicative/conditional
All F non-significantRetain all Hโ‚€; no further testing
Some F significantPartial rejection; post-hoc t-tests for factors with 3+ levels
Advantage over 1-wayDetects interaction; higher power; tests two IVs in one analysis
AssumptionNormality, homogeneity of variance, independence, balanced cells

Source PDFs: