Learn R Programming

BAS (version 1.2.2)

predict.basglm: Prediction Method for an object of class basglm

Description

Predictions under model averaging from a BMA (BAS) object for GLMS

Usage

"predict"(object, newdata, top=NULL, type=c("link", "response"), ...)

Arguments

object
An object of class "basglm", created by bas.glm
newdata
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'.
top
A scalar interger M. If supplied, subset the top M models, based on posterior probabilities for model predictions and BMA.
type
Type of predictions required. The default is on the scale of the linear predictors; the alternative "response" is on the scale of the response variable. Thus for a default binomial model the default predictions are of log-odds (probabilities on logit scale) and type = "response" gives the predicted probabilities.
...
optional extra arguments

Value

Ybma
predictions using BMA
Ypred
matrix of predictions under each model
postprobs
renormalized probabilities of the top models
best
index of top models included

Details

Use BMA to form predictions using the top highest probability models.

See Also

bas.glm, predict.bas, fitted.bas

Examples

Run this code
## Not run: library(MASS)
# data(Pima.tr)
# data(Pima.te)
# Pima.bas =  bas.glm(type ~ ., data=Pima.tr, family=binomial(), a=1, s=0,
# b=nrow(Pima.tr)/2, modelprior=uniform(), n.models=2^7, method="BAS")
# YHPM = predict(Pima.bas, newdata=Pima.te, top=1)  # Highest Probability model
# ## End(Not run)

Run the code above in your browser using DataLab