Learn R Programming

horserule (version 1.0.0)

predict.HorseRulemodel: predict.hs

Description

Predict unseen data with the horseshoe model.

Usage

# S3 method for HorseRulemodel
predict(object, newdata, burnin = 100,
  postmean = TRUE, ...)

Arguments

object

list containing a model of class "hs_rulefit".

newdata

Dataframe containing the unseen data to predict.

burnin

Number of samples that is disregarded as burnin. Increase number in case of slow convergence.

postmean

If true returns the Predictive-Posterior mean value. If False returns the full predictive posterior distribution.

...

additional arguments

Value

Returns the predictive posterior distribution matrix. Column i contains the predictive posterior of observation i.

Examples

Run this code
# NOT RUN {
x = matrix(rnorm(1000), ncol=10)
y = apply(x,1,function(x)sum(x[1:5])+rnorm(1))
hrresmod = HorseRuleFit(X=x, y=y, niter=100, burnin=10)
#predict training data to obtain the fitted values
predict(hrresmod, x, burnin=10)
# }

Run the code above in your browser using DataLab