Skip to contents

The results of the check_design_met() function are used in single_trial_analysis() to fit single trial models. This function can fit, Completely Randomized Designs (CRD), Randomized Complete Block Designs (RCBD), Resolvable Incomplete Block Designs (res-IBD), Non-Resolvable Row-Column Designs (Row-Col) and Resolvable Row-Column Designs (res-Row-Col).

Returns an object of class smaAgri, with a list of trial summary, BLUEs, BLUPs, heritability, variance components, potential extreme observations, residuals, the models fitted and the data used. This function will generate the required output to be used in the two-stage analysis.

Usage

single_trial_analysis(
  results = NULL,
  progress = TRUE,
  engine = "asreml",
  remove_outliers = TRUE
)

Arguments

results

Object of class checkAgri resulting of executing check_design_met() function.

progress

Should the progress of the modeling be printed. If TRUE, for every trial a line is output indicating the traits fitted for the particular trial.

engine

A character string specifying the name of the mixed modeling engine to use, either lme4 or asreml. For spatial designs, SpATS is always used, for other designs asreml as a default.

remove_outliers

Should outliers be removed? TRUE by default.

Value

An object of class smaAgri, with a list of:

fitted_models

A list containing the fitted models. (Both models, the one with Genotype as Random and the one with Genotype as Fixed)

resum_fitted_model

A data.frame containing a summary of the fitted models.

outliers

A data.frame containing extreme observations. If remove_outliers is TRUE, this data.frame will contain the observations removed.

blues_blups

A data.frame containing BLUPs/BLUEs for all the genotypes in each trial.

std_residuals

A data.frame containing the standardized residuals for the model with genotype as random component.

data

A data.frame containing the data used. If remove_outliers is TRUE, data will have missing values for the outliers detected.

Examples

# \donttest{
library(agridat)
library(agriutilities)
data(besag.met)
dat <- besag.met
results <- check_design_met(
  data = dat,
  genotype = "gen",
  trial = "county",
  traits = c("yield"),
  rep = "rep",
  block = "block",
  col = "col",
  row = "row"
)
out <- single_trial_analysis(results, progress = FALSE)
print(out)
#> ---------------------------------------------------------------------
#> Summary Fitted Models:
#> ---------------------------------------------------------------------
#>     trait  trial heritability        CV    VarGen    VarErr  design
#>    <char> <char>        <num>     <num>     <num>     <num>  <char>
#> 1:  yield     C1         0.73  6.022489  87.39848  82.86095 row_col
#> 2:  yield     C2         0.37 17.104998  25.80684 108.68546 row_col
#> 3:  yield     C3         0.64 12.357202  83.57907 118.55567 row_col
#> 4:  yield     C4         0.41  8.179408  35.75568 136.21218 row_col
#> 5:  yield     C5         0.80  7.037586 103.79822  66.97523 row_col
#> 6:  yield     C6         0.49 16.632367  71.92232 207.53073 row_col
#> 
#> ---------------------------------------------------------------------
#> Outliers Removed:
#> ---------------------------------------------------------------------
#>     trait  trial genotype    id outlier
#>    <char> <fctr>   <fctr> <int>  <lgcl>
#> 1:  yield     C1      G60    50    TRUE
#> 
#> ---------------------------------------------------------------------
#> 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 141.4161 6.078858 143.5308 5.249771 0.02706176
#> 2:  yield      G02     C1 157.8110 5.979708 155.8037 5.194547 0.02796663
#> 3:  yield      G03     C1 127.3836 6.091534 133.0256 5.269999 0.02694925
#> 4:  yield      G04     C1 154.8445 6.093866 153.8364 5.270427 0.02692863
#> 5:  yield      G05     C1 163.8950 6.132141 161.1831 5.271809 0.02659352
#> 6:  yield      G06     C1 128.5168 6.087902 133.6857 5.247130 0.02698141
#> 
# }