The function check_design_met
helps us to check the
quality of the data and also to identify the experimental design of the
trials. This works as a quality check or quality control before we fit
any model.
library(agriutilities)
library(agridat)
data(besag.met)
dat <- besag.met
results <- check_design_met(
data = dat,
genotype = "gen",
trial = "county",
traits = "yield",
rep = "rep",
block = "block",
col = "col",
row = "row"
)
print(results)
#> ---------------------------------------------------------------------
#> Summary Traits by Trial:
#> ---------------------------------------------------------------------
#> # A tibble: 6 × 11
#> county traits Min Mean Median Max SD CV n n_miss miss_perc
#> <fct> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <int> <dbl>
#> 1 C1 yield 87.9 149. 151. 200. 17.7 0.119 198 6 0.0303
#> 2 C2 yield 24.4 56.1 52.1 125. 18.4 0.328 198 6 0.0303
#> 3 C3 yield 28.2 87.9 89.2 137. 19.7 0.225 198 6 0.0303
#> 4 C4 yield 103. 145. 143. 190. 17.1 0.118 198 6 0.0303
#> 5 C5 yield 66.9 115. 116. 152. 16.4 0.142 198 6 0.0303
#> 6 C6 yield 29.2 87.6 87.8 148. 26.6 0.304 198 6 0.0303
#>
#> ---------------------------------------------------------------------
#> Experimental Design Detected:
#> ---------------------------------------------------------------------
#> county exp_design
#> 1 C1 row_col
#> 2 C2 row_col
#> 3 C3 row_col
#> 4 C4 row_col
#> 5 C5 row_col
#> 6 C6 row_col
#>
#> ---------------------------------------------------------------------
#> Summary Experimental Design:
#> ---------------------------------------------------------------------
#> # A tibble: 6 × 9
#> county n n_gen n_rep n_block n_col n_row num_of_reps num_of_gen
#> <fct> <int> <int> <int> <int> <int> <int> <fct> <fct>
#> 1 C1 198 64 3 8 11 18 3_9 63_1
#> 2 C2 198 64 3 8 11 18 3_9 63_1
#> 3 C3 198 64 3 8 11 18 3_9 63_1
#> 4 C4 198 64 3 8 11 18 3_9 63_1
#> 5 C5 198 64 3 8 11 18 3_9 63_1
#> 6 C6 198 64 3 8 11 18 3_9 63_1
#>
#> ---------------------------------------------------------------------
#> Connectivity Matrix:
#> ---------------------------------------------------------------------
#> C1 C2 C3 C4 C5 C6
#> C1 64 64 64 64 64 64
#> C2 64 64 64 64 64 64
#> C3 64 64 64 64 64 64
#> C4 64 64 64 64 64 64
#> C5 64 64 64 64 64 64
#> C6 64 64 64 64 64 64
#>
#> ---------------------------------------------------------------------
#> Filters Applied:
#> ---------------------------------------------------------------------
#> List of 1
#> $ yield:List of 4
#> ..$ missing_50% : chr(0)
#> ..$ no_variation : chr(0)
#> ..$ row_col_dup : chr(0)
#> ..$ trials_to_remove: chr(0)
The results of the previous function are used in
single_trial_analysis()
to fit single trial models.
obj <- single_trial_analysis(results, progress = FALSE)
print(obj)
#> ---------------------------------------------------------------------
#> Summary Fitted Models:
#> ---------------------------------------------------------------------
#> trait trial heritability CV VarGen VarErr design
#> <char> <char> <num> <num> <num> <num> <char>
#> 1: yield C1 0.70 6.370054 85.28086 92.70982 row_col
#> 2: yield C2 0.39 16.987235 26.87283 105.50494 row_col
#> 3: yield C3 0.64 12.366843 82.84379 118.86865 row_col
#> 4: yield C4 0.41 8.179794 35.75059 136.21686 row_col
#> 5: yield C5 0.80 7.042116 104.44077 66.96454 row_col
#> 6: yield C6 0.49 16.583972 72.16813 206.54020 row_col
#>
#> ---------------------------------------------------------------------
#> Outliers Removed:
#> ---------------------------------------------------------------------
#> Null data.table (0 rows and 0 cols)
#>
#> ---------------------------------------------------------------------
#> First Predicted Values and Standard Errors (BLUEs/BLUPs):
#> ---------------------------------------------------------------------
#> trait genotype trial BLUEs seBLUEs BLUPs seBLUPs wt
#> <char> <fctr> <fctr> <num> <num> <num> <num> <num>
#> 1: yield G01 C1 142.9316 6.380244 144.5151 5.421481 0.02456549
#> 2: yield G02 C1 156.7765 6.277083 155.0523 5.367425 0.02537957
#> 3: yield G03 C1 126.5654 6.402526 133.1766 5.444349 0.02439480
#> 4: yield G04 C1 155.7790 6.391590 154.2435 5.440070 0.02447836
#> 5: yield G05 C1 163.9856 6.443261 160.7620 5.444314 0.02408732
#> 6: yield G06 C1 129.5092 6.400364 134.7404 5.421543 0.02441129