Skip to contents

Predictions are made based on the fitted model in the varComp object. These predictions can be at genotype level, at genotype x trial level or at the level of genotype x nestingFactor. If the model was fitted with trial as year x location then genotype x trial level becomes genotype x year x location.

Usage

# S3 method for varComp
predict(object, ..., predictLevel = "genotype")

Arguments

object

An object of class varComp.

...

Not used.

predictLevel

A character string, the level at which prediction should be made. Either "genotype" for prediction at genotype level, "trial" for predictions at genotype x trial level, the variable used as nesting factor for predictions at the level of genotype x nestingFactor level, or one or more of the extra terms used in the model. E.g. c("region", "year") for a model fitted with regionLocationYear = TRUE.

Value

A data.frame with predictions.

See also

Other Mixed model analysis: CRDR(), correlations(), diagnostics(), gxeVarComp(), herit(), plot.varComp(), vc()

Examples

## Fit a mixed model.
geVarComp <- gxeVarComp(TD = TDMaize, trait = "yld")

## Predictions at genotype level.
predGeno <- predict(geVarComp)
head(predGeno)
#>   genotype predictedValue
#> 1     G001       500.1561
#> 2     G002       479.8132
#> 3     G003       471.3800
#> 4     G004       346.9103
#> 5     G005       466.8594
#> 6     G006       425.9303

## Predictions at genotype x trial level.
predGenoTrial <- predict(geVarComp, predictLevel = "trial")
head(predGenoTrial)
#>   genotype trial predictedValue
#> 1     G001 HN96b       529.1555
#> 2     G002 HN96b       508.8126
#> 3     G003 HN96b       500.3794
#> 4     G004 HN96b       375.9096
#> 5     G005 HN96b       495.8588
#> 6     G006 HN96b       454.9297