1
Bayesian LASSO: Implementation in MATLAB
Soumya Banerjee
Equations
Here we present an implementation of the Bayesian LASSO [1].
π(β|σ
2
) =
p
Y
j=1
λ
2
√
σ
2
e
−λ|β
j
|/
√
σ
2
(1)
Y | ∼ N
n
(Xβ, σ
2
I
n
) (2)
β| ∼ N
p
(0
p
, σ
2
D
τ
) (3)
D
τ
= diag(τ
2
1
, τ
2
2
, ..., τ
2
p
) (4)
σ
2
, τ
2
1
, τ
2
2
, ..., τ
2
p
∼ π(σ
2
)dσ
2
p
Y
j=1
λ
2
2
e
−λ
2
τ
2
j
/2
dτ
2
j
(5)
The inference equations for the Bayesian LASSO are (posterior conditional)
β| ∼ N
p
(A
−1
X
T
Y, σ
2
A
−1
) (6)
where A = X
T
X + D
−1
τ
σ
2
| ∼ InvGamma(
n − 1
2
+
p
2
,
(Y − Xβ)
T
(Y − Xβ)
2
+
β
T
D
−1
τ
β
2
) (7)
1/τ
2
j
| ∼ InvGaussian(µ
′
, λ
′
) (8)
where µ
′
=
q
λ
2
σ
2
β
2
j
and λ
′
= λ
2