`vignettes/vignettes_blup.Rmd`

`vignettes_blup.Rmd`

In this section, we will use the data in `data_ge`

. For more information, please, see `?data_ge`

. Other data sets can be used provided that the following columns are in the dataset: environment, genotype, block/replicate and response variable(s).

The first step is to inspect the data with the function `inspect()`

.

```
library(metan)
inspect <-
inspect(data_ge,
verbose = FALSE,
plot = TRUE)
```

The function `gamem()`

may be used to analyze single experiments (one-way experiments) using a mixed-effect model according to the following model:

\[
y_{ij}= \mu + \alpha_i + \tau_j + \varepsilon_{ij}
\] where \(y_{ij}\) is the value observed for the *i*th genotype in the *j*th replicate (*i* = 1, 2, … *g*; *j* = 1, 2, .., *r*); being *g* and *r* the number of genotypes and replicates, respectively; \(\alpha_i\) is the random effect of the *i*th genotype; \(\tau_j\) is the fixed effect of the *j*th replicate; and \(\varepsilon_{ij}\) is the random error associated to \(y_{ij}\). In this example, we will use the example data `data_g`

from metan package.

```
gen_mod <- gamem(data_g, GEN, REP,
resp = c(ED, CL, CD, KW, TKW, NKR))
# Method: REML/BLUP
# Random effects: GEN
# Fixed effects: REP
# Denominador DF: Satterthwaite's method
# ---------------------------------------------------------------------------
# P-values for Likelihood Ratio Test of the analyzed traits
# ---------------------------------------------------------------------------
# model ED CL CD KW TKW NKR
# Complete NA NA NA NA NA NA
# Genotype 2.73e-05 2.25e-06 0.118 0.0253 0.00955 0.216
# ---------------------------------------------------------------------------
# Variables with nonsignificant Genotype effect
# CD NKR
# ---------------------------------------------------------------------------
```

The easiest way of obtaining the results of the model above is by using the function `get_model_data()`

. Let’s do it.

- Details of the analysis

```
get_model_data(gen_mod, "details") %>% print_table()
# Class of the model: gamem
# Variable extracted: details
```

- Likelihood ratio test for genotype effect

```
get_model_data(gen_mod, "pval_lrt") %>% print_table()
# Class of the model: gamem
# Variable extracted: pval_lrt
```

- Variance components and genetic parameters

```
get_model_data(gen_mod, "genpar") %>% print_table()
# Class of the model: gamem
# Variable extracted: genpar
```

- Predicted means

```
get_model_data(gen_mod, "blupg") %>% print_table()
# Class of the model: gamem
# Variable extracted: blupg
```

In the above example, the experimental design was a complete randomized block. It is also possible to analyze an experiment conducted in an alpha-lattice design with the function `gamem()`

. In this case, the following model is fitted:

\[ y_{ijk}= \mu + \alpha_i + \gamma_j + (\gamma \tau)_{jk} + \varepsilon_{ijk} \]

where \(y_{ijk}\) is the observed value of the *i*th genotype in the *k*th block of the *j*th replicate (*i* = 1, 2, … *g*; *j* = 1, 2, .., *r*; *k* = 1, 2, .., *b*); respectively; \(\alpha_i\) is the random effect of the *i*th genotype; \(\gamma_j\) is the fixed effect of the *j*th complete replicate; \((\gamma \tau)_{jk}\) is the random effect of the *k*th incomplete block nested within the *j* replicate; and \(\varepsilon_{ijk}\) is the random error associated to \(y_{ijk}\). In this example, we will use the example data `data_alpha`

from metan package.

