bmaPredict: BMA prediction for new data points

bmaPredictR Documentation

BMA prediction for new data points

Description

Make a Bayesian model averaged prediction for new data points, from those models saved in a BayesMfp object.

Usage

bmaPredict(BayesMfpObject, postProbs = posteriors(BayesMfpObject), newdata)

Arguments

BayesMfpObject

BayesMfp object with the models over which the predictions should be averaged

postProbs

vector of posterior probabilities, which are then normalized to the weights of the model average (defaults to the normalized posterior probability estimates)

newdata

new covariate data as data.frame

Value

The predicted values as a vector.

Note

Note that this function is not an S3 predict method for BmaSamples objects, but a function working on BayesMfp objects (because we do not need BMA samples to do BMA point predictions).

Author(s)

Daniel Saban\'es Bov\'e

See Also

BmaSamples Methods

Examples

## generate a BayesMfp object
set.seed(19)

x1 <- rnorm(n=15)
x2 <- rbinom(n=15, size=20, prob=0.5) 
x3 <- rexp(n=15)

y <- rt(n=15, df=2)

test <- BayesMfp(y ~ bfp (x2, max = 4) + uc (x1 + x3), nModels = 100,
                 method="exhaustive")

## predict new responses at (again random) covariates
bmaPredict(test,
           newdata = list(x1 = rnorm(n=15),
                          x2 = rbinom(n=15, size=5, prob=0.2) + 1,
                          x3 = rexp(n=15)))

bfp documentation built on March 19, 2024, 3:07 a.m.

Related to bmaPredict in bfp...