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)
#> Warning: package 'agridat' was built under R version 4.4.2
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
The results of the previous function are used in
met_analysis()
to fit multi-environmental trial models.
#> Online License checked out Fri Jan 17 13:48:39 2025
#> Fitting MET model for yield.
#> ---------------------------------------------------------------------
#> Trial Effects (BLUEs):
#> ---------------------------------------------------------------------
#> trait trial predicted.value std.error status
#> 1 yield C1 149.58855 1.374709 Estimable
#> 2 yield C2 67.20519 1.135676 Estimable
#> 3 yield C3 90.80064 1.444905 Estimable
#> 4 yield C4 148.12440 1.203151 Estimable
#> 5 yield C5 122.40153 1.438032 Estimable
#> 6 yield C6 88.35130 1.530783 Estimable
#>
#> ---------------------------------------------------------------------
#> Heritability:
#> ---------------------------------------------------------------------
#> trait h2
#> 1 yield 0.824676
#>
#> ---------------------------------------------------------------------
#> First Overall Predicted Values and Standard Errors (BLUPs):
#> ---------------------------------------------------------------------
#> trait genotype predicted.value std.error status
#> 1 yield G01 110.8726 2.543835 Estimable
#> 2 yield G02 111.0740 2.555394 Estimable
#> 3 yield G03 102.8086 2.556853 Estimable
#> 4 yield G04 116.0421 2.552859 Estimable
#> 5 yield G05 121.0498 2.563815 Estimable
#> 6 yield G06 109.2002 2.576279 Estimable
#>
#> ---------------------------------------------------------------------
#> Variance-Covariance Matrix:
#> ---------------------------------------------------------------------
#>
#> Correlation Matrix ('us'): yield
#> C1 C2 C3 C4 C5 C6
#> C1 1.00 0.67 0.63 0.69 0.96 0.48
#> C2 0.67 1.00 0.57 0.70 0.54 0.76
#> C3 0.63 0.57 1.00 0.95 0.71 0.27
#> C4 0.69 0.70 0.95 1.00 0.74 0.46
#> C5 0.96 0.54 0.71 0.74 1.00 0.34
#> C6 0.48 0.76 0.27 0.46 0.34 1.00
#>
#> Covariance Matrix ('us'): yield
#> C1 C2 C3 C4 C5 C6
#> C1 79.82 30.44 50.21 33.48 86.30 35.17
#> C2 30.44 26.09 25.84 19.42 27.74 31.93
#> C3 50.21 25.84 79.24 45.89 63.94 20.14
#> C4 33.48 19.42 45.89 29.30 40.64 20.65
#> C5 86.30 27.74 63.94 40.64 101.79 27.92
#> C6 35.17 31.93 20.14 20.65 27.92 68.10
#>
#> ---------------------------------------------------------------------
#> First Stability Coefficients:
#> ---------------------------------------------------------------------
#> trait genotype superiority static wricke predicted.value
#> 1 yield G57 22.82799 31.96023 14.021231 92.59577
#> 2 yield G29 17.38531 33.69133 5.079065 99.63303
#> 3 yield G34 17.37005 32.77775 8.637229 99.95851
#> 4 yield G59 17.05744 33.96539 5.068193 100.07485
#> 5 yield G31 16.09429 32.03412 10.289722 102.02500
#> 6 yield G10 15.77663 31.68227 11.579487 102.72633