Predict from a BayesA Fit

Predict from a BayesA Fit

Description

Computes GEBVs and prediction metrics from a run_bayesa fit. Behaviour and return value are identical to predict.masbayes_bayesr; see that page for usage modes and examples.

Usage

## S3 method for class 'masbayes_bayesa'
predict(object, newdata = NULL, y_new = NULL, X_new = NULL, ...)

Arguments

object An object of class masbayes_bayesa.
newdata Optional numeric design matrix.
y_new Optional response vector for newdata.
Unused.

Value

An object of class masbayes_prediction.

See Also

run_bayesa, summary.masbayes_bayesa, predict.masbayes_bayesr

Examples

Code
library("masbayes")

d       <- load_data("small")
W       <- construct_snp_matrix(d$snp)$W
y_bin   <- as.numeric(d$pheno$y_bin_qtl_snp)
W_train <- W[d$train_idx, ]
W_test  <- W[d$test_idx, ]

fit  <- run_bayesa(
  w             = W_train,
  y             = y_bin[d$train_idx],
  nu            = 4.5,
  sigma2_g      = 1.0,
  sigma2_e_init = 1.0,
  mcmc_params   = list(n_iter = 1000L, n_burn = 500L,
                       n_thin = 5L, seed = 1L),
  response_type = "binary",
  save_rds      = FALSE
)
pred <- predict(fit, W_test, y_bin[d$test_idx])
pred$metrics$AUC