knitr::opts_chunk$set(comment = "#", collapse = TRUE)
metan
provides tools for computing several world-known stability statistics. The following stability methods are implemented.
performs_ammi()
.ammi_indexes()
.waasb()
.blup_indexes()
.ecovalence()
.gge()
.Annicchiarico()
.gai()
.ge_reg()
.Schmildt()
.ge_polar()
.ge_factanal()
.Shukla()
.ge_acv()
.Weighted Average of Absolute Scores [@Olivoto2019] using waas()
(fixed-effect model) and waasb()
(mixed-effect model).
Non-parametric methods
superiority()
.Fox()
.Huehn()
.Thennarasu()
.The easiest way to compute the above-mentioned stability indexes is by using the function ge_stats()
. This is a wrapper that basically returns a summary of each method. If you are looking for more details from each method like plot()
and print()
, I'd suggest computing the methods using their own function.
The complete functionality of the package is described at https://tiagoolivoto.github.io/metan/index.html. You're welcome to check it out!
Brief examples will be shown using the dataset data_ge
that contains data on two variables assessed in 10 genotypes growing in 14 environments.
First of all, we will check the data for possible problems with the function inspect()
.
library(metan) inspect(data_ge)
Then, the details of the multi-environment trial can be obtained with the function ge_details()
. Note that to apply the function to all numeric variables quickly, we can use the select helper everything()
in the argument resp
.
ge_details(data_ge, env = ENV, gen = GEN, resp = everything())
We can create a plot to show the performance of the genotypes across the environments with ge_plot()
.
ge_plot(data_ge, GEN, ENV, GY)
Or obtain the means for genotypes, environments or genotype-environment interaction with ge_means()
. Note that the function round_cols()
provided by metan
round all numeric columns of a data frame to two (default) significant figures.
mge <- ge_means(data_ge, env = ENV, gen = GEN, resp = everything()) # Genotype-environment means get_model_data(mge) %>% round_cols() # Environment means get_model_data(mge, what = "env_means") %>% round_cols() # Genotype means get_model_data(mge, what = "gen_means") %>% round_cols()
The AMMI model may be fitted with with both functions performs_ammi()
and waas()
, which is the acronym for the weighted average of absolute scores [@Olivoto2019].
ammi_model <- performs_ammi(data_ge, ENV, GEN, REP, resp = c(GY, HM)) waas_index <- waas(data_ge, ENV, GEN, REP, GY, verbose = FALSE)
The cross-validation procedures implemented in the metan
are based on the splitting of the original data into a training set and a validation set. The model is fitted using the training set and the predicted value is compared with the validation set. This process is iterated many times, say, 1000 times. The lesser the difference between predicted and validation data, the higher the predictive accuracy of the model. More information may be found here.
The well-known AMMI2 biplot may be obtained using the function plot_scores()
. ggplot2-based graphics are obtained. Please, note that since performs_ammi()
and , waas()
functions allow analyzing multiple variables at the same time, e.g., resp = c(v1, v2, ...)
, the output ammi_model
is a list that in this case has two elements, (GY and HM). To produce an AMMI2 biplot with IPCA1 and IPCA3, for example, we use the argument second
to change the default value of the y axis.
a <- plot_scores(ammi_model) b <- plot_scores(ammi_model, type = 2, second = "PC3") c <- plot_scores(ammi_model, type = 2, polygon = TRUE, col.gen = "black", col.env = "gray70", col.segm.env = "gray70", axis.expand = 1.5) arrange_ggplot(a, b, c, tag_levels = "a", ncol = 1)
The S3 method predict()
is implemented for objects of class performs_ammi
and may be used to estimate the response of each genotype in each environment considering different number of Interaction Principal Component Axis (IPCA). As a example, to predict the variables GY and HM we will use four and six IPCA (number of significant IPCAs, respectively). In addition, we will create a two way table with make_mat()
to show the predicted values for the variable GY.
predicted <- predict(ammi_model, naxis = c(4, 6)) predicted %>% subset(TRAIT == "GY") %>% make_mat(GEN, ENV, YpredAMMI) %>% round_cols()
The implementation of linear-mixed effect models to predict the response variable in MET is made with the function gamem_met()
. By default, genotype and genotype-vs-environment interaction are assumed to have random effects. Use the argument random
to change this default. In the following example the model is fitted to all numeric variables in data_ge
.
model2 <- gamem_met(data_ge, ENV, GEN, REP, everything())
Several residual plots may be obtained using the S3 generic function plot()
..
plot(model2, which = c(1, 2, 7), ncol = 1)
The distribution of the random effects may be obtained using the argument
type = "re"
.
plot(model2, type = "re", nrow = 3)
We can get easily the model results such as the Likelihood Ration Test for random effects, the variance components, and the BLUPs for genotypes with get_model_data()
. By default, the function returns the genetic parameters.
get_model_data(model2) %>% round_cols(digits = 3)
library(ggplot2) d <- plot_blup(model2) e <- plot_blup(model2, prob = 0.1, col.shape = c("gray20", "gray80")) + coord_flip() arrange_ggplot(d, e, tag_levels = list(c("d", "e")), ncol = 1)
get_model_data(model2, what = "blupge") %>% round_cols()
The WAASB index [@Olivoto2019] is a quantitative stability measure based on the weighted average of the absolute scores from the singular value decomposition of the BLUPs for genotype-vs-interaction effects. We can obtain this statistic with the function waasb()
combined with get_model_data()
using what = "WAASB"
.
model3 <- waasb(data_ge, ENV, GEN, REP, everything(), verbose = FALSE) get_model_data(model3, what = "WAASB") %>% round_cols()
The function blup_indexes()
can be used to compute the harmonic mean of genotypic values (HMGV), the relative performance of the genotypic values (RPGV) and the harmonic mean of the relative performance of genotypic values (HMRPGV). See @Alves2018 for more details. We use the function get_model_data()
to get the HMRPGV (default) for all analyzed variables.
index <- blup_indexes(model3) get_model_data(index) %>% round_cols()
The GGE model is fitted with the function gge()
. This function produces a GGE model based on both a two-way table (in our case the object table
) with genotypes in the rows and environments in columns, or a data.frame containing at least the columns for genotypes, environments and the response variable(s).
gge_model <- gge(data_ge, ENV, GEN, GY)
The generic function plot()
is used to generate a biplot using as input a fitted model of class gge
. The type of biplot is chosen by the argument type
in the function. Ten biplots type are available according to {@Yan2003}.
type = 1
A basic biplot.type = 2
Mean performance vs. stability.type = 3
Which-won-where.type = 4
Discriminativeness vs. representativeness.type = 5
Examine an environment.type = 6
Ranking environments.type = 7
Examine a genotype.type = 8
Ranking gentoypes.type = 9
Compare two genotypes.type = 10
Relationship among environments.f <- plot(gge_model) g <- plot(gge_model, type = 2) arrange_ggplot(e, f, tag_levels = list(c("e", "f")), ncol = 1)
ge_stats()
To compute all the stability statistics at once, we can use the function ge_stats()
. Again we get the results with get_model_data()
.
stat_ge <- ge_stats(data_ge, ENV, GEN, REP, GY) get_model_data(stat_ge) %>% round_cols()
The multi-trait stability index (MTSI) was proposed by @Olivoto2019a and is used for simultaneous selection considering mean performance and stability (of several traits) in the analysis of METs using both fixed and mixed-effect models. For more details see the complete vignette.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.