Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

hs

Horseshoe regression Gibbs-sampler


Description

Generates posterior samples using the horseshoe prior. The Gibbs sampling method from Makalic E and Schmidt DF (2016). “A Simple Sampler for the Horseshoe Estimator.” IEEE Signal Process. Lett., 23(1), pp. 179–182. is used to generate the posterior samples.

Usage

hs(X, y, niter = 1000, hsplus = F, prior = NULL, thin = 1,
  restricted = 0)

Arguments

X

A matrix containing the predictor variables to be used.

y

The vector of numeric responses.

niter

Number of posterior samples.

hsplus

If "hsplus=T" the horseshoe+ extension will be used.

prior

Prior for the individual predictors. If all 1 a standard horseshoe model is fit.

thin

If > 1 thinning is performed to reduce autocorrelation.

restricted

Threshold for restricted Gibbs sampling. In each iteration only coefficients with scale > restricted are updated. Set restricted = 0 for unrestricted Gibbs sampling.

Value

A list containing the posterior samples of the following parameters:

beta

Matrix containing the posterior samples for the regression coefficients.

sigma

Vector contraining the Posterior samples of the error variance.

tau

Vector contraining the Posterior samples of the overall shrinkage.

lambda

Matrix containing the posterior samples for the individual shrinkage parameter.

Examples

x = matrix(rnorm(1000), ncol=10)
y = apply(x,1,function(x)sum(x[1:5])+rnorm(1))
hsmod = hs(X=x, y=y, niter=100)

horserule

Flexible Non-Linear Regression with the HorseRule Algorithm

v1.0.0
GPL-3
Authors
Malte Nalenz <malte.nlz@googlemail.com>, Mattias Villani <mattias.villani@liu.se>
Initial release
2018-03-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.