```
gen_alpha <- gamem(data_alpha, GEN, REP, YIELD, block = BLOCK)
# Method: REML/BLUP
# Random effects: GEN, BLOCK(REP)
# Fixed effects: REP
# Denominador DF: Satterthwaite's method
# ---------------------------------------------------------------------------
# P-values for Likelihood Ratio Test of the analyzed traits
# ---------------------------------------------------------------------------
# model YIELD
# Complete NA
# Genotype 1.18e-06
# rep:block 3.35e-03
# ---------------------------------------------------------------------------
# All variables with significant (p < 0.05) genotype effect
get_model_data(gen_alpha, "pval_lrt") %>% print_table()
# Class of the model: gamem
# Variable extracted: pval_lrt
```

```
get_model_data(gen_alpha, "details") %>% print_table()
# Class of the model: gamem
# Variable extracted: details
```

```
get_model_data(gen_alpha, "genpar") %>% print_table()
# Class of the model: gamem
# Variable extracted: genpar
```

The simplest and well-known linear model with interaction effect used to analyze data from multi-environment trials is \[ {y_{ijk}} = {\rm{ }}\mu {\rm{ }} + \mathop \alpha \nolimits_i + \mathop \tau \nolimits_j + \mathop {(\alpha \tau )}\nolimits_{ij} + \mathop \gamma \nolimits_{jk} + {\rm{ }}\mathop \varepsilon \nolimits_{ijk} \]

where \({y_{ijk}}\) is the response variable (e.g., grain yield) observed in the *k*th block of the *i*th genotype in the *j*th environment (*i* = 1, 2, …, *g*; *j* = 1, 2, …, *e*; *k* = 1, 2, …, *b*); \(\mu\) is the grand mean; \(\mathop \alpha \nolimits_i\) is the effect of the ith genotype; \(\mathop \tau \nolimits_j\) is the effect of the *j*th environment; \(\mathop {(\alpha \tau )}\nolimits_{ij}\) is the interaction effect of the *i*th genotype with the *j*th environment; \(\mathop \gamma \nolimits_{jk}\) is the effect of the *k*th block within the *j*th environment; and \(\mathop \varepsilon \nolimits_{ijk}\) is the random error. In a mixed-effect model assuming \({\alpha _i}\) and \(\mathop {(\alpha \tau )}\nolimits_{ij}\) to be random effects, the above model can be rewritten as follows

\[ {\boldsymbol{y = X\beta + Zu + \varepsilon }} \]

