Computes genomic estimated breeding values (GEBVs) and prediction metrics. Works identically for full-fit, train/test split, and k-fold CV — the caller is responsible for data partitioning; predict() only evaluates the trained model on whatever data it receives.
Usage
## S3 method for class 'masbayes_bayesr'
predict(object, newdata = NULL, y_new = NULL, X_new = NULL, ...)
Arguments
object
An object of class masbayes_bayesr.
newdata
Optional numeric design matrix. If NULL, the training GEBVs (object$pred_train) are returned.
y_new
Optional response vector for newdata. When supplied, prediction metrics are computed.
…
Unused.
Details
GEBV formula (direct marker effects). The genomic estimated breeding value for individual \(i\) is obtained by summing the posterior mean allele effects across all loci:
where \(\mathbf{w}_i\) is row \(i\) of the marker design matrix \(W\) and \(\hat{\boldsymbol{\beta}}\) is the vector of posterior mean allele effects. When fixed effects were supplied to the fitting function:
For test sets built with construct_wah_matrix, pass the training matrix structure as reference_structure so that newdata has identical columns to the training matrix.
Value
An object of class masbayes_prediction: a list with GEBV (liability scale for binary), prob (binary only: P(y = 1) = pnorm(GEBV), otherwise NULL), metrics (R2, RMSE, accuracy/AUC, bias or NULL; for binary, computed on the observed/probability scale so bias is the calibration slope), h2, sigma2_g, sigma2_e, variance_components, response_type, model_type, eval_scope, and has_truth.