Skip to contents

Predict the means of a waas object considering a specific number of axis.

Usage

# S3 method for class 'waas'
predict(object, naxis = 2, ...)

Arguments

object

An object of class waas

naxis

The the number of axis to be use in the prediction. If object has more than one variable, then naxis must be a vector.

...

Additional parameter for the function

Value

A list where each element is the predicted values by the AMMI model for each variable.

Details

This function is used to predict the response variable of a two-way table (for examples the yielding of the i-th genotype in the j-th environment) based on AMMI model. This prediction is based on the number of multiplicative terms used. If naxis = 0, only the main effects (AMMI0) are used. In this case, the predicted mean will be the predicted value from OLS estimation. If naxis = 1 the AMMI1 (with one multiplicative term) is used for predicting the response variable. If naxis = min(gen-1;env-1), the AMMIF is fitted and the predicted value will be the cell mean, i.e. the mean of R-replicates of the i-th genotype in the j-th environment. The number of axis to be used must be carefully chosen. Procedures based on Postdictive success (such as Gollobs's d.f.) or Predictive sucess (such as cross-validation) should be used to do this. This package provide both. waas() function compute traditional AMMI analysis showing the number of significant axis. On the other hand, cv_ammif() function provide a cross-validation, estimating the RMSPD of all AMMI-family models, based on resampling procedures.

Author

Tiago Olivoto tiagoolivoto@gmail.com

Examples

# \donttest{
library(metan)
model <- waas(data_ge,
             env = ENV,
             gen = GEN,
             rep = REP,
             resp = c(GY, HM))
#> variable GY 
#> ---------------------------------------------------------------------------
#> AMMI analysis table
#> ---------------------------------------------------------------------------
#>     Source  Df  Sum Sq Mean Sq F value   Pr(>F) Proportion Accumulated
#>        ENV  13 279.574 21.5057   62.33 0.00e+00         NA          NA
#>   REP(ENV)  28   9.662  0.3451    3.57 3.59e-08         NA          NA
#>        GEN   9  12.995  1.4439   14.93 2.19e-19         NA          NA
#>    GEN:ENV 117  31.220  0.2668    2.76 1.01e-11         NA          NA
#>        PC1  21  10.749  0.5119    5.29 0.00e+00       34.4        34.4
#>        PC2  19   9.924  0.5223    5.40 0.00e+00       31.8        66.2
#>        PC3  17   4.039  0.2376    2.46 1.40e-03       12.9        79.2
#>        PC4  15   3.074  0.2049    2.12 9.60e-03        9.8        89.0
#>        PC5  13   1.446  0.1113    1.15 3.18e-01        4.6        93.6
#>        PC6  11   0.932  0.0848    0.88 5.61e-01        3.0        96.6
#>        PC7   9   0.567  0.0630    0.65 7.53e-01        1.8        98.4
#>        PC8   7   0.362  0.0518    0.54 8.04e-01        1.2        99.6
#>        PC9   5   0.126  0.0252    0.26 9.34e-01        0.4       100.0
#>  Residuals 252  24.367  0.0967      NA       NA         NA          NA
#>      Total 536 389.036  0.7258      NA       NA         NA          NA
#> ---------------------------------------------------------------------------
#> 
#> variable HM 
#> ---------------------------------------------------------------------------
#> AMMI analysis table
#> ---------------------------------------------------------------------------
#>     Source  Df  Sum Sq Mean Sq F value   Pr(>F) Proportion Accumulated
#>        ENV  13 5710.32 439.255   57.22 1.11e-16         NA          NA
#>   REP(ENV)  28  214.93   7.676    2.70 2.20e-05         NA          NA
#>        GEN   9  269.81  29.979   10.56 7.41e-14         NA          NA
#>    GEN:ENV 117 1100.73   9.408    3.31 1.06e-15         NA          NA
#>        PC1  21  381.13  18.149    6.39 0.00e+00       34.6        34.6
#>        PC2  19  319.43  16.812    5.92 0.00e+00       29.0        63.6
#>        PC3  17  114.26   6.721    2.37 2.10e-03       10.4        74.0
#>        PC4  15   81.96   5.464    1.92 2.18e-02        7.4        81.5
#>        PC5  13   68.11   5.240    1.84 3.77e-02        6.2        87.7
#>        PC6  11   59.07   5.370    1.89 4.10e-02        5.4        93.0
#>        PC7   9   46.69   5.188    1.83 6.33e-02        4.2        97.3
#>        PC8   7   26.65   3.808    1.34 2.32e-01        2.4        99.7
#>        PC9   5    3.41   0.682    0.24 9.45e-01        0.3       100.0
#>  Residuals 252  715.69   2.840      NA       NA         NA          NA
#>      Total 536 9112.21  17.000      NA       NA         NA          NA
#> ---------------------------------------------------------------------------
#> 
#> All variables with significant (p < 0.05) genotype-vs-environment interaction
#> Done!
# Predict GY with 3 IPCA and HM with 1 IPCA
predict <- predict(model, naxis = c(3, 1))
predict
#> $GY
#> # A tibble: 140 × 7
#>    ENV   GEN       Y res_ols pred_ols res_ammi[,1] pred_ammi[,1]
#>    <chr> <chr> <dbl>   <dbl>    <dbl>        <dbl>         <dbl>
#>  1 E1    G1     2.37 -0.0843     2.45       0.0777          2.53
#>  2 E1    G10    1.97 -0.344      2.32      -0.321           2.00
#>  3 E1    G2     2.90  0.311      2.59       0.244           2.83
#>  4 E1    G3     2.89  0.0868     2.80      -0.0626          2.74
#>  5 E1    G4     2.59  0.100      2.49       0.0354          2.52
#>  6 E1    G5     2.19 -0.196      2.38      -0.0886          2.30
#>  7 E1    G6     2.30 -0.0797     2.38      -0.106           2.27
#>  8 E1    G7     2.77  0.186      2.59       0.234           2.82
#>  9 E1    G8     2.90  0.0493     2.85       0.0112          2.86
#> 10 E1    G9     2.33 -0.0307     2.36      -0.0233          2.33
#> # ℹ 130 more rows
#> 
#> $HM
#> # A tibble: 140 × 7
#>    ENV   GEN       Y res_ols pred_ols res_ammi[,1] pred_ammi[,1]
#>    <chr> <chr> <dbl>   <dbl>    <dbl>        <dbl>         <dbl>
#>  1 E1    G1     46.5   0.117     46.4      0.0381           46.4
#>  2 E1    G10    46.9  -0.923     47.8     -0.242            47.6
#>  3 E1    G2     45.3  -0.660     46.0      0.213            46.2
#>  4 E1    G3     45.9  -1.05      46.9      0.0465           47.0
#>  5 E1    G4     48.3   0.931     47.4     -0.0275           47.3
#>  6 E1    G5     49.9   1.26      48.6      0.215            48.8
#>  7 E1    G6     48.2   0.189     48.1      0.0745           48.1
#>  8 E1    G7     47.4   0.154     47.3     -0.166            47.1
#>  9 E1    G8     48.0  -0.466     48.4     -0.00568          48.4
#> 10 E1    G9     47.7   0.450     47.2     -0.146            47.1
#> # ℹ 130 more rows
#> 
# }