predict.basglm {BAS}R Documentation

Prediction Method for an Object of Class basglm


Predictions under model averaging from a BMA (BAS) object for GLMs under different loss functions.


## S3 method for class 'basglm'
  newdata, = FALSE,
  type = c("response", "link"),
  top = NULL,
  estimator = "BMA",
  na.action = na.pass,



An object of class "basglm", created by bas.glm


dataframe, new matrix or vector of data for predictions. May include a column for the intercept or just the predictor variables. If a dataframe, the variables are extracted using model.matrix using the call that created 'object'. May be missing in which case the data used for fitting will be used for prediction.

indicator for whether to compute se of fitted and predicted values


Type of predictions required. The default is "response" is on the scale of the response variable, with the alternative being on the linear predictor scale, ‘type =’link''. Thus for a default binomial model ‘type = ’response'' gives the predicted probabilities, while with ''link'', the estimates are of log-odds (probabilities on logit scale).


A scalar integer M. If supplied, calculate results using the subset of the top M models based on posterior probabilities.


estimator used for predictions. Currently supported options include:
'HPM' the highest probability model
'BMA' Bayesian model averaging, using optionally only the 'top' models
'MPM' the median probability model of Barbieri and Berger.
'BPM' the model that is closest to BMA predictions under squared error loss. BMA may be computed using only the 'top' models if supplied


function determining what should be done with missing values in newdata. The default is to predict NA.


optional extra arguments


This function first calls the predict method for class bas (linear models) to form predictions on the linear predictor scale for 'BMA', 'HPM', 'MPM' etc. If the estimator is 'BMA' and ‘type=’response'' then the inverse link is applied to fitted values for type equal ''link'' and model averaging takes place in the 'response' scale. Thus applying the inverse link to BMA estimate with ‘type = ’link'' is not equal to the fitted values for ‘type = ’response'' under BMA due to the nonlinear transformation under the inverse link.


a list of


predictions using BMA or other estimators


matrix of predictions under model(s)


renormalized probabilities of the top models


index of top models included


Merlise Clyde

See Also

bas.glm, predict.bas, fitted.bas

Other predict methods: fitted.bas(), predict.bas(), variable.names.pred.bas()

Other bas methods: BAS, bas.lm(), coef.bas(), confint.coef.bas(), confint.pred.bas(), diagnostics(), fitted.bas(), force.heredity.bas(), image.bas(), plot.confint.bas(), predict.bas(), summary.bas(), update.bas(), variable.names.pred.bas()


data(, package="MASS")
data(Pima.te, package="MASS")
Pima.bas = bas.glm(type ~ .,, n.models= 2^7, method="BAS",
           betaprior=CCH(a=1, b=nrow(, s=0), family=binomial(),
pred = predict(Pima.bas, newdata=Pima.te, top=1)  # Highest Probability model
cv.summary.bas(pred$fit, Pima.te$type, score="miss-class")

[Package BAS version 1.7.1 Index]