predict.bma: Predict Method for bma Objects

View source: R/aux_outer.R

predict.bmaR Documentation

Predict Method for bma Objects

Description

Expected value of prediction based on 'bma' object

Usage

## S3 method for class 'bma'
predict(object, newdata = NULL, exact = FALSE, topmodels = NULL, ...)

Arguments

object

a bma object - see bms

newdata

An optional data.frame, matrix or vector containing variables with which to predict. If omitted, then (the expected values of) the fitted values are returned.

exact

If FALSE (default), then prediction is based on all models (i.e. on their MCMC frequencies in case the bms parameter mcmc was set to an mcmc sampler.
If TRUE, then prediction is based on analytical likelihoods of the best models retained in object - cf. bms parameter nmodel.

topmodels

index of the models with whom to predict: for instance, topmodels=1 predicts based solely on the best model, whereas topmodels=1:5 predicts based on a combination of the five best models.
Note that setting topmodels triggers exact=TRUE.

...

further arguments passed to or from other methods.

Value

A vector with (expected values of) fitted values.

See Also

coef.bma for obtaining coefficients, bms for creating bma objects, predict.lm for a comparable function

Check http://bms.zeugner.eu for additional help.

Examples


 data(datafls)
 mm=bms(datafls,user.int=FALSE)
 
 predict(mm) #fitted values based on MCM frequencies
 predict(mm, exact=TRUE) #fitted values based on best models
 
 predict(mm, newdata=1:41) #prediction based on MCMC frequencies 
 
 predict(mm, newdata=datafls[1,], exact=TRUE) #prediction based on a data.frame
 
 # the following two are equivalent:
 predict(mm, topmodels=1:10)
 predict(mm[1:10], exact=TRUE)
 
 

BMS documentation built on Aug. 9, 2022, 5:08 p.m.