This function predicts outcomes (Y) given the observed
variables (X) and observed covariates (Z), and a model fitted using
varbvs
.
# S3 method for varbvs predict(object, X, Z = NULL, …)
object | Output of function |
---|---|
X | n x p input matrix, in which p is the number of variables, and n is the number of samples for which predictions will be made using the fitted model. X cannot be sparse, and cannot have any missing values (NA). |
Z | n x m covariate data matrix, where m is the number of
covariates. Do not supply an intercept as a covariate
(i.e., a column of ones), because an intercept is
automatically included in the regression model. For no
covariates, set |
… | Other arguments to generic predict function. These extra arguments are not used here. |
For the logistic regression model, we do not provide classification
probabilities \(Pr(Y = 1 | X, Z)\) because these probabilities are not
necessarily calibrated under the variational approximation.
The predictions are computed by averaging over the hyperparameter
settings, treating object$logw
as (unnormalized) log-marginal
probabilities. See varbvs
for more details about
correctly using object$logw
for approximate numerical integration
over the hyperparameters, for example by treating these as importance
weights.
Vector containing the predicted outcomes for all samples. For
family = "binomial"
, all vector entries are 0 or 1.
P. Carbonetto and M. Stephens (2012). Scalable variational inference for Bayesian variable selection in regression, and its accuracy in genetic association studies. Bayesian Analysis 7, 73--108.
# See help(varbvs) for examples.