Performs a stability analysis based on the geometric mean (GAI), according to
the following model (Mohammadi and Amri, 2008):
\[GAI = \sqrt[E]{{\mathop {\bar Y}\nolimits_1 + \mathop {\bar Y}\nolimits_2 + ... + \mathop {\bar Y}\nolimits_i }}\]
where \(\bar Y_1\), \(\bar Y_2\), and \(\bar Y_i\) are
the mean yields of the first, second and *i*-th genotypes across
environments, and E is the number of environments

## Arguments

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

- env
The name of the column that contains the levels of the environments.

- gen
The name of the column that contains the levels of the genotypes.

- resp
The response variable(s). To analyze multiple variables in a single procedure use, for example,

`resp = c(var1, var2, var3)`

.- verbose
Logical argument. If

`verbose = FALSE`

the code will run silently.

## Value

An object of class `gai`

, which is a list containing the results
for each variable used in the argument `resp`

. For each variable, a
tibble with the following columns is returned.

**GEN**the genotype's code.**GAI**Geometric adaptability index**GAI_R**The rank for the GAI value.

## References

Mohammadi, R., & Amri, A. (2008). Comparison of parametric and non-parametric methods for selecting stable and adapted durum wheat genotypes in variable environments. Euphytica, 159(3), 419-432. doi:10.1007/s10681-007-9600-6 .

## Author

Tiago Olivoto tiagoolivoto@gmail.com

## Examples

```
# \donttest{
library(metan)
out <- gai(data_ge2,
env = ENV,
gen = GEN,
resp = c(EH, PH, EL, CD, ED, NKE))
#> Evaluating trait EH |======= | 17% 00:00:00
Evaluating trait PH |=============== | 33% 00:00:00
Evaluating trait EL |====================== | 50% 00:00:00
Evaluating trait CD |============================= | 67% 00:00:00
Evaluating trait ED |===================================== | 83% 00:00:01
Evaluating trait NKE |===========================================| 100% 00:00:01
# }
```