Three-way ANOVA — unbalanced (unequal cell sizes)
MinutePlot® and R on the same data. MinutePlot version 1.0.0; R 4.5.2.
Dataset
- npk with rows removed — npk (R: datasets::npk) with four rows removed by a fixed rule -- rows 1, 6, 15 and 24 of the hosted npk.csv, one from each of four different cells -- leaving 20 observations: four cells of 2 and four of 3.
- Data format for MinutePlot: npk_unbalanced_minuteplot.csv — arranged exactly as the app’s data template for this test expects (paste it into the app).
- Data format for R: npk_unbalanced_r.csv — the long-format file the R script reads (keep it in the script’s folder).
Setup
In MinutePlot:
- Workbench → Three-way ANOVA → paste npk_unbalanced_minuteplot.csv (same layout; the removed replicates are empty cells).
- Post-hoc test: Tukey HSD (the default) · significance level α = 0.05 (the default) → Confirm and Analyze.
- Read the ANOVA table and the cell means with letters from the results; the page compares the all-cells letter set.
In R:
- Install once:
install.packages(c("car", "emmeans", "multcomp", "multcompView")); then runnpk_unbalanced.Rtop to bottom (source it, or paste it into the console) with the R data file in the same folder. - R 4.5.2 and the package versions in the page header; each script prints the versions it runs under.
The analysis:
- Three-way ANOVA of yield by N, P and K with all interactions, α = 0.05. Cell counts: N0·P0·K0, N0·P0·K1, N0·P1·K1 and N1·P1·K1 have 2 observations, the other four cells 3.
- Sums of squares: MinutePlot computes Type II sums of squares for factorial ANOVA (each effect is the reduction in residual sum of squares when it is added to the model containing every term that does not contain it; order-independent, and identical to Type I and III on balanced data). R reference: car::Anova(fit, type = 2).
- Blocks are omitted to match MinutePlot’s fully crossed design; this entry is a software comparison, not a recommended analysis of npk.
- Pairwise comparisons of the eight cell means: Tukey HSD on the unbalanced cells; compact letters from the significant pairs (R: emmeans + multcomp::cld).
Side-by-side results
ANOVA summary (Type II; main effects and interactions)
MinutePlot®
| Term | df | F | p |
|---|---|---|---|
| N | 1, 12 | 3.6697 | 0.0795 |
| P | 1, 12 | 0.6129 | 0.4489 |
| K | 1, 12 | 2.2202 | 0.1620 |
| N × P | 1, 12 | 1.0684 | 0.3217 |
| N × K | 1, 12 | 2.9814 | 0.1099 |
| P × K | 1, 12 | 0.2151 | 0.6511 |
| N × P × K | 1, 12 | 1.6200 | 0.2272 |
R
| Term | df | F | p |
|---|---|---|---|
| N | 1, 12 | 3.6697 | 0.0795 |
| P | 1, 12 | 0.6129 | 0.4489 |
| K | 1, 12 | 2.2202 | 0.1620 |
| N × P | 1, 12 | 1.0684 | 0.3217 |
| N × K | 1, 12 | 2.9814 | 0.1099 |
| P × K | 1, 12 | 0.2151 | 0.6511 |
| N × P × K | 1, 12 | 1.6200 | 0.2272 |
R values: verified in R 4.5.2 (see the verdict).
Cell means with significance letters
MinutePlot®
| N | P | K | n | Mean | Letters |
|---|---|---|---|---|---|
| N1 | P1 | K0 | 3 | 57.933 | a |
| N1 | P1 | K1 | 2 | 52.300 | a |
| N1 | P0 | K0 | 3 | 63.767 | a |
| N1 | P0 | K1 | 3 | 54.667 | a |
| N0 | P1 | K0 | 3 | 54.333 | a |
| N0 | P1 | K1 | 2 | 51.000 | a |
| N0 | P0 | K0 | 2 | 49.150 | a |
| N0 | P0 | K1 | 2 | 55.250 | a |
R
| N | P | K | n | Mean | Letters |
|---|---|---|---|---|---|
| N1 | P1 | K0 | 3 | 57.933 | a |
| N1 | P1 | K1 | 2 | 52.300 | a |
| N1 | P0 | K0 | 3 | 63.767 | a |
| N1 | P0 | K1 | 3 | 54.667 | a |
| N0 | P1 | K0 | 3 | 54.333 | a |
| N0 | P1 | K1 | 2 | 51.000 | a |
| N0 | P0 | K0 | 2 | 49.150 | a |
| N0 | P0 | K1 | 2 | 55.250 | a |
R values: verified in R 4.5.2 (see the verdict).
In the app each cell carries a compound label such as Aa (Aa1 with three factors): uppercase compares the first factor within each level of the second, lowercase the reverse (the digit the third factor). The plain letters shown here are MinutePlot’s single letter set over all cells, the direct counterpart of R’s cld(). MinutePlot assigns “a” to the highest mean, R to the lowest — a display convention, not a discrepancy; the grouping (which cells share a letter) is what is compared.
Verdict
R script
npk_unbalanced.R — each script loads its data, prints its versions and the R-side tables shown above, in page order; no plotting.