where **y ** is an \(n[ = \sum\nolimits_{j = 1}^e {(gb)]} \times 1\) vector of response variable \({\bf{y}} = {\rm{ }}{\left[ {{y_{111}},{\rm{ }}{y_{112}},{\rm{ }} \ldots ,{\rm{ }}{y_{geb}}} \right]^\prime }\); \({\bf{\beta }}\) is an \((eb) \times 1\) vector of unknown fixed effects \({\boldsymbol{\beta }} = [\mathop \gamma \nolimits_{11} ,\mathop \gamma \nolimits_{12} ,...,\mathop \gamma \nolimits_{eb} ]'\); **u** is an \(m[ = g + ge] \times 1\) vector of random effects \({\boldsymbol{u}} = {\rm{ }}{\left[ {{\alpha _1},{\alpha _2},...,{\alpha _g},\mathop {(\alpha \tau )}\nolimits_{11} ,\mathop {(\alpha \tau )}\nolimits_{12} ,...,\mathop {(\alpha \tau )}\nolimits_{ge} } \right]^\prime }\); **X ** is an \(n \times (eb)\) design matrix relating **y** to \({\bf{\beta }}\); **Z ** is an \(n \times m\) design matrix relating **y** to **u **; \({\boldsymbol{\varepsilon }}\) is an \(n \times 1\) vector of random errors \({\boldsymbol{\varepsilon }} = {\rm{ }}{\left[ {{y_{111}},{\rm{ }}{y_{112}},{\rm{ }} \ldots ,{\rm{ }}{y_{geb}}} \right]^\prime }\);

The vectors \({\boldsymbol{\beta }}\) and **u** are estimated using the well-known mixed model equation (Henderson 1975). \[
\left[ {\begin{array}{*{20}{c}}{{\boldsymbol{\hat \beta }}}\\{{\bf{\hat u}}}\end{array}} \right]{\bf{ = }}{\left[ {\begin{array}{*{20}{c}}{{\bf{X'}}{{\bf{r }}^{ - {\bf{1}}}}{\bf{X}}}&{{\bf{X'}}{{\bf{r }}^{ - {\bf{1}}}}{\bf{Z}}}\\{{\bf{Z'}}{{\bf{r }}^{ - {\bf{1}}}}{\bf{X}}}&{{\bf{Z'}}{{\bf{r }}^{ - {\bf{1}}}}{\bf{Z + }}{{\bf{G}}^{ - {\bf{1}}}}}\end{array}} \right]^ - }\left[ {\begin{array}{*{20}{c}}{{\bf{X'}}{{\bf{r }}^{ - {\bf{1}}}}{\bf{y}}}\\{{\bf{Z'}}{{\bf{r }}^{ - {\bf{1}}}}{\bf{y}}}\end{array}} \right]
\] where **G** and **R** are the variance-covariance matrices for random-effect vector **u** and residual vector \({\bf{\varepsilon }}\), respectively.

The function `gamem_met()`

is used to fit the linear mixed-effect model. The first argument is the data, in our example `data_ge`

. The arguments (`env`

, `gen`

, and `rep`

) are the name of the columns that contains the levels for environments, genotypes, and replications, respectively.The argument (`resp`

) is the response variable to be analyzed. The function allow a single variable (in this case GY) or a vector of response variables. Here, we will use `everything()`

to analyse all numeric variables in the data. By default, genotype and genotype-vs-environment interaction are assumed to be random effects. Other effects may be considered using the `random`

argument. The last argument (`verbose`

) control if the code is run silently or not.

```
library(metan)
mixed_mod <-
gamem_met(data_ge,
env = ENV,
gen = GEN,
rep = REP,
resp = everything(),
random = "gen", #Default
verbose = TRUE) #Default
# Method: REML/BLUP
# Random effects: GEN, GEN:ENV
# Fixed effects: ENV, REP(ENV)
# Denominador DF: Satterthwaite's method
# ---------------------------------------------------------------------------
# P-values for Likelihood Ratio Test of the analyzed traits
# ---------------------------------------------------------------------------
# model GY HM
# COMPLETE NA NA
# GEN 1.11e-05 5.07e-03
# GEN:ENV 2.15e-11 2.27e-15
# ---------------------------------------------------------------------------
# All variables with significant (p < 0.05) genotype-vs-environment interaction
```

The S3 generic function `plot()`

is used to generate diagnostic plots of residuals of the model.

The normality of the random effects of genotype and interaction effects may be also obtained by using `type = "re"`

.

`plot(mixed_mod, type = "re")`

The output `LRT`

contains the Likelihood Ratio Tests for genotype and genotype-vs-environment random effects. We can get these values with `get_model_data()`

```
data <- get_model_data(mixed_mod, "pval_lrt")
print_table(data)
```

In the output `ESTIMATES`

, beyond the variance components for the declared random effects, some important parameters are also shown. **Heribatility** is the broad-sense heritability, \(\mathop h\nolimits_g^2\), estimated by \[
\mathop h\nolimits_g^2 = \frac{\mathop {\hat\sigma} \nolimits_g^2} {\mathop {\hat\sigma} \nolimits_g^2 + \mathop {\hat\sigma} \nolimits_i^2 + \mathop {\hat\sigma} \nolimits_e^2 }
\]

where \(\mathop {\hat\sigma} \nolimits_g^2\) is the genotypic variance; \(\mathop {\hat\sigma} \nolimits_i^2\) is the genotype-by-environment interaction variance; and \(\mathop {\hat\sigma} \nolimits_e^2\) is the residual variance.

**GEIr2** is the coefficient of determination of the interaction effects, \(\mathop r\nolimits_i^2\), estimated by

\[
\mathop r\nolimits_i^2 = \frac{\mathop {\hat\sigma} \nolimits_i^2}
{\mathop {\hat\sigma} \nolimits_g^2 + \mathop {\hat\sigma} \nolimits_i^2 + \mathop {\hat\sigma} \nolimits_e^2 }
\] **Heribatility of means** is the heribability on the mean basis, \(\mathop h\nolimits_{gm}^2\), estimated by

\[ \mathop h\nolimits_{gm}^2 = \frac{\mathop {\hat\sigma} \nolimits_g^2}{[\mathop {\hat\sigma} \nolimits_g^2 + \mathop {\hat\sigma} \nolimits_i^2 /e + \mathop {\hat\sigma} \nolimits_e^2 /\left( {eb} \right)]} \]

where *e* and *b* are the number of environments and blocks, respectively; **Accuracy** is the accuracy of selection, *Ac*, estimated by \[
Ac = \sqrt{\mathop h\nolimits_{gm}^2}
\]

**rge** is the genotype-environment correlation, \(\mathop r\nolimits_{ge}\), estimated by

\[ \mathop r\nolimits_{ge} = \frac{\mathop {\hat\sigma} \nolimits_g^2}{\mathop {\hat\sigma} \nolimits_g^2 + \mathop {\hat\sigma} \nolimits_i^2} \]

**CVg** and **CVr** are the the genotypic coefficient of variation and the residual coefficient of variation estimated, respectively, by \[
CVg = \left( {\sqrt {\mathop {\hat \sigma }\nolimits_g^2 } /\mu } \right) \times 100
\] and \[
CVr = \left( {\sqrt {\mathop {\hat \sigma }\nolimits_e^2 } /\mu } \right) \times 100
\] where \(\mu\) is the grand mean.

**CV ratio** is the ratio between genotypic and residual coefficient of variation.

The function `get_model_data()`

may be used to easily get the data from a model fitted with the function `gamem_met()`

, especially when more than one variables are used. The following code return the predicted mean of each genotype for five variables of the data `data_ge2`

.

```
get_model_data(mixed_mod, what = "blupg")
# Class of the model: waasb
# Variable extracted: blupg
# # A tibble: 10 x 3
# GEN GY HM
# <fct> <dbl> <dbl>
# 1 G1 2.62 47.4
# 2 G10 2.51 48.4
# 3 G2 2.73 47.1
# 4 G3 2.90 47.8
# 5 G4 2.65 48.0
# 6 G5 2.56 48.9
# 7 G6 2.56 48.5
# 8 G7 2.73 48.0
# 9 G8 2.94 48.8
# 10 G9 2.54 48.0
```

```
library(ggplot2)
a <- plot_blup(mixed_mod)
b <- plot_blup(mixed_mod,
col.shape = c("gray20", "gray80"),
plot_theme = theme_metan(grid = "y")) +
coord_flip()
arrange_ggplot(a, b, labels = letters[1:2])
```

This output shows the predicted means for genotypes. **BLUPg** is the genotypic effect \((\hat{g}_{i})\), which considering balanced data and genotype as random effect is estimated by

\[ \hat{g}_{i} = h_g^2(\bar{y}_{i.}-\bar{y}_{..}) \]

where \(h_g^2\) is the shrinkage effect for genotype. **Predicted** is the predicted mean estimated by \[
\hat{g}_{i}+\mu
\]

where \(\mu\) is the grand mean. **LL** and **UL** are the lower and upper limits, respectively, estimated by \[
(\hat{g}_{i}+\mu)\pm{CI}
\] with \[
CI = t\times\sqrt{((1-Ac)\times{\mathop \sigma \nolimits_g^2)}}
\]

where \(t\) is the Student’s *t* value for a two-tailed *t* test at a given probability error; \(Ac\) is the accuracy of selection and \(\mathop \sigma \nolimits_g^2\) is the genotypic variance.

This output shows the predicted means for each genotype and environment combination. **BLUPg** is the genotypic effect described above. **BLUPge** is the genotypic effect of the *i*th genotype in the *j*th environment \((\hat{g}_{ij})\), which considering balanced data and genotype as random effect is estimated by \[\hat{g}_{ij} = h_g^2(\bar{y}_{i.}-\bar{y}_{..})+h_{ge}^2(y_{ij}-\bar{y}_{i.}-\bar{y}_{.j}+\bar{y}_{..})\] where \(h_{ge}^2\) is the shrinkage effect for the genotype-by-environment interaction; **BLUPg+ge** is \(BLUP_g+BLUP_{ge}\); **Predicted** is the predicted mean (\(\hat{y}_{ij}\)) estimated by \[
\hat{y}_{ij} = \bar{y}_{.j}+BLUP_{g+ge}
\]

The following pieces of information are provided in `Details`

output. **Nenv**, the number of environments in the analysis; **Ngen** the number of genotypes in the analysis; **mresp** The value attributed to the highest value of the response variable after rescaling it; **wresp** The weight of the response variable for estimating the WAASBY index. **Mean** the grand mean; **SE** the standard error of the mean; **SD** the standard deviation. **CV** the coefficient of variation of the phenotypic means, estimating WAASB, **Min** the minimum value observed (returning the genotype and environment), **Max** the maximum value observed (returning the genotype and environment); **MinENV** the environment with the lower mean, **MaxENV** the environment with the larger mean observed, **MinGEN** the genotype with the lower mean, **MaxGEN** the genotype with the larger.

```
data <- get_model_data(mixed_mod, "details")
# Class of the model: waasb
# Variable extracted: details
print_table(data)
```

The function `waasb()`

function computes the Weighted Average of the Absolute Scores considering all possible IPCA from the Singular Value Decomposition of the BLUPs for genotype-vs-environment interaction effects obtained by an Linear Mixed-effect Model (Olivoto et al. 2019), as follows:

\[ WAASB_i = \sum_{k = 1}^{p} |IPCA_{ik} \times EP_k|/ \sum_{k = 1}^{p}EP_k \]

where \(WAASB_i\) is the weighted average of absolute scores of the *i*th genotype; \(IPCA_{ik}\) is the scores of the *i*th genotype in the *k*th IPCA; and \(EP_k\) is the explained variance of the *k*th PCA for \(k = 1,2,..,p\), \(p = min(g-1; e-1)\).

```
waasb_model <-
waasb(data_ge,
env = ENV,
gen = GEN,
rep = REP,
resp = everything(),
random = "gen", #Default
verbose = TRUE) #Default
# Method: REML/BLUP
# Random effects: GEN, GEN:ENV
# Fixed effects: ENV, REP(ENV)
# Denominador DF: Satterthwaite's method
# ---------------------------------------------------------------------------
# P-values for Likelihood Ratio Test of the analyzed traits
# ---------------------------------------------------------------------------
# model GY HM
# COMPLETE NA NA
# GEN 1.11e-05 5.07e-03
# GEN:ENV 2.15e-11 2.27e-15
# ---------------------------------------------------------------------------
# All variables with significant (p < 0.05) genotype-vs-environment interaction
data <- waasb_model$GY$model
print_table(data)
```

The output generated by the `waasb()`

function is very similar to those generated by the `waas()`

function. The main difference here, is that the singular value decomposition is based on the BLUP for GEI effects matrix.

```
plot_eigen(waasb_model, size.lab = 14, size.tex.lab = 14)
```

The above output shows the eigenvalues and the proportion of variance explained by each principal component axis of the BLUP interaction effects matrix.

Provided that an object of class `waasb`

is available in the global environment, the graphics may be obtained using the function `plot_scores()`

. To do that, we will revisit the previusly fitted model `WAASB`

. Please, refer to `?plot_scores`

for more details. Four types of graphics can be generated: 1 = \(PC1 \times PC2\); 2 = \(GY \times PC1\); 3 = \(GY \times WAASB\); and 4 = a graphic with nominal yield as a function of the environment PCA1 scores.

```
c <- plot_scores(waasb_model, type = 1)
d <- plot_scores(waasb_model,
type = 1,
col.gen = "black",
col.env = "red",
col.segm.env = "red",
axis.expand = 1.5)
arrange_ggplot(c, d, labels = letters[3:4])
```

```
e <- plot_scores(waasb_model, type = 2)
f <- plot_scores(waasb_model,
type = 2,
polygon = TRUE,
col.segm.env = "transparent",
plot_theme = theme_metan_minimal())
arrange_ggplot(e, f, labels = letters[5:6])
```

The quadrants proposed by Olivoto et al. (2019) in the following biplot represent four classifications regarding the joint interpretation of mean performance and stability. The genotypes or environments included in quadrant I can be considered unstable genotypes or environments with high discrimination ability, and with productivity below the grand mean. In quadrant II are included unstable genotypes, although with productivity above the grand mean. The environments included in this quadrant deserve special attention since, in addition to providing high magnitudes of the response variable, they present a good discrimination ability. Genotypes within quadrant III have low productivity, but can be considered stable due to the lower values of WAASB. The lower this value, the more stable the genotype can be considered. The environments included in this quadrant can be considered as poorly productive and with low discrimination ability. The genotypes within the quadrant IV are highly productive and broadly adapted due to the high magnitude of the response variable and high stability performance (lower values of WAASB).

```
g <- plot_scores(waasb_model, type = 3)
h <- plot_scores(waasb_model, type = 3,
x.lab = "My customized x label",
size.shape = 3,
size.tex.pa = 2,
x.lim = c(1.2, 4.7),
x.breaks = seq(1.5, 4.5, by = 0.5),
plot_theme = theme_metan(color.background = "white"))
arrange_ggplot(g, h, labels = letters[7:8])
```

To obtain the WAASB index for a set of variables, the function `get_model_data()`

is used, as shown bellow.

```
waasb(data_ge2, ENV, GEN, REP,
resp = c(PH, ED, TKW, NKR)) %>%
get_model_data(what = "WAASB") %>%
print_table()
# Method: REML/BLUP
# Random effects: GEN, GEN:ENV
# Fixed effects: ENV, REP(ENV)
# Denominador DF: Satterthwaite's method
# ---------------------------------------------------------------------------
# P-values for Likelihood Ratio Test of the analyzed traits
# ---------------------------------------------------------------------------
# model PH ED TKW NKR
# COMPLETE NA NA NA NA
# GEN 9.39e-01 2.99e-01 1.00e+00 0.78738
# GEN:ENV 1.09e-13 1.69e-08 4.21e-10 0.00404
# ---------------------------------------------------------------------------
# All variables with significant (p < 0.05) genotype-vs-environment interaction
# Class of the model: waasb
# Variable extracted: WAASB
```

```
i <- plot_scores(waasb_model, type = 4)
j <- plot_scores(waasb_model,
type = 4,
size.tex.pa = 1.5,
color = FALSE,
col.alpha.gen = 0,
col.alpha.env = 0,
plot_theme = theme_metan(color.background = "white"))
arrange_ggplot(i, j, labels = letters[9:10])
```

The **waasby** index is used for genotype ranking considering both the stability (**waasb**) and mean performance (**y**) based on the following model (Olivoto et al. 2019).

\[ waasby_i = \frac{{\left( {r {Y_i} \times {\theta _Y}} \right) + \left( {r {W_i} \times {\theta _W}} \right)}}{{{\theta _Y} + {\theta _W}}} \]

where \(waasby_i\) is the superiority index for the *i*-th genotype; \(rY_i\) and \(rW_i\) are the rescaled values (0-100) for the response variable (y) and the stability (WAAS or WAASB), respectively; \(\theta _Y\) and \(\theta_W\) are the weights for mean performance and stability, respectively.

This index was also already computed and stored into AMMI_model>GY>model. An intuitively plot may be obtained by running

```
i <- plot_waasby(waasb_model)
j <- plot_waasby(waasb_model, col.shape = c("gray20", "gray80"))
arrange_ggplot(i, j, labels = letters[9:10])
```

In the following example, we will apply the function `wsmp()`

to the previously fitted model **waasb_model** aiming at planning different scenarios of **waasby** estimation by changing the weights assigned to the stability and the mean performance.vThe number of scenarios is defined by the arguments `increment`

. By default, twenty-one different scenarios are computed. In this case, the the superiority index **waasby** is computed considering the following weights: stability (waasb or waas) = 100; mean performance = 0. In other words, only stability is considered for genotype ranking. In the next iteration, the weights becomes 95/5 (since increment = 5). In the third scenario, the weights become 90/10, and so on up to these weights become 0/100. In the last iteration, the genotype ranking for WAASY or WAASBY matches perfectly with the ranks of the response variable.

`scenarios <- wsmp(waasb_model)`

In addition, the genotype ranking depending on the number of multiplicative terms used to estimate the WAAS index is also computed.

The first type of heatmap shows the genotype ranking depending on the number of principal component axes used for estimating the WAASB index. An euclidean distance-based dendrogram is used for grouping the genotypes based on their ranks. The second type of heatmap shows the genotype ranking depending on the WAASB/GY ratio. The ranks obtained with a ratio of 100/0 considers exclusively the stability for genotype ranking. On the other hand, a ratio of 0/100 considers exclusively the productivity for genotype ranking. Four clusters are estimated (1) unproductive and unstable genotypes; (2) productive, but unstable genotypes; (3) stable, but unproductive genotypes; and (4), productive and stable genotypes (Olivoto et al. 2019).

```
plot(scenarios, type = 1)
```

```
plot(scenarios, type = 2)
```

Colombari Filho et al. (2013) have shown the use of three BLUP-based indexes for selecting genotypes with performance and stability. The first is the harmonic mean of genotypic values -or BLUPS- (HMGV) a stability index that considers the genotype with the highest harmonic mean across environments as the most stable, as follows:

\[ HMGV_i = \frac{1}{e}\sum\limits_{j = 1}^e {\frac{1}{{BLUP_{ij}}}} \]

The second is the relative performance of genotypic values (RPGV), an adaptability index estimated as follows:

\[ RPGV_i = \frac{1}{e}{\sum\limits_{j = 1}^e {BLUP_{ij}} /\mathop \mu \nolimits_j } \]

The third and last is the harmonic mean of relative performance of genotypic values (HMRPGV), a simultaneous selection index for stability, adaptability and mean performance, estimated as follows:

\[ HMRPGV_i = \frac{1}{e}\sum\limits_{j = 1}^e {\frac{1}{{BLUP_{ij}/{\mu _j}}}} \]

```
Res_ind <-
data_ge %>%
waasb(ENV, GEN, REP, resp = GY, verbose = FALSE) %>%
Resende_indexes()
print_table(Res_ind$GY)
```

The FAI-BLUP is a multi-trait index based on factor analysis and ideotype-design recentely proposed by Rocha, Machado, and Carneiro (2018). It is based on factor analysis, when the factorial scores of each ideotype are designed according to the desirable and undesirable factors. Then, a spatial probability is estimated based on genotype-ideotype distance, enabling genotype ranking (Rocha, Machado, and Carneiro 2018).

```
data_ge2 %>%
gamem_met(ENV, GEN, REP, c(KW, NKE, PH, EH)) %>%
fai_blup(DI = c("max, max, max, min"),
UI = c("min, min, min, max"),
SI = 15) %>%
plot()
# ---------------------------------------------------------------------------
# P-values for Likelihood Ratio Test of the analyzed traits
# ---------------------------------------------------------------------------
# model KW NKE PH EH
# COMPLETE NA NA NA NA
# GEN 6.21e-01 1.00000 9.39e-01 1.00e+00
# GEN:ENV 4.92e-07 0.00101 1.09e-13 8.12e-12
# ---------------------------------------------------------------------------
# All variables with significant (p < 0.05) genotype-vs-environment interaction
#
# -----------------------------------------------------------------------------------
# Principal Component Analysis
# -----------------------------------------------------------------------------------
# eigen.values cumulative.var
# PC1 3.1441417 78.60354
# PC2 0.6604119 95.11384
# PC3 0.1385777 98.57828
# PC4 0.0568688 100.00000
#
# -----------------------------------------------------------------------------------
# Factor Analysis
# -----------------------------------------------------------------------------------
# FA1 comunalits
# KW 0.9474560 0.8976729
# NKE 0.7429933 0.5520391
# PH 0.9429971 0.8892436
# EH 0.8973216 0.8051860
#
# -----------------------------------------------------------------------------------
# Comunalit Mean: 0.7860354
# Selection differential
# -----------------------------------------------------------------------------------
# Factor Xo Xs SD SDperc
# KW 1 172.938867 175.182040 2.243173e+00 1.297090e+00
# NKE 1 511.643590 511.643590 2.819513e-07 5.510697e-08
# PH 1 2.484813 2.487051 2.238030e-03 9.006835e-02
# EH 1 1.343326 1.343326 3.234133e-10 2.407557e-08
#
# -----------------------------------------------------------------------------------
# Selected genotypes
# H13 H6
# -----------------------------------------------------------------------------------
```

IMPORTANT`fai_blup()`

recognizes models fitted with both`gamem_met()`

and`waasb()`

. For balanced data (all genotypes in all environments)`waasb()`

and`gamem_met()`

will return the same model. In case of unbalanced trials, the function`waasb()`

will return an error since a complete two-way table is required to the singular value decomposition procedure.

**Rendering engine**

This vignette was built with pkgdown. All tables were produced with the package `DT`

using the following function.

```
library(DT) # Used to make the tables
# Function to make HTML tables
print_table <- function(table, rownames = FALSE, ...){
datatable(table, rownames = rownames, extensions = 'Buttons',
options = list(scrollX = TRUE, dom = '<<t>Bp>', buttons = c('copy', 'excel', 'pdf', 'print')), ...) %>%
formatSignif(columns = c(1:ncol(table)), digits = 3)}
```

Colombari Filho, J. M., M. D. V. Resende, O. P. Morais, A. P. Castro, É. P. Guimarães, J. A. Pereira, M. M. Utumi, and F. Breseghello. 2013. “Upland rice breeding in Brazil: a simultaneous genotypic evaluation of stability, adaptability and grain yield.” *Euphytica* 192 (1): 117–29. https://doi.org/10.1007/s10681-013-0922-2.

Henderson, C. R. 1975. “Best Linear Unbiased Estimation and Prediction under a Selection Model.” *Biometrics* 31 (2): 423–47. https://doi.org/10.2307/2529430.

Olivoto, T., A. D. C Lúcio, J. A. G. Da silva, V. S. Marchioro, V. Q. de Souza, and E. Jost. 2019. “Mean performance and stability in multi-environment trials I: Combining features of AMMI and BLUP techniques.” *Agronomy Journal* 111 (6): 2949–60. https://doi.org/10.2134/agronj2019.03.0220.

Rocha, João Romero do Amaral Santos de Car, Juarez Campolina Machado, and Pedro Crescêncio Souza Carneiro. 2018. “Multitrait index based on factor analysis and ideotype-design: proposal and application on elephant grass breeding for bioenergy.” *GCB Bioenergy* 10 (1): 52–60. https://doi.org/10.1111/gcbb.12443.