predict.bicreg {BMA} | R Documentation |
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.
## S3 method for class 'bicreg'
predict( object, newdata, quantiles, ...)
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). |
The predicted response values from the BMA model for each observation in newdata.
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)