Learn R Programming

BMA (version 3.18.19)

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 bicreg
predict( object, newdata, quantiles, ...)

Value

The predicted response values from the BMA model for each observation in newdata.

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

See Also

bicreg

Examples

Run this code

  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 3 (Venables and Ripley)

     gasPRbma <- bicreg( x = whiteside[,c("Insul", "Temp")], 
                         y = whiteside$Gas)
     predict( gasPRbma, newdata = whiteside)

Run the code above in your browser using DataLab