Skip to contents

[Stable]

Helper function that combines objects of class cv_ammi, cv_ammif or cv_blup. It is useful when looking for a boxplot containing the RMSPD values of those cross-validation procedures.

Usage

bind_cv(..., bind = "boot", sort = TRUE)

Arguments

...

Input objects of class cv_ammi, cv_ammif or cv_blup.

bind

What data should be used? To plot the RMSPD, use 'boot' (default). Use bind = 'means' to return the RMSPD mean for each model.

sort

Used to sort the RMSPD mean in ascending order.

Value

An object of class cv_ammif. The results will depend on the argument bind. If bind = 'boot' then the RMSPD of all models in ... will be bind to a unique data frame. If bind = 'means'

then the RMSPD mean of all models in ... will be bind to an unique data frame.

Author

Tiago Olivoto tiagoolivoto@gmail.com

Examples

# \donttest{
library(metan)
# Two examples with only 5 resampling procedures
AMMI <- cv_ammi(data_ge,
                resp = GY,
                gen = GEN,
                env = ENV,
                rep = REP,
                nboot = 5)
#> Validating 1 of 5 sets |========                                 | 20% 00:00:00 
Validating 2 of 5 sets |================                         | 40% 00:00:01 
Validating 3 of 5 sets |=========================                | 60% 00:00:01 
Validating 4 of 5 sets |=================================        | 80% 00:00:02 
Validating 5 of 5 sets |=========================================| 100% 00:00:02 

BLUP <- cv_blup(data_ge,
                resp = GY,
                gen = GEN,
                env = ENV,
                rep = REP,
                nboot = 5)
#> Validating 1 of 5 sets |========                                 | 20% 00:00:00 
Validating 2 of 5 sets |================                         | 40% 00:00:01 
Validating 3 of 5 sets |=========================                | 60% 00:00:01 
Validating 4 of 5 sets |=================================        | 80% 00:00:02 
Validating 5 of 5 sets |=========================================| 100% 00:00:03 

bind_data <- bind_cv(AMMI, BLUP)
plot(bind_data)


print(bind_cv(AMMI, BLUP, bind = 'means'))
#> $RMSPD
#>         MODEL      mean         sd         se      Q2.5     Q97.5
#> 1       AMMI2 0.4069525 0.02772920 0.01240087 0.3836402 0.4492184
#> 2 BLUP_g_RCBD 0.4199862 0.01650855 0.00738285 0.4020702 0.4418741
#> 
#> attr(,"class")
#> [1] "cvalidation"
# }