Skip to contents

[Stable]

Analysis of genotypes in single experiments using mixed-effect models with estimation of genetic parameters.

Usage

gamem(
  .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 an alpha-lattice design is employed considering block as random to make use of inter-block information, whereas the complete replicate effect is always taken as fixed, as no inter-replicate information was to be recovered (Mohring et al., 2015).

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 mixed-effect model for each environment. In this case, an object of class gamem_grouped is returned. mgidi() can then be used to compute the mgidi index within each environment.

prob

The probability for estimating confidence interval for BLUP's prediction.

verbose

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

Value

An object of class gamem or gamem_grouped, which is a list with the following items for each element (variable):

  • fixed: Test for fixed effects.

  • random: Variance components for random effects.

  • LRT: The Likelihood Ratio Test for the random effects.

  • BLUPgen: The estimated BLUPS for genotypes

  • ranef: The random effects of the model

  • modellme The mixed-effect model of class lmerMod.

  • residuals The residuals of the mixed-effect model.

  • model_lm The fixed-effect model of class lm.

  • residuals_lm The residuals of the fixed-effect model.

  • 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 winner genotype, MaxGEN, the loser genotype.

  • ESTIMATES: A tibble with the values:

    • Gen_var, the genotypic variance and ;

    • rep:block_var block-within-replicate variance (if an alpha-lattice design is used by informing the block in block);

    • Res_var, the residual variance;

    • Gen (%), rep:block (%), and Res (%) the respective contribution of variance components to the phenotypic variance;

    • H2, broad-sense heritability;

    • h2mg, heritability on the entry-mean basis;

    • Accuracy, the accuracy of selection (square root of h2mg);

    • CVg, genotypic coefficient of variation;

    • CVr, residual coefficient of variation;

    • CV ratio, the ratio between genotypic and residual coefficient of variation.

  • formula The formula used to fit the mixed-model.

Details

gamem 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 (assumed to be random); \(r_j\) is the effect of the jth replicate (assumed to be fixed); 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}\).

References

Mohring, J., E. Williams, and H.-P. Piepho. 2015. Inter-block information: to recover or not to recover it? TAG. Theor. Appl. Genet. 128:1541-54. doi:10.1007/s00122-015-2530-0

Author

Tiago Olivoto tiagoolivoto@gmail.com

Examples

# \donttest{
library(metan)

# fitting the model considering an RCBD
# Genotype as random effects

rcbd <- gamem(data_g,
             gen = GEN,
             rep = REP,
             resp = c(PH, ED, EL, CL, CW, KW, NR, TKW, NKE))
#> Evaluating trait PH |=====                                       | 11% 00:00:00 
Evaluating trait ED |==========                                  | 22% 00:00:00 
Evaluating trait EL |===============                             | 33% 00:00:00 
Evaluating trait CL |====================                        | 44% 00:00:00 
Evaluating trait CW |========================                    | 56% 00:00:01 
Evaluating trait KW |=============================               | 67% 00:00:01 
Evaluating trait NR |==================================          | 78% 00:00:01 
Evaluating trait TKW |======================================     | 89% 00:00:01 
Evaluating trait NKE |===========================================| 100% 00:00:01 

#> 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    PH       ED    EL       CL       CW     KW     NR     TKW     NKE
#>  Complete    NA       NA    NA       NA       NA     NA     NA      NA      NA
#>  Genotype 0.051 2.73e-05 0.786 2.25e-06 1.24e-05 0.0253 0.0056 0.00955 0.00952
#> ---------------------------------------------------------------------------
#> Variables with nonsignificant Genotype effect
#> PH EL 
#> ---------------------------------------------------------------------------

# Likelihood ratio test for random effects
get_model_data(rcbd, "lrt")
#> Class of the model: gamem
#> Variable extracted: lrt
#> # A tibble: 9 × 8
#>   VAR   model     npar   logLik    AIC     LRT    Df `Pr(>Chisq)`
#>   <chr> <chr>    <dbl>    <dbl>  <dbl>   <dbl> <dbl>        <dbl>
#> 1 PH    Genotype     4   -0.947   9.89  3.81       1   0.0510    
#> 2 ED    Genotype     4  -91.9   192.   17.6        1   0.0000273 
#> 3 EL    Genotype     4  -55.5   119.    0.0735     1   0.786     
#> 4 CL    Genotype     4  -86.2   180.   22.4        1   0.00000225
#> 5 CW    Genotype     4 -114.    235.   19.1        1   0.0000124 
#> 6 KW    Genotype     4 -165.    339.    5.00       1   0.0253    
#> 7 NR    Genotype     4  -71.1   150.    7.67       1   0.00560   
#> 8 TKW   Genotype     4 -190.    389.    6.72       1   0.00955   
#> 9 NKE   Genotype     4 -206.    420.    6.72       1   0.00952   


