Learn R Programming

bayeslm (version 0.8.0)

hs_gibbs: Gibbs sampler of horseshoe regression

Description

Standard Gibbs sampler of horseshoe regression.

Usage

hs_gibbs(Y, X, nsamps, a, b, scale_sigma_prior)

Arguments

Y

Response of regression.

X

Matrix of regressors.

nsamps

Number of posterior samples.

a

Parameter of inverse Gamma prior on \(\sigma\).

b

Parameter of inverse Gamma prior on \(\sigma\).

scale_sigma_prior

Bool, if TRUE, use prior scaled by \(\sigma\).

Details

This function implements standard Gibbs sampler of horseshoe regression. The prior is \(y \mid \beta, \sigma^2, X \sim MVN(X\beta, \sigma^2 I)\) \(\beta_i \mid \tau, \lambda_i, \sigma \sim N(0, \lambda_i^2\tau^2\sigma^2)\) \(\sigma^2\sim IG(a, b)\) \(\tau \sim C^{+}(0,1)\) \(\lambda_i \sim C^{+}(0,1)\)

See Also

summary.mcmc

Examples

Run this code
# NOT RUN {
x = matrix(rnorm(1000), 100, 10)
y = x %*% rnorm(10) + rnorm(100)
fit=hs_gibbs(y, x, 1000, 1, 1, TRUE)
summary(fit)
# }

Run the code above in your browser using DataLab