Skip to contents

[Stable]

One-way analysis of variance of genotypes conducted in both randomized complete block and alpha-lattice designs.

Usage

gafem(
  .data,
  gen,
  rep,
  resp,
  block = NULL,
  by = NULL,
  prob = 0.05,
  verbose = TRUE
)

Arguments

.data

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

gen

The name of the column that contains the levels of the genotypes, that will be treated as random effect.

rep

The name of the column that contains the levels of the replications (assumed to be fixed).

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). Select helpers are also allowed.

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. Use the function gamem() to analyze a one-way trial with mixed-effect models.

by

One variable (factor) to compute the function by. It is a shortcut to dplyr::group_by().This is especially useful, for example, when the researcher want to fit a fixed-effect model for each environment. In this case, an object of class gafem_grouped is returned. mgidi() can then be used to compute the mgidi index within each environment.

prob

The error probability. Defaults to 0.05.

verbose

Logical argument. If verbose = FALSE the code are run silently.

Value

A list where each element is the result for one variable containing the following objects:

  • anova: The one-way ANOVA table.

  • model: The model with of 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.

  • hsd: The Tukey's 'Honest Significant Difference' for genotype effect.

  • 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.

Details

gafem analyses data from a one-way genotype testing experiment. By default, a randomized complete block design is used according to the following model: \[Y_{ij} = m + g_i + r_j + e_{ij}\] where \(Y_{ij}\) is the response variable of the ith genotype in the jth block; m is the grand mean (fixed); \(g_i\) is the effect of the ith genotype; \(r_j\) is the effect of the jth replicate; and \(e_{ij}\) is the random error.

When block is informed, then a resolvable alpha design is implemented, according to the following model:

\[Y_{ijk} = m + g_i + r_j + b_{jk} + e_{ijk}\] where where \(y_{ijk}\) is the response variable of the ith genotype in the kth block of the jth replicate; m is the intercept, \(t_i\) is the effect for the ith genotype \(r_j\) is the effect of the jth replicate, \(b_{jk}\) is the effect of the kth incomplete block of the jth replicate, and \(e_{ijk}\) is the plot error effect corresponding to \(y_{ijk}\). All effects, except the random error are assumed to be fixed.

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)
# RCBD
rcbd <- gafem(data_g,
             gen = GEN,
             rep = REP,
             resp = c(PH, ED, EL, CL, CW))
#> Evaluating trait PH |=========                                   | 20% 00:00:00 
Evaluating trait ED |==================                          | 40% 00:00:00 
Evaluating trait EL |==========================                  | 60% 00:00:00 
Evaluating trait CL |===================================         | 80% 00:00:01 
Evaluating trait CW |============================================| 100% 00:00:01 

#> ---------------------------------------------------------------------------
#> One-way ANOVA table (Randomized complete block design)
#> ---------------------------------------------------------------------------
#>      model     PH       ED    EL       CL       CW
#>        REP 0.2328 1.40e-01 0.532 9.45e-03 4.10e-02
#>        GEN 0.0239 1.38e-05 0.373 1.18e-06 6.34e-06
#>  Residuals     NA       NA    NA       NA       NA
#> ---------------------------------------------------------------------------
#> Variables with nonsignificant genotype effect
#> EL 
#> ---------------------------------------------------------------------------
#> 

# Fitted values
get_model_data(rcbd)
#> Class of the model: gafem
#> Variable extracted: fitted
#> # A tibble: 39 × 8
#>    GEN   REP   factors    PH    ED    EL    CL    CW
#>    <fct> <fct> <chr>   <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 H1    1     H1_1     2.13  50.8  15.1  31.7  27.6
#>  2 H1    2     H1_2     2.21  49.9  14.7  30.1  25.2
#>  3 H1    3     H1_3     2.25  51.1  14.7  30.9  27.8
#>  4 H10   1     H10_1    1.97  44.1  14.2  25.6  13.0
#>  5 H10   2     H10_2    2.05  43.2  13.8  24.0  10.6
#>  6 H10   3     H10_3    2.09  44.4  13.9  24.7  13.2
#>  7 H11   1     H11_1    2.03  47.3  14.5  27.2  16.7
#>  8 H11   2     H11_2    2.11  46.3  14.1  25.6  14.3
#>  9 H11   3     H11_3    2.16  47.5  14.2  26.3  16.9
#> 10 H12   1     H12_1    2.36  48.0  14.2  26.6  18.5
#> # … with 29 more rows

# ALPHA-LATTICE DESIGN
alpha <- gafem(data_alpha,
              gen = GEN,
              rep = REP,
              block = BLOCK,
              resp = YIELD)
#> Evaluating trait YIELD |=========================================| 100% 00:00:00 

#> ---------------------------------------------------------------------------
#> One-way ANOVA table (Alpha-lattice design)
#> ---------------------------------------------------------------------------
#>       model    YIELD
#>         REP 6.59e-09
#>         GEN 3.63e-07
#>  BLOCK(REP) 6.25e-03
#>   Residuals       NA

# Fitted values
get_model_data(alpha)
#> Class of the model: gafem
#> Variable extracted: fitted
#> # A tibble: 72 × 5
#>    GEN   REP   BLOCK factors   YIELD
#>    <fct> <fct> <fct> <chr>     <dbl>
#>  1 G11   R1    B1    G11_R1_B1  4.41
#>  2 G04   R1    B1    G04_R1_B1  4.73
#>  3 G05   R1    B1    G05_R1_B1  5.23
#>  4 G22   R1    B1    G22_R1_B1  4.65
#>  5 G21   R1    B2    G21_R1_B2  4.61
#>  6 G10   R1    B2    G10_R1_B2  4.21
#>  7 G20   R1    B2    G20_R1_B2  4.04
#>  8 G02   R1    B2    G02_R1_B2  4.32
#>  9 G23   R1    B3    G23_R1_B3  4.11
#> 10 G14   R1    B3    G14_R1_B3  4.70
#> # … with 62 more rows

# }