Learn R Programming

BayesVarSel (version 1.3)

predict.Bvs: Predict method for object of the class Bvs

Description

Optimal predicted values based on Bvs object.

Usage

## S3 method for class 'Bvs':
predict(object, newdata, ...)

Arguments

object
An object of class Bvs
newdata
An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.
...
Not used

Value

  • An object of the class Bvs.predict which is a list with the following components: [object Object],[object Object],[object Object],[object Object]

Details

The prediction is the scalar product of each new data point times the model averaged estimate of the regression parameters.

See Also

Bvs, PBvs or GibbsBvs

Examples

Run this code
#read Hald data
data(Hald)
#run the main function:
hald.Bvs<- Bvs(formula="y~x1+x2+x3+x4", data=Hald, n.keep=16)

#Prediction at the mean value:
pred.mean<- predict(object=hald.Bvs, newdata=as.data.frame(t(colMeans(Hald))))

#prediction at the original design matrix
predict(object=hald.Bvs)

Run the code above in your browser using DataLab