| predict.BmaSamples | R Documentation |
Predict new responses from a Bayesian model average over FP models, from which predictive samples have already been produced.
## S3 method for class 'BmaSamples'
predict(object, level=0.95, hpd=TRUE, ...)
## S3 method for class 'predict.BmaSamples'
print(x, ...)
object |
valid |
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 |
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.
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 |
sampleSize |
the sample size (just copied from |
nModels |
the number of models (just copied from |
summaryMat |
the summary matrix for the predictions, with median, mean, lower and upper credible interval borders. |
Daniel Saban\'es Bov\'e
bmaPredict
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.