Z Test Calculator

Two-way ANOVA calculator

=—
—
—
Two way ANOVA calculator visualizationInteraction plot of cell means with standard-error bars, a sum-of-squares split, and F versus critical F for both factors and the interaction

    The working, step by step

      In plain words

      Assumption check

        What Is a Two-Way ANOVA?

        A two-way analysis of variance (ANOVA) is a hypothesis test that checks the effects of 2 factors on one outcome, plus the interaction between the factors.

        A two-way ANOVA runs 3 tests at once: one for factor A, one for factor B and one for the A × B interaction. A greenhouse study of fertiliser (low, high) and watering schedule (daily, twice weekly, weekly) is a 2 × 3 factorial design. Ronald A. Fisher and Frank Yates developed factorial designs at the Rothamsted Experimental Station in the 1920s and 1930s. The two-way ANOVA calculator is part of the Z Test Calculator suite.

        Main Effects and Interaction Effects

        A two-way ANOVA separates 3 kinds of effects:

        • Main effect of A: the difference between factor A's level means, averaged over factor B.
        • Main effect of B: the difference between factor B's level means, averaged over factor A.
        • Interaction (A × B): the effect of one factor changes with the level of the other factor.

        A significant interaction means the main effects do not tell the whole story. In the example below, high fertiliser adds 10 cm of growth with twice-weekly watering and only 4 cm more with weekly watering.

        Two-Way ANOVA With vs. Without Replication

        A two-way ANOVA with replication has 2 or more observations per cell, and a two-way ANOVA without replication has exactly 1. Only the design with replication can test the interaction, since the error term comes from the variation inside cells. This calculator runs the balanced design with replication: the same number of values (at least 2) in every cell.

        Two-Way ANOVA Formulas (SS, df, MS, F)

        For a balanced design with a levels of A, b levels of B and n observations per cell:

        SourceSum of squaresdf
        Factor ASSA = bn Σ(x̄ᵢ − x̄)²a − 1
        Factor BSSB = an Σ(x̄ⱼ − x̄)²b − 1
        A × BSSAB = n ΣΣ(x̄ᵢⱼ − x̄ᵢ − x̄ⱼ + x̄)²(a − 1)(b − 1)
        ErrorSSE = ΣΣΣ(x − x̄ᵢⱼ)²ab(n − 1)
        F_effect = (SS_effect / df_effect) / (SS_E / df_E)

        Assumptions of Two-Way ANOVA

        A two-way ANOVA needs 4 assumptions:

        1. Independent observations in every cell.
        2. Approximate normality of the values within each cell.
        3. Equal variances across all cells; the largest cell SD should be less than about twice the smallest.
        4. A balanced design for this calculator: equal cell sizes and every combination of levels present.

        How to Use the Two-Way ANOVA Calculator

        To use the two-way ANOVA calculator, follow 3 steps:

        1. Name the two factors on one line, such as Fertiliser, Watering.
        2. Enter one cell per line as A level, B level: values, such as High, Daily: 26 28 27 25.
        3. Set α.

        The interaction plot draws one line per level of factor A across the levels of factor B, with ±1 standard-error bars. The bar shows how the total variation splits into A, B, A × B and error, and three F bars compare each F statistic with its critical value.

        How to Read the Two-Way ANOVA Table

        A two-way ANOVA table has one row per effect:

        SourceSSdfMSFp
        Fertiliser266.671266.67160.00< 0.001
        Watering336.002168.00100.80< 0.001
        Fertiliser × Watering37.33218.6711.200.0007
        Error30.00181.67
        Total670.0023

        Read the interaction row first. A significant interaction changes how the main-effect rows are read.

        Reading an Interaction Plot

        To read an interaction plot, check 3 patterns:

        1. Parallel lines: no interaction; each factor has the same effect at every level of the other.
        2. Lines that spread apart: an ordinal interaction; the effect of A grows at some levels of B.
        3. Lines that cross: a disordinal interaction; the direction of A's effect flips across levels of B.

        Two-Way ANOVA Example: Fertiliser × Watering Schedule

        24 plants: 2 fertiliser levels × 3 watering schedules, 4 plants per cell. Growth in cm: Low/Daily 20 22 19 21, Low/Twice weekly 24 26 25 23, Low/Weekly 18 19 17 20, High/Daily 26 28 27 25, High/Twice weekly 35 33 36 34, High/Weekly 22 24 23 21.

        1. Cell means
          Low 20.5, 24.5, 18.5; High 26.5, 34.5, 22.5
        2. Fertiliser
          F(1, 18) = 160.00, p < 0.001, partial η² = 0.899
        3. Watering
          F(2, 18) = 100.80, p < 0.001, partial η² = 0.918
        4. Interaction
          F(2, 18) = 11.20, p = 0.0007, partial η² = 0.554
        5. Decision
          All 3 effects are significant. High fertiliser adds 6 cm with daily watering, 10 cm with twice-weekly watering and 4 cm with weekly watering, so the fertiliser effect depends on the schedule.

        Two-Way vs. One-Way ANOVA

        Use a one-way ANOVA for 1 grouping factor, and a two-way ANOVA when 2 factors define the groups. A two-way design tests both factors with the same data and reveals interactions that separate one-way analyses miss. Analyse a single factor with the one-way ANOVA calculator.

        FAQs

        What should I do when the interaction is significant?

        When the interaction is significant, analyse simple effects: the effect of one factor at each level of the other. Compare cell means directly, for example fertiliser at each watering schedule. Main effects alone can mislead when lines cross.

        Can the factors have different numbers of levels?

        Yes, the factors can have different numbers of levels. A 2 × 3 or 3 × 4 design works the same way. Each factor needs at least 2 levels, and the number of cells is a × b.

        What if the cell sizes are unequal?

        Unequal cell sizes need Type III sums of squares, which this calculator does not compute. Use R (car::Anova(type = 3)), SPSS GLM or Python statsmodels for unbalanced designs. Balanced designs give the same answer under every SS type.

        Is a two-way ANOVA the same as a 2×2 factorial ANOVA?

        Yes, a 2×2 factorial ANOVA is a two-way ANOVA with 2 levels of each factor. "Two-way" counts the factors, and "2×2" counts the levels of each factor. A 2×3 design is a two-way ANOVA too. Find the critical F for each effect with the critical value calculator.

        How do I report a two-way ANOVA in APA format?

        Report each effect as F(df_effect, df_error) = value, p = value, partial η² = value. Example: "There was a significant Fertiliser × Watering interaction, F(2, 18) = 11.20, p < .001, partial η² = .55." Compute other effect sizes with the effect size calculator.