Expected value of prediction based on 'bma' object
# S3 method for bma
predict(object, newdata = NULL, exact = FALSE, topmodels = NULL, ...)
A vector with (expected values of) fitted values.
a bma object - see bms
An optional data.frame, matrix or vector containing variables with which to predict. If omitted, then (the expected values of) the fitted values are returned.
If FALSE
(default), then prediction is based on all
models (i.e. on their MCMC frequencies in case the bms
parameter mcmc
was set to an mcmc sampler.
If TRUE
, then
prediction is based on analytical likelihoods of the best models retained in
object
- cf. bms
parameter nmodel
.
index of the models with whom to predict: for instance,
topmodels=1
predicts based solely on the best model, whereas
topmodels=1:5
predicts based on a combination of the five best
models.
Note that setting topmodels
triggers exact=TRUE
.
further arguments passed to or from other methods.
coef.bma
for obtaining coefficients,
bms
for creating bma objects, predict.lm
for a
comparable function
Check http://bms.zeugner.eu for additional help.
data(datafls)
mm=bms(datafls,user.int=FALSE)
predict(mm) #fitted values based on MCM frequencies
predict(mm, exact=TRUE) #fitted values based on best models
predict(mm, newdata=1:41) #prediction based on MCMC frequencies
predict(mm, newdata=datafls[1,], exact=TRUE) #prediction based on a data.frame
# the following two are equivalent:
predict(mm, topmodels=1:10)
predict(mm[1:10], exact=TRUE)
Run the code above in your browser using DataLab