performs_ammi: Additive Main effects and Multiplicative Interaction

View source: R/performs_ammi.R

performs_ammiR Documentation

Additive Main effects and Multiplicative Interaction



Compute the Additive Main effects and Multiplicative interaction (AMMI) model. The estimate of the response variable for the ith genotype in the jth environment (\mjseqny_ij) using the AMMI model, is given as follows: \loadmathjax \mjsdeqny_ij = \mu + \alpha_i + \tau_j + \sum\limits_k = 1^p \lambda_ka_ik t_jk + \rho_ij + \varepsilon _ij

where \mjseqn\lambda_k is the singular value for the k-th interaction principal component axis (IPCA); \mjseqna_ik is the i-th element of the k-th eigenvector; \mjseqnt_jk is the jth element of the kth eigenvector. A residual \mjseqn\rho _ij remains, if not all p IPCA are used, where \mjseqnp \le min(g - 1; e - 1).

This function also serves as a helper function for other procedures performed in the metan package such as waas() and wsmp()


performs_ammi(.data, env, gen, rep, resp, block = NULL, verbose = TRUE, ...)



The dataset containing the columns related to Environments, Genotypes, replication/block and response variable(s).


The name of the column that contains the levels of the environments


The name of the column that contains the levels of the genotypes


The name of the column that contains the levels of the replications/blocks


The response variable(s). To analyze multiple variables in a single procedure, use comma-separated list of unquoted variable names, i.e., resp = c(var1, var2, var3), or any select helper like resp = contains("_PLA").


Defaults to NULL. In this case, a randomized complete block design is considered. If block is informed, then a resolvable alpha-lattice design (Patterson and Williams, 1976) is employed. All effects, except the error, are assumed to be fixed.


Logical argument. If verbose = FALSE the code will run silently.


Arguments passed to the function impute_missing_val() for imputation of missing values in case of unbalanced data.


  • ANOVA: The analysis of variance for the AMMI model.

  • PCA: The principal component analysis

  • MeansGxE: The means of genotypes in the environments

  • model: scores for genotypes and environments in all the possible axes.

  • augment: Information about each observation in the dataset. This includes predicted values in the fitted column, residuals in the resid column, standardized residuals in the stdres column, the diagonal of the 'hat' matrix in the hat, and standard errors for the fitted values in the column.


Tiago Olivoto


Patterson, H.D., and E.R. Williams. 1976. A new class of resolvable incomplete block designs. Biometrika 63:83-92.

See Also

impute_missing_val(), waas(), waas_means(), waasb(), get_model_data()


model <- performs_ammi(data_ge, ENV, GEN, REP, resp = c(GY, HM))

# PC1 x PC2 (variable GY)
p1 <- plot_scores(model)

# PC1 x PC2 (variable HM)
            var = 2, # or "HM"
            type = 2)

# Nominal yield plot (variable GY)
# Draw a convex hull polygon
plot_scores(model, type = 4)

# Unbalanced data (GEN 2 in E1 missing)
mod <-
  data_ge %>%
   remove_rows(4:6) %>%
   droplevels() %>%
   performs_ammi(ENV, GEN, REP, GY)
p2 <- plot_scores(mod)
arrange_ggplot(p1, p2, tag_levels = list(c("Balanced data", "Unbalanced data")))

metan documentation built on March 7, 2023, 5:34 p.m.