l1ball: Fit the L1 prior

Description Arguments Value Examples

View source: R/l1ball.R

Description

This package provides an implementation of the Gibbs sampler, for using l1-ball prior with the regression likelihood y_i = X_iθ+ ε_i, ε_i\sim {N}(0,σ^2).

Arguments

y

A data vector, n by 1

X

A design matrix, n by p

b_w

The parameter in Beta(1, p^{b_w}) for w, default b_w=1

step

Number of steps to run the Markov Chain Monte Carlo

burnin

Number of burn-ins

b_lam

The parameter in λ_i \sim Inverse-Gamma(1, b_λ), default b_λ=10^{-3}. To increase the level of shrinkage, use smaller b_λ.

Value

The posterior sample collected from the Markov Chain:

Examples

1
2
3
4
5
6
7
8
n = 60
p = 100
X <- matrix(rnorm(n*p),n,p)
d = 5
w0 <- c(rep(0, p-d), rnorm(d)*0.1+1)
y = X%*% w0 + rnorm(n,0,.1)
trace <- l1ball(y,X,steps=2000,burnin = 2000)
plot(colMeans(trace$trace_theta))

l1ball documentation built on July 25, 2020, 1:06 a.m.

Related to l1ball in l1ball...