# Variance components
get_model_data(rcbd, "vcomp")
#> Class of the model: gamem
#> Variable extracted: vcomp
#> # A tibble: 2 × 10
#>   Group        PH    ED     EL    CL    CW    KW    NR   TKW   NKE
#>   <chr>     <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 GEN      0.0171  5.37 0.0472  4.27 18.5   181.  1.18  841. 1982.
#> 2 Residual 0.0328  2.43 0.984   1.41  7.54  280.  1.27 1018. 2399.

# Genetic parameters
get_model_data(rcbd, "genpar")
#> Class of the model: gamem
#> Variable extracted: genpar
#> # A tibble: 11 × 10
#>    Paramet…¹      PH     ED      EL     CL     CW      KW     NR     TKW     NKE
#>    <chr>       <dbl>  <dbl>   <dbl>  <dbl>  <dbl>   <dbl>  <dbl>   <dbl>   <dbl>
#>  1 Gen_var    0.0171  5.37   0.0472  4.27  18.5   181.     1.18  8.41e+2 1.98e+3
#>  2 Gen (%)   34.3    68.8    4.58   75.1   71.0    39.2   48.2   4.52e+1 4.52e+1
#>  3 Res_var    0.0328  2.43   0.984   1.41   7.54  280.     1.27  1.02e+3 2.40e+3
#>  4 Res (%)   65.7    31.2   95.4    24.9   29.0    60.8   51.8   5.48e+1 5.48e+1
#>  5 Phen_var   0.0498  7.80   1.03    5.68  26.0   461.     2.45  1.86e+3 4.38e+3
#>  6 H2         0.343   0.688  0.0458  0.751  0.710   0.392  0.482 4.52e-1 4.52e-1
#>  7 h2mg       0.610   0.869  0.126   0.901  0.880   0.659  0.736 7.12e-1 7.13e-1
#>  8 Accuracy   0.781   0.932  0.355   0.949  0.938   0.812  0.858 8.44e-1 8.44e-1
#>  9 CVg        6.03    4.84   1.48    7.26  20.7     9.16   6.88  9.13e+0 9.52e+0
#> 10 CVr        8.35    3.26   6.76    4.18  13.2    11.4    7.14  1.00e+1 1.05e+1
#> 11 CV ratio   0.722   1.49   0.219   1.74   1.56    0.803  0.964 9.09e-1 9.09e-1
#> # … with abbreviated variable name ¹​Parameters

# random effects
get_model_data(rcbd, "ranef")
#> Class of the model: gamem
#> Variable extracted: ranef
#> $GEN
#>    GEN           PH         ED           EL         CL         CW         KW
#> 1   H1  0.018773415  2.3610811  0.020813796  2.2056449  5.3329442   6.597949
#> 2  H10 -0.078441587 -3.4773234 -0.085772984 -3.3060659 -7.4818217 -17.311524
#> 3  H11 -0.039799640 -0.7171292 -0.053041610 -1.8922680 -4.2006643  -4.019522
#> 4  H12  0.160731724 -0.1152736 -0.089465754 -2.3605323 -2.6282930   1.022669
#> 5  H13  0.263641328  2.4352270  0.090472873 -1.0499926  0.6731997  22.941732
#> 6   H2 -0.007665811  2.4004711  0.092151405  1.5266616  1.1173015   8.900057
#> 7   H3 -0.075187528 -0.6956964  0.008224807  0.1086613 -2.0755405  -5.159344
#> 8   H4 -0.071526712 -1.7847132  0.108936725 -0.6927910 -1.1569455  -2.213329
#> 9   H5 -0.043867214  1.9584925  0.003189211  1.6503314  5.2258693   9.434104
#> 10  H6 -0.008072569  1.8461152 -0.142843071  3.1109558  1.9916308  -6.425132
#> 11  H7  0.006570695  0.8086529 -0.016113907  1.5969013  5.7354166   5.832276
#> 12  H8 -0.040613155 -1.5286784  0.004867743  0.5270975  1.1054193  -3.547764
#> 13  H9 -0.084542947 -3.4912257  0.058580766 -1.4246040 -3.6385165 -16.052173
#>             NR        TKW        NKE
#> 1   0.06038462  36.368389 -30.472599
#> 2  -0.33211539 -50.194254  14.894629
#> 3   0.35475962 -20.721892  14.134550
#> 4   0.35475962 -24.282196  34.894214
#> 5   2.02288464   1.360088  79.073819
#> 6  -0.03774039  20.096643  -1.114539
#> 7  -0.72461539  13.062513 -33.417906
#> 8  -1.41149040  -7.828821   4.491045
#> 9   1.23788463  -8.706006  48.860670
#> 10  0.45288462   7.352279 -34.463015
#> 11 -0.13586539  28.730081 -19.403946
#> 12 -0.92086539  21.404122 -43.156422
#> 13 -0.92086539 -16.640945 -34.320501
#> 

