Extract and calculate various results for fitted models such as BLUEs, BLUPs,
unit errors and heritabilities. For a full list of results that can be
extracted, see Details.
The result(s) to extract are specified in what. If a single result is
extracted, if possible, this result is returned as a data.frame. If this is
not possible, the result is returned as a list. If multiple results are
extracted at the same time, these are always returned as a list. Where
relevant, this behavior can be changed by specifying asDataFrame.
Results that are returned as data.frame are marked as such in the data.frame
column in the table in Details.
Most results can only be calculated if a model is fitted with genotype as
fixed or with genotype as random. E.g. to compute heritabilies a model should
be fitted with genotype as random effect. This is indicated in the list
in Details with "F" and "R" respectively.
extractSTA(
STA,
trials = names(STA),
traits = NULL,
what = "all",
asDataFrame = length(what) == 1 && what != "all",
keep = NULL,
restoreColNames = FALSE
)An object of class STA.
A character vector of trials for which the statistics should be computed. If not supplied, statistics are computed for all trials that have been modeled.
A character vector of traits for which the statistics should be computed. If not supplied, statistics are computed for all traits that have been modeled.
A character vector indicating which statistics should be
computed. Most statistics are available for all models, some only for models
fitted using a certain engine. If this is the case, this is indicated in the
list with options in details.
If what = "all", all available statistics are computed.
Should the output be reshaped to a data.frame. This is only possible if the number of statistics to extract is one.
A character vector of column(s) in the object of class
TD used for modeling. These columns will be kept as output when
computing fitted values, residuals, standardized residuals and rMeans.
Columns can also be kept when computing (se)BLUEs and (se)BLUPs but only if
the column to keep contains unique values for the modeled variables, i.e. a
column repId with several different values per genotype cannot be kept.
Should the original column names be restored in the output of the extracted data?
A list with, per trial for which statistics have been extracted, a list of those statistics.
Possible options for what are:
| result | model | description | data.frame |
| BLUEs | F | Best Linear Unbiased Estimators | yes |
| seBLUEs | F | standard errors of the BLUEs | yes |
| ue | F | unit errors - only for lme4 and asreml | yes |
| varCompF | F | variance components for the model with genotype as fixed component | |
| fitted | F | fitted values for the model with genotype as fixed component | yes |
| residF | F | residuals for the model with genotype as fixed component | yes |
| stdResF | F | standardized residuals for the model with genotype as fixed component | yes |
| wald | F | results of the wald test - only for lme4 and asreml | |
| CV | F | Coefficient of Variation - only for lme4 and asreml | yes |
| rDfF | F | residual degrees of freedom for the model with genotype as fixed component | yes |
| sed | F | standard error of difference - only for asreml | |
| lsd | F | least significant difference - only for asreml | |
| BLUPs | R | Best Linear Unbiased Predictors | yes |
| seBLUPs | R | standard errors of the BLUPs | yes |
| heritability | R | broad sense heritability | yes |
| varCompR | R | variance components for the model with genotype as random component | |
| varGen | R | genetic variance component | yes |
| varErr | R | residual variance component | yes |
| varSpat | R | spatial variance components - only for SpATS | |
| rMeans | R | fitted values for the model with genotype as random component | yes |
| ranEf | R | random genetic effects | yes |
| residR | R | residuals for the model with genotype as random component | yes |
| stdResR | R | standardized residuals for the model with genotype as random component | yes |
| rDfR | R | residual degrees of freedom for the model with genotype as random component | yes |
| effDim | R | effective dimensions - only for SpATS | |
| ratEffDim | R | ratios of the effective dimensions - only for SpATS |
# NOT RUN {
## Fit model using SpATS.
myModel <- fitTD(TD = TDHeat05, design = "res.rowcol", traits = "yield")
## Extract all available statistics from the fitted model.
extr <- extractSTA(myModel)
## Extract only the BLUEs from the fitted model.
BLUEs <- extractSTA(myModel, what = "BLUEs")
## Extract only the BLUEs from the fitted model and keep trial as variable in
## the output.
BLUEs2 <- extractSTA(myModel, what = "BLUEs", keep = "trial")
# }
Run the code above in your browser using DataLab