Understand the idea
Picture a table of average yields: one row per variety, one column per test site. Some of that table is just 'this variety is generally good' and 'this site is generally productive': effects that add the same amount everywhere. AMMI pulls that additive part out first, with an ordinary two-way ANOVA.
What is left over is the interesting part: does the RANKING of varieties change from site to site? That leftover interaction table gets squeezed down (mathematically, the same trick used in PCA) into one or two interaction scores per variety and per site. A variety with a score near zero behaves the same everywhere: it is stable. A variety with a large score is a specialist: it does especially well (or badly) at the sites that share its sign.
The payoff is a picture, not just a p-value: a biplot with average yield on one axis and the interaction score on the other. The ideal variety sits high on yield and near zero on the interaction axis: good everywhere, not just somewhere.
AMMI is a standard GxE analysis for multi-environment trial analysis: it shows which genotypes perform consistently across environments, which is why it is also used for stability analysis.
Practitioner explanation
KernelStats fits the additive part as an ordinary two-way ANOVA on the genotype x environment cell means (main effects for genotype and environment, with an F-test on each), then forms the double-centered interaction residual matrix M_ij = ybar_ij - ybar_i. - ybar_.j + ybar_.., and takes its singular value decomposition via numpy's SVD. IPCA1 and IPCA2 scores are the left/right singular vectors scaled by sqrt(singular value); the variance percentage each axis explains is its squared singular value over the sum of all squared singular values. There are at most min(g-1, e-1) non-zero interaction axes.
The engine requires a COMPLETE genotype x environment table, every genotype tested at every environment, and raises a 400 naming the missing cells rather than silently dropping or imputing them, because AMMI's SVD is not defined on a table with holes. A replicate/block column, if supplied, is used only to label reps in the display; it does not change the ANOVA structure computed here (there is no separate block or genotype-in-block error term).
Stability ranking on the card orders genotypes by |IPCA1| (smallest = most stable) rather than by yield, which is a deliberate, product-specific choice: 'most stable' and 'highest yielding' are two different rankings, and the card reports both so neither is mistaken for the other.
When to use it
Consider it when
The same set of genotypes (varieties, hybrids, breeding lines) was evaluated across several environments (locations, years, or site-years), every genotype-environment combination has data, and the question is which genotypes are stable across environments versus specifically adapted to particular ones.
Use caution when
A single environment (there is no genotype x environment interaction to decompose; use ordinary one-way ANOVA), an incomplete table with genotypes missing from some environments, or when the interaction explains very little of the total variance (in which case the plain two-way ANOVA main effects already tell the whole story and the biplot adds noise, not insight).
Formulas and symbols
AMMI model
mu the grand mean, g_i/e_j the genotype/environment main effects (additive, from the two-way ANOVA), the sum a K-term SVD of the interaction residual.
Interaction principal component axis variance share
sigma_k the k-th singular value of the double-centered genotype x environment interaction matrix.
Genotype and environment main-effect F-test
Ordinary two-way ANOVA mean squares; tests whether genotype (or environment) main effects differ from zero, before the interaction is examined.
Assumptions and checks
- Without at least two replicates in every genotype x environment cell there is no independent error term to test main effects or the AMMI interaction (IPCA) axes against, so no significance statement is possible for any effect; missing cells (an unbalanced trial) further bias the estimated main effects and interaction.
In KernelStats: Checked directly: the card reports whether the genotype x environment table is complete, and with a single replicate per cell it reports a failed 'Replication' assumption and states that main effects can only be compared against the GxE mean square, with no F-test available for the IPCA axes.
- Normality (of residuals, not of the raw data). Non-normal within-cell residuals make the ANOVA F-tests on genotype, environment, and their interaction approximate rather than exact, especially with few replicates.
In KernelStats: Shapiro-Wilk on the within-cell residuals (for 3 to 5000 residuals), reported directly on the card when the design is replicated; not run at all on an unreplicated design, where there is no residual to test.
- AMMI's biplot is only a useful summary if the genotype x environment interaction is well captured by a few interaction principal component axes; a genuinely high-rank interaction means the two-axis biplot discards most of the real interaction structure.
In KernelStats: Checked directly: the card reports the percentage of interaction sum of squares captured by IPCA1 + IPCA2 and flags it as a warning when below 60%.
Alternatives
- Two-Way (Factorial) ANOVA. You only need the significance of the genotype x environment interaction term, not a low-rank decomposition of its structure or a stability ranking.
- Linear Mixed-Effects Model. The trial is unbalanced, environments should be treated as a random rather than fixed effect, or you want a formal genotype stability variance rather than a descriptive biplot (a factor-analytic or GGE mixed model).
- Principal Component Analysis. You have many correlated traits per genotype-environment cell (not just one yield-like response) and want to reduce THAT dimensionality: a different decomposition from AMMI's interaction-matrix SVD.
Worked example
Scenario
Twelve wheat varieties are trialled at four locations over one season, with three replicate blocks per location (a complete 12 x 4 table).
Result
The two-way ANOVA finds significant genotype, environment and genotype x environment effects; IPCA1 and IPCA2 together explain 78% of the interaction sum of squares. Two varieties sit near the AMMI1 origin on the interaction axis with above-average main-effect yield.
Interpretation
Those two varieties are the broadly adapted 'safe choices' across all four locations; varieties with large IPCA1 scores are specifically adapted to whichever locations share their sign and should be recommended only there, not everywhere.
Common misconceptions
Misconception
A significant genotype x environment interaction p-value tells you how big or how important the interaction is.
Correction
The F-test only tells you the interaction is unlikely to be pure noise; it says nothing about its size. Read the IPCA variance percentages and the biplot spread for magnitude: a significant interaction that explains 3% of the sum of squares is a different finding from one that explains 40%.
Read more: Misconception: statistical significance means practical importance
Misconception
A genotype with a large positive IPCA1 score is simply the best performer.
Correction
IPCA1 measures how much a genotype contributes to the GENOTYPE x ENVIRONMENT INTERACTION, not its average yield. A large |IPCA1| means the genotype is a specialist whose ranking shifts a lot across environments: it can be a large positive score and a poor overall yielder. Read the main-effect axis and the interaction axis together, not the interaction score alone.
References
- Statistical Analysis of Regional Yield Trials: AMMI Analysis of Factorial Designs, Gauch, H. G. (1992).
- Statistical Analysis of a Yield Trial, Zobel, R. W., Wright, M. J. and Gauch, H. G. (1988), Agronomy Journal, 80(3), 388-393.
