Generates posterior samples using the horseshoe prior. The Gibbs sampling method from simplehorserule is used to generate the posterior samples.
hs(X, y, niter = 1000, hsplus = F, prior = NULL, thin = 1,
restricted = 0)
A matrix containing the predictor variables to be used.
The vector of numeric responses.
Number of posterior samples.
If "hsplus=T" the horseshoe+ extension will be used.
Prior for the individual predictors. If all 1 a standard horseshoe model is fit.
If > 1 thinning is performed to reduce autocorrelation.
Threshold for restricted Gibbs sampling. In each iteration only coefficients with scale > restricted are updated. Set restricted = 0 for unrestricted Gibbs sampling.
A list containing the posterior samples of the following parameters:
Matrix containing the posterior samples for the regression coefficients.
Vector contraining the Posterior samples of the error variance.
Vector contraining the Posterior samples of the overall shrinkage.
Matrix containing the posterior samples for the individual shrinkage parameter.
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab