Performs a joint analysis of variance to check for the presence of genotype-vs-environment interactions using both randomized complete block and alpha-lattice designs.
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. The analysis of variance is computed for each level of this factor. 
- gen
- The name of the column that contains the levels of the genotypes. 
- rep
- The name of the column that contains the levels of the replications/blocks. 
- resp
- The response variable(s). To analyze multiple variables in a single procedure a vector of variables may be used. For example - resp = c(var1, var2, var3).
- block
- 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.
- verbose
- Logical argument. If - verbose = FALSEthe code will run silently.
Value
A list where each element is the result for one variable containing the following objects:
- anova: The two-way ANOVA table 
- model: The model of class - lm.
- augment: Information about each observation in the dataset. This includes predicted values in the - fittedcolumn, residuals in the- residcolumn, standardized residuals in the- stdrescolumn, the diagonal of the 'hat' matrix in the- hat, and standard errors for the fitted values in the- se.fitcolumn.
- details: A tibble with the following data: - Ngen, the number of genotypes;- OVmean, the grand mean;- Min, the minimum observed (returning the genotype and replication/block);- Maxthe maximum observed,- MinGENthe loser winner genotype,- MaxGEN, the winner genotype.
References
Patterson, H.D., and E.R. Williams. 1976. A new class of resolvable incomplete block designs. Biometrika 63:83-92.
Author
Tiago Olivoto tiagoolivoto@gmail.com
Examples
# \donttest{
library(metan)
# traditional usage approach
j_an <- anova_joint(data_ge,
                    env = ENV,
                    gen = GEN,
                    rep = REP,
                    resp = everything())
#> variable GY 
#> ---------------------------------------------------------------------------
#> Joint ANOVA table
#> ---------------------------------------------------------------------------
#>     Source     Df Sum Sq Mean Sq F value    Pr(>F)
#>        ENV  13.00 279.57 21.5057  222.41 7.25e-130
#>   REP(ENV)  28.00   9.66  0.3451    3.57  3.59e-08
#>        GEN   9.00  13.00  1.4439   14.93  2.19e-19
#>    GEN:ENV 117.00  31.22  0.2668    2.76  1.01e-11
#>  Residuals 252.00  24.37  0.0967      NA        NA
#>      CV(%)  11.63     NA      NA      NA        NA
#>  MSR+/MSR-   6.71     NA      NA      NA        NA
#>     OVmean   2.67     NA      NA      NA        NA
#> ---------------------------------------------------------------------------
#> 
#> variable HM 
#> ---------------------------------------------------------------------------
#> Joint ANOVA table
#> ---------------------------------------------------------------------------
#>     Source     Df Sum Sq Mean Sq F value    Pr(>F)
#>        ENV  13.00   5710  439.26  154.67 5.86e-112
#>   REP(ENV)  28.00    215    7.68    2.70  2.20e-05
#>        GEN   9.00    270   29.98   10.56  7.41e-14
#>    GEN:ENV 117.00   1101    9.41    3.31  1.06e-15
#>  Residuals 252.00    716    2.84      NA        NA
#>      CV(%)   3.50     NA      NA      NA        NA
#>  MSR+/MSR-   5.24     NA      NA      NA        NA
#>     OVmean  48.09     NA      NA      NA        NA
#> ---------------------------------------------------------------------------
#> 
#> All variables with significant (p < 0.05) genotype-vs-environment interaction
#> Done!
# Predicted values
get_model_data(j_an)
#> Class of the model: anova_joint
#> Variable extracted: fitted
#> # A tibble: 420 × 6
#>    ENV   GEN   REP   factors    GY    HM
#>    <fct> <fct> <fct> <chr>   <dbl> <dbl>
#>  1 E1    G1    1     G1_1     2.42  46.5
#>  2 E1    G1    2     G1_2     2.40  46.0
#>  3 E1    G1    3     G1_3     2.27  47.1
#>  4 E1    G2    1     G2_1     2.96  45.4
#>  5 E1    G2    2     G2_2     2.94  44.8
#>  6 E1    G2    3     G2_3     2.81  45.9
#>  7 E1    G3    1     G3_1     2.95  45.9
#>  8 E1    G3    2     G3_2     2.92  45.3
#>  9 E1    G3    3     G3_3     2.80  46.4
#> 10 E1    G4    1     G4_1     2.65  48.3
#> # … with 410 more rows
# Details
get_model_data(j_an, "details")
#> Class of the model: anova_joint
#> Variable extracted: details
#> # A tibble: 10 × 3
#>    Parameters GY                  HM              
#>    <chr>      <chr>               <chr>           
#>  1 Mean       "2.67"              "48.09"         
#>  2 SE         "0.05"              "0.21"          
#>  3 SD         "0.92"              "4.37"          
#>  4 CV         "34.56"             "9.09"          
#>  5 Min        "0.67 (G10 in E11)" "38 (G2 in E14)"
#>  6 Max        "5.09 (G8 in E5)"   "58 (G8 in E11)"
#>  7 MinENV     "E11 (1.37)"        "E14 (41.03)"   
#>  8 MaxENV     "E3 (4.06)"         "E11 (54.2)"    
#>  9 MinGEN     "G10 (2.47) "       "G2 (46.66) "   
#> 10 MaxGEN     "G8 (3) "           "G5 (49.3) "    
# }
