predict.BmaSamples: Predict method to extract point and interval predictions from...

predict.BmaSamplesR Documentation

Predict method to extract point and interval predictions from BmaSamples objects

Description

Predict new responses from a Bayesian model average over FP models, from which predictive samples have already been produced.

Usage

## S3 method for class 'BmaSamples'
predict(object, level=0.95, hpd=TRUE, ...)
## S3 method for class 'predict.BmaSamples'
print(x, ...)

Arguments

object

valid BmaSamples object

level

credible level for the credible intervals (default: 95%)

hpd

should emprical hpd intervals be used (default) or simple quantile-based?

...

unused

x

object of S3 class predict.BmaSamples

Details

This function summarizes the predictive samples saved in the BmaSamples object. Using these functions, one can obtain predictive credible intervals, as opposed to just using the function bmaPredict, which only gives the means of the predictive distributions.

Value

A list of class predict.BmaSamples, which has then a separate print method. The elements of the list are:

intervalType

which credible intervals have been computed (either “HPD” or “equitailed”)

level

the credible level

newdata

the covariate data for the predicted data points (just copied from object)

sampleSize

the sample size (just copied from object)

nModels

the number of models (just copied from object)

summaryMat

the summary matrix for the predictions, with median, mean, lower and upper credible interval borders.

Author(s)

Daniel Saban\'es Bov\'e

See Also

bmaPredict

Examples

## generate a BmaSamples 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 with BMA:
testBma <- BmaSamples(test,
                      newdata=data.frame(x1 = rnorm (15),
                                         x2 = rbinom (n=15, size=5, prob=0.2) + 1,
                                         x3 = rexp (15)))
predict(testBma)

bfp documentation built on Nov. 1, 2022, 1:05 a.m.

Related to predict.BmaSamples in bfp...