STAtoTD: Convert STA to TD

View source: R/createSTA.R

STAtoTDR Documentation

Convert STA to TD

Description

Convert an STA object to a TD object.
To be able to use the output of a single trial analysis in Genotype-by-Environment (GxE) analysis the output first needs to be converted back to an TD object. This function does exactly that. It extracts BLUEs, BLUPs and their standard errors from the STA object and creates a new TD object using these. Also a column "wt" (weight) may also be added. Weights are then calculated as 1/(SE BLUEs) ^ 2.

Usage

STAtoTD(
  STA,
  what = c("BLUEs", "seBLUEs", "BLUPs", "seBLUPs"),
  traits = NULL,
  keep = NULL,
  addWt = FALSE
)

Arguments

STA

An object of class STA.

what

A character string containing the statistics to be included as traits in the TD object. Multiple statistics can be included in which case they will appear as statistic_trait in the output

traits

A character string containing the traits to be included in the TD object. If NULL, all traits are exported.

keep

Columns from the TD object used as input for the STA model to be copied to the output. see extractSTA for possible columns to copy. If if it is available in TD, the column trial will always be copied.

addWt

Should a column wt be added to the output? If TRUE weight is calculated as 1/(SE BLUEs) ^ 2. If multiple traits are included in the output, multiple weight columns will be added, 1 for each trait. These will be named wt_trait.

Details

Trial information for the trials in the STA object will be copied from the original TD object on which the modeling was done.

See Also

Other functions for STA objects: STAtoCross(), plot.STA(), report.STA(), summary.STA()

Examples

## Fit model using SpATS.
modSp <- fitTD(TD = TDHeat05,
               design = "res.rowcol",
               traits = "yield",
               what = "fixed")

## Create TD object from the fitted model with BLUEs and standard errors.
TDRes <- STAtoTD(modSp,
                 what = c("BLUEs", "seBLUEs"))

## Add a weight column in the output.
TDResWt <- STAtoTD(modSp,
                   what = c("BLUEs", "seBLUEs"),
                   addWt = TRUE)


statgenSTA documentation built on Oct. 14, 2024, 9:10 a.m.