
Last chance! 50% off unlimited learning
Sale ends in
Predictions under model averaging or other estimators from a BMA object of class inheriting from 'bas'.
# S3 method for bas
predict(
object,
newdata,
se.fit = FALSE,
type = "link",
top = NULL,
estimator = "BMA",
na.action = na.pass,
...
)
a list of
fitted values based on the selected estimator
predictions using BMA, the same as fit for non-BMA methods for compatibility; will be deprecated
matrix of predictions under each model for BMA
se of fitted values; in the case of BMA this will be a matrix
se for predicted values; in the case of BMA this will be a matrix
vector of posterior sd under BMA for posterior mean of the regression function. This will be NULL if estimator is not 'BMA'
vector of posterior sd under BMA for posterior predictive values. this will be NULL if estimator is not 'BMA'
index of top models included
subset of bestmodels used for fitting or prediction
names of variables in the top model; NULL if estimator='BMA'
scalar or vector of degrees of freedom for models
estimator upon which 'fit' is based.
An object of class BAS, created by bas
dataframe for predictions. If missing, then use the dataframe used for fitting for obtaining fitted and predicted values.
indicator for whether to compute se of fitted and predicted values
Type of predictions required. "link" which is on the scale of the linear predictor is the only option currently for linear models, which for the normal model is equivalent to type='response'.
a scalar integer M. If supplied, subset the top M models, based on posterior probabilities for model predictions and BMA.
estimator used for predictions. Currently supported
options include:
'HPM' the highest probability model
'BMA' Bayesian
model averaging, using optionally only the 'top' models
'MPM' the median
probability model of Barbieri and Berger.
'BPM' the model that is
closest to BMA predictions under squared error loss. BMA may be computed
using only the 'top' models if supplied
function determining what should be done with missing values in newdata. The default is to predict NA.
optional extra arguments
Merlise Clyde
Use BMA and/or model selection to form predictions using the top highest probability models.
bas
, fitted.bas
,
confint.pred.bas
, variable.names.pred.bas
Other predict methods:
fitted.bas()
,
predict.basglm()
,
variable.names.pred.bas()
Other bas methods:
BAS
,
bas.lm()
,
coef.bas()
,
confint.coef.bas()
,
confint.pred.bas()
,
diagnostics()
,
fitted.bas()
,
force.heredity.bas()
,
image.bas()
,
plot.confint.bas()
,
predict.basglm()
,
summary.bas()
,
update.bas()
,
variable.names.pred.bas()
data("Hald")
hald.gprior = bas.lm(Y ~ ., data=Hald, alpha=13, prior="g-prior")
predict(hald.gprior, newdata=Hald, estimator="BPM", se.fit=TRUE)
# same as fitted
fitted(hald.gprior,estimator="BPM")
# default is BMA and estimation of mean vector
hald.bma = predict(hald.gprior, top=5, se.fit=TRUE)
confint(hald.bma)
hald.bpm = predict(hald.gprior, newdata=Hald[1,],
se.fit=TRUE,
estimator="BPM")
confint(hald.bpm)
# extract variables
variable.names(hald.bpm)
hald.hpm = predict(hald.gprior, newdata=Hald[1,],
se.fit=TRUE,
estimator="HPM")
confint(hald.hpm)
variable.names(hald.hpm)
hald.mpm = predict(hald.gprior, newdata=Hald[1,],
se.fit=TRUE,
estimator="MPM")
confint(hald.mpm)
variable.names(hald.mpm)
Run the code above in your browser using DataLab