# Predicted values
predict(rcbd)
#> # A tibble: 39 × 11
#>    GEN   REP      PH    ED    EL    CL    CW    KW    NR   TKW   NKE
#>    <chr> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 H1    1      2.12  50.5  14.9  31.5  26.9  156.  15.8  360.  436.
#>  2 H1    2      2.20  49.5  14.5  29.9  24.4  146.  16.1  343.  428.
#>  3 H1    3      2.24  50.7  14.6  30.6  27.1  159.  15.7  359.  449.
#>  4 H10   1      2.02  44.6  14.8  26.0  14.0  132.  15.4  274.  481.
#>  5 H10   2      2.10  43.7  14.4  24.4  11.6  122.  15.7  257.  473.
#>  6 H10   3      2.14  44.9  14.5  25.1  14.2  135.  15.3  272.  494.
#>  7 H11   1      2.06  47.4  14.9  27.4  17.3  145.  16.1  303.  481.
#>  8 H11   2      2.14  46.4  14.5  25.8  14.9  135.  16.4  286.  472.
#>  9 H11   3      2.18  47.6  14.5  26.5  17.5  148.  16.0  302.  493.
#> 10 H12   1      2.26  48.0  14.8  26.9  18.9  150.  16.1  300.  501.
#> # … with 29 more rows

# fitting the model considering an alpha-lattice design
# Genotype and block-within-replicate as random effects
# Note that block effect was now informed.

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

#> 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
# Genetic parameters
get_model_data(alpha, "genpar")
#> Class of the model: gamem
#> Variable extracted: genpar
#> # A tibble: 13 × 2
#>    Parameters      YIELD
#>    <chr>           <dbl>
#>  1 Gen_var        0.143 
#>  2 Gen (%)       48.5   
#>  3 rep:block_var  0.0702
#>  4 rep:block (%) 23.8   
#>  5 Res_var        0.0816
#>  6 Res (%)       27.7   
#>  7 Phen_var       0.295 
#>  8 H2             0.485 
#>  9 h2mg           0.798 
#> 10 Accuracy       0.893 
#> 11 CVg            8.44  
#> 12 CVr            6.38  
#> 13 CV ratio       1.32  

