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 the table below.
The result(s) to extract can be specified in what
.
If a single result is extracted, this result is returned as a
data.frame
, If this is not possible, because the format of the result
is incompatible with the data.frame
format, the result is returned as
a list. E.g. if BLUEs are extracted, the output of the function is a
data.frame
with BLUEs. However if varCompF is extracted, the
output of the function is a list
.
Results that are returned as data.frame
are marked as such in the
asDataFrame column in the table. If the default return value for a result
is a data.frame
that can be overridden by the user by specifying
asDataFrame = FALSE
. When doing so the result will be returned as a
list of data.frames, one per trial. They other way round is not possible.
If a result is returned as a list
according to the table, it cannot
be returned as a data.frame
.
If multiple results are extracted at the same time, these are always
returned as a list.
Most results can only be calculated if a model is fitted with genotype as
fixed or with genotype as random. E.g. to compute heritabilities a model
should be fitted with genotype as random effect. This is indicated in the
table in the column model with "F" and "R" respectively.
Possible options for what
are:
result | model | description | asDataFrame |
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 | 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 | generalized 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 |
Arguments
- STA
An object of class STA.
- trials
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.
- traits
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.
- what
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.
Ifwhat = "all"
, all available statistics are computed.- asDataFrame
Should the output be reshaped to a data.frame. This is only possible if the number of statistics to extract is one.
- keep
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.- restoreColNames
Should the original column names be restored in the output of the extracted data?
Value
Depending on the input either a data.frame or a list with, per trial for which statistics have been extracted, a list of those statistics.
Examples
## Fit model using SpATS.
modSp <- fitTD(TD = TDHeat05,
design = "res.rowcol",
traits = "yield")
#> Using SpATS for fitting models.
## Extract all available statistics from the fitted model.
extr <- extractSTA(modSp)
## Extract only the BLUEs from the fitted model.
BLUEs <- extractSTA(modSp,
what = "BLUEs")
## Extract only the BLUEs from the fitted model and keep trial as variable in
## the output.
BLUEs2 <- extractSTA(modSp,
what = "BLUEs",
keep = "trial")