Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

predict.bicreg

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 bicreg.

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 c(.1,.5,.9), corresponding to the median (.5), and the 10th and 90th precentiles.

...

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)

BMA

Bayesian Model Averaging

v3.18.14
GPL (>= 2)
Authors
Adrian Raftery <raftery@uw.edu>, Jennifer Hoeting, Chris Volinsky, Ian Painter, Ka Yee Yeung
Initial release
2020-12-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.