# Random effects
get_model_data(alpha, "ranef")
#> Class of the model: gamem
#> Variable extracted: ranef
#> $GEN
#>    GEN        YIELD
#> 1  G01  0.501183769
#> 2  G02  0.004962705
#> 3  G03 -0.784562783
#> 4  G04  0.006125660
#> 5  G05  0.474950041
#> 6  G06  0.044640383
#> 7  G07 -0.308947691
#> 8  G08  0.062229524
#> 9  G09 -0.809931603
#> 10 G10 -0.089373059
#> 11 G11 -0.196434546
#> 12 G12  0.225758446
#> 13 G13  0.231664921
#> 14 G14  0.243399964
#> 15 G15  0.424699859
#> 16 G16  0.200964673
#> 17 G17  0.078077967
#> 18 G18 -0.110180929
#> 19 G19  0.289576067
#> 20 G20 -0.338969056
#> 21 G21  0.256132122
#> 22 G22  0.024088815
#> 23 G23 -0.176997620
#> 24 G24 -0.253057630
#> 
#> $REP_BLOCK
#>    REP BLOCK        YIELD
#> 1   R1    B1  0.123136175
#> 2   R1    B2 -0.141225413
#> 3   R1    B3 -0.150394401
#> 4   R1    B4 -0.106755541
#> 5   R1    B5  0.073704281
#> 6   R1    B6  0.201534899
#> 7   R2    B1 -0.532640774
#> 8   R2    B2 -0.301232978
#> 9   R2    B3  0.243239346
#> 10  R2    B4  0.134878440
#> 11  R2    B5  0.275336937
#> 12  R2    B6  0.180419028
#> 13  R3    B1  0.050569780
#> 14  R3    B2 -0.047784038
#> 15  R3    B3  0.151079007
#> 16  R3    B4  0.053760694
#> 17  R3    B5 -0.008047649
#> 18  R3    B6 -0.199577794
#> 
#> $GEN_REP_BLOCK
#>    GEN REP BLOCK       YIELD
#> 1  G01  R1    B5  0.57488805
#> 2  G01  R2    B4  0.63606221
#> 3  G01  R3    B1  0.55175355
#> 4  G02  R1    B2 -0.13626271
#> 5  G02  R2    B5  0.28029964
#> 6  G02  R3    B2 -0.04282133
#> 7  G03  R1    B4 -0.89131832
#> 8  G03  R2    B2 -1.08579576
#> 9  G03  R3    B6 -0.98414058
#> 10 G04  R1    B1  0.12926184
#> 11 G04  R2    B1 -0.52651511
#> 12 G04  R3    B3  0.15720467
#> 13 G05  R1    B1  0.59808622
#> 14 G05  R2    B4  0.60982848
#> 15 G05  R3    B6  0.27537225
#> 16 G06  R1    B6  0.24617528
#> 17 G06  R2    B6  0.22505941
#> 18 G06  R3    B3  0.19571939
#> 19 G07  R1    B5 -0.23524341
#> 20 G07  R2    B6 -0.12852866
#> 21 G07  R3    B6 -0.50852549
#> 22 G08  R1    B4 -0.04452602
#> 23 G08  R2    B1 -0.47041125
#> 24 G08  R3    B2  0.01444549
#> 25 G09  R1    B6 -0.60839670
#> 26 G09  R2    B4 -0.67505316
#> 27 G09  R3    B2 -0.85771564
#> 28 G10  R1    B2 -0.23059847
#> 29 G10  R2    B4  0.04550538
#> 30 G10  R3    B4 -0.03561236
#> 31 G11  R1    B1 -0.07329837
#> 32 G11  R2    B3  0.04680480
#> 33 G11  R3    B1 -0.14586477
#> 34 G12  R1    B6  0.42729335
#> 35 G12  R2    B3  0.46899779
#> 36 G12  R3    B4  0.27951914
#> 37 G13  R1    B4  0.12490938
#> 38 G13  R2    B5  0.50700186
#> 39 G13  R3    B4  0.28542562
#> 40 G14  R1    B3  0.09300556
#> 41 G14  R2    B1 -0.28924081
#> 42 G14  R3    B1  0.29396974
#> 43 G15  R1    B5  0.49840414
#> 44 G15  R2    B2  0.12346688
#> 45 G15  R3    B2  0.37691582
#> 46 G16  R1    B3  0.05057027
#> 47 G16  R2    B6  0.38138370
#> 48 G16  R3    B5  0.19291702
#> 49 G17  R1    B5  0.15178225
#> 50 G17  R2    B3  0.32131731
#> 51 G17  R3    B3  0.22915697
#> 52 G18  R1    B3 -0.26057533
#> 53 G18  R2    B5  0.16515601
#> 54 G18  R3    B3  0.04089808
#> 55 G19  R1    B4  0.18282053
#> 56 G19  R2    B6  0.46999510
#> 57 G19  R3    B1  0.34014585
#> 58 G20  R1    B2 -0.48019447
#> 59 G20  R2    B1 -0.87160983
#> 60 G20  R3    B6 -0.53854685
#> 61 G21  R1    B2  0.11490671
#> 62 G21  R2    B3  0.49937147
#> 63 G21  R3    B5  0.24808447
#> 64 G22  R1    B1  0.14722499
#> 65 G22  R2    B5  0.29942575
#> 66 G22  R3    B5  0.01604117
#> 67 G23  R1    B3 -0.32739202
#> 68 G23  R2    B2 -0.47823060
#> 69 G23  R3    B4 -0.12323693
#> 70 G24  R1    B6 -0.05152273
#> 71 G24  R2    B2 -0.55429061
#> 72 G24  R3    B5 -0.26110528
#> 
# }