predict.bicreg {BMA} | R Documentation |
Predict function for Bayesian Model Averaging for linear models.
Description
Bayesian Model Averaging (BMA) accounts for the model uncertainty inherent in the variable selection problem by averaging over the best models in the model class according to approximate posterior model probability. This function predicts the response resulting from a BMA linear model from given data.
Usage
## S3 method for class 'bicreg'
predict( object, newdata, quantiles, ...)
Arguments
object |
a fitted object inheriting from class |
newdata |
a data frame containing observations on variables from which the predictor variables are to be selected or constructed from a formula. |
quantiles |
The quantiles for which a predictive estimate is
desired. The default is |
... |
ignored (for compatibility with generic function). |
Value
The predicted response values from the BMA model for each observation in newdata.
See Also
Examples
library(MASS)
# Example 1
data(UScrime)
x <- UScrime[,-16]
y <- log(UScrime[,16])
x[,-2]<- log(x[,-2])
crimeBMA <- bicreg(x, y, strict = FALSE, OR = 20)
predict( crimeBMA, x)
# Example 2 (Venables and Ripley)
npkBMA <- bicreg( x = npk[, c("block","N","K")], y=npk$yield)
predict( npkBMA, newdata = npk)
# Example 2 (Venables and Ripley)
gasPRbma <- bicreg( x = whiteside[,c("Insul", "Temp")],
y = whiteside$Gas)
predict( gasPRbma, newdata = whiteside)