predict.bayeslm.fit {bayeslm}R Documentation

Predict new data

Description

predict.bayeslm.fit is an S3 method to predict response on new data.

Usage

## S3 method for class 'bayeslm.fit'
predict(object,data,burnin,X,...)

Arguments

object

object is output of bayeslm function.

data

A data frame or list of new data to predict.

burnin

number of draws to burn-in (default value is 0.1*nrow(X)).

X

If call bayeslm with matrices input x and y but not formula, pass new matrix to predict here. See example for details.

...

optional arguments for generic function.

Details

Make prediction on new data set, users are allowed to adjust number of burn-in samples.

Author(s)

Jingyu He

Examples

x = matrix(rnorm(1000), 100, 10)
y = x %*% rnorm(10) + rnorm(100)
data = list(x = x, y = y)

# Train the model with formula input
fit1 = bayeslm(y ~ x, data = data)
# predict
pred1 = predict(fit1, data)

# Train the model with matrices input
fit2 = bayeslm(Y = y, X = x)
pred2 = predict(fit2, X = x)

[Package bayeslm version 1.0.1 Index]