predict.pep {PEPBVS} | R Documentation |
Prediction under PEP approach
Description
Computes predicted or fitted values under the PEP approach. Predictions can be based on Bayesian model averaging, maximum a posteriori model or median probability model. For the Bayesian model averaging, a subset of the top models (either based on explicit number or on their cumulative probability) can be used for prediction.
Usage
## S3 method for class 'pep'
predict(
object,
xnew,
estimator = "BMA",
n.models = NULL,
cumul.prob = 0.99,
...
)
Arguments
object |
An object of class pep (e.g. output of |
xnew |
A matrix of numeric (with p columns), the new data to be used for prediction.
This matrix contains the values of the explanatory variables
without an intercept column of 1's, i.e. the number of its columns
coincides with the number of columns of |
estimator |
A character, the type of prediction. One of "BMA" (Bayesian model averaging, default), "MAP" (maximum a posteriori model) or "MPM" (median probability model). |
n.models |
Positive integer, the number of (top) models that
prediction is based on or |
cumul.prob |
Numeric between 0 and 1, cumulative probability of
top models to be used for prediction. Relevant for |
... |
Additional parameters to be passed, currently none. |
Details
When xnew
is missing or xnew
=object$x
then fitted
values are computed (and returned).
For prediction, Equation 9 of Fouskakis and Ntzoufras (2020) is used.
The case of missing data (i.e. presence of NA’s) in the new data matrix is not currently supported.
Let k be the number of models with cumulative posterior probability up
to the given value of cumul.prob
. Then, for Bayesian model averaging
the prediction is based on the top (k+1) models if they exist, otherwise
on the top k models.
When both n.models
and cumul.prob
are provided - once
specifying the number of models for the given cumulative probability as
described above - the minimum between the two numbers is used for prediction.
Value
predict
returns a vector with the predicted (or fitted)
values for the different observations.
References
Fouskakis, D. and Ntzoufras, I. (2022) Power-Expected-Posterior Priors as Mixtures of g-Priors in Normal Linear Models. Bayesian Analysis, 17(4): 1073-1099. doi:10.1214/21-BA1288
Fouskakis, D. and Ntzoufras, I. (2020) Bayesian Model Averaging Using Power-Expected-Posterior Priors. Econometrics, 8(2): 17. doi:10.3390/econometrics8020017
Examples
data(UScrime_data)
y <- UScrime_data[,"y"]
X <- UScrime_data[,-15]
set.seed(123)
res <- mc3_pep(X[1:45,],y[1:45],intrinsic=TRUE,itermc3=4000)
resf <- predict(res)
resf2 <- predict(res,estimator="MPM")
resp <- predict(res,xnew=X[46:47,])