Skip to contents

[Stable]

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.

Usage

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

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 = FALSE the 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 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 se.fit column.

  • 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); Max the maximum observed, MinGEN the 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   62.33 3.90e-17
#>    REP(ENV)  28.00   9.66  0.3451    3.57 3.59e-08
#>         GEN   9.00  13.00  1.4439    5.41 3.44e-06
#>     GEN:ENV 117.00  31.22  0.2668    2.76 1.01e-11
#>     ENV/GEN 130.00 310.79  2.3907   24.72 9.58e-95
#>      ENV/G1  13.00  32.69  2.5146   26.01 1.90e-39
#>     ENV/G10  13.00  42.71  3.2855   33.98 4.72e-48
#>      ENV/G2  13.00  34.03  2.6180   27.08 1.11e-40
#>      ENV/G3  13.00  30.39  2.3380   24.18 2.83e-37
#>      ENV/G4  13.00  26.80  2.0618   21.32 1.06e-33
#>      ENV/G5  13.00  23.47  1.8050   18.67 3.66e-30
#>      ENV/G6  13.00  22.02  1.6937   17.52 1.47e-28
#>      ENV/G7  13.00  21.99  1.6917   17.50 1.58e-28
#>      ENV/G8  13.00  32.45  2.4961   25.82 3.18e-39
#>      ENV/G9  13.00  44.24  3.4028   35.19 2.97e-49
#>   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   57.22 1.22e-16
#>    REP(ENV)  28.00    215    7.68    2.70 2.20e-05
#>         GEN   9.00    270   29.98    3.19 1.76e-03
#>     GEN:ENV 117.00   1101    9.41    3.31 1.06e-15
#>     ENV/GEN 130.00   6811   52.39   18.45 9.92e-81
#>      ENV/G1  13.00    621   47.74   16.81 1.50e-27
#>     ENV/G10  13.00   1111   85.48   30.10 4.97e-44
#>      ENV/G2  13.00    642   49.42   17.40 2.15e-28
#>      ENV/G3  13.00    631   48.57   17.10 5.72e-28
#>      ENV/G4  13.00    556   42.77   15.06 5.56e-25
#>      ENV/G5  13.00    491   37.78   13.30 2.77e-22
#>      ENV/G6  13.00    677   52.11   18.35 1.01e-29
#>      ENV/G7  13.00    572   44.00   15.49 1.26e-25
#>      ENV/G8  13.00    591   45.46   16.01 2.18e-26
#>      ENV/G9  13.00    918   70.61   24.86 4.27e-38
#>   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
#> # ℹ 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) "    
# }