Skip to contents

Computes per-group mean Mrode (2014) accuracy and/or Cullis (2006) H\(^2\) from an ASReml-R V4 mixed model. Supports fa(), diag(), corgh(), corh(), us(), and single-environment id() random structures for the variety term.

Usage

accuracy(
  model,
  term = NULL,
  metric = c("accuracy", "gen.H2"),
  pworkspace = "2gb",
  by_variety = FALSE
)

Arguments

model

A fitted asreml model object.

term

Character. The full random-effect interaction term for the variety effect, written in the same format as the random = formula argument, e.g. "fa(Site, 2):id(Variety)", "corgh(Site):vm(Variety, giv1)", or "vm(Variety, giv1)" for a single-environment model. When NULL (default) the term is auto-detected from the model's random formula.

metric

Character vector: "accuracy", "gen.H2", or both (default). Controls which columns appear in the output.

pworkspace

Character. Passed to predict.asreml(). Default "2gb".

by_variety

Logical. If TRUE, return one row per variety x group instead of group-level summaries. Default FALSE.

Value

A data frame with columns group, n_vars, G_jj, and one or both of mean_acc/sd_acc (Mrode accuracy) and gen.H2 (Cullis H\(^2\)). When by_variety = TRUE the variety, pev, and present columns replace n_vars/sd_acc. The present column is TRUE for variety x group combinations observed in the data and FALSE for unobserved variety x group combinations (e.g. unobserved variety x site pairs in factor-analytic models).

Examples

if (FALSE) { # \dontrun{
acc    <- accuracy(model_fa)
acc_bv <- accuracy(model_fa, by_variety = TRUE)
accuracy(model_fa, metric = "gen.H2")
# Override auto-detection with the full term string
accuracy(model_fa, term = "fa(Site, 2):id(Variety)")
accuracy(model_vm, term = "corgh(Site):vm(Variety, giv1)")
} # }