Learn R Programming

LassoHiDFastGibbs (version 0.1.4)

blasso_pcg_lambda2_va: Bayesian lasso PCG sampler: lambda2 collapsed over local scales

Description

Lasso-specific Partially-collapsed Gibbs (PCG) variant with the local scales (va) collapsed in the \(\lambda^2\) update.

Usage

blasso_pcg_lambda2_va(
  vy,
  mX,
  a,
  b,
  u,
  v,
  nsamples,
  lambda_init = 1,
  sigma2_init = 1,
  verbose = max(1L, floor(as.integer(nsamples)/10))
)

Value

A list with components:

mBeta

Matrix of beta draws (nsamples x p).

vsigma2

Vector of sigma^2 draws (length nsamples).

vlambda2

Vector of lambda^2 draws (length nsamples).

Arguments

vy

Numeric response vector of length n.

mX

Numeric design matrix of dimension n x p.

a, b

Hyperparameters for the inverse-gamma prior on \(\sigma^2\).

u, v

Hyperparameters for the prior on \(\lambda^2\).

nsamples

Number of MCMC iterations.

lambda_init

Initial value for \(\lambda\).

sigma2_init

Initial value for \(\sigma^2\).

verbose

Print progress every verbose iterations (0 = silent).

Examples

Run this code
set.seed(1)
n <- 40; p <- 6
X <- matrix(rnorm(n * p), n, p)
beta <- c(1.2, 2, -1, 0.5, 0.75, 2.5)
y <- X %*% beta + rnorm(n)

out <- blasso_pcg_lambda2_va(
  vy = y, mX = X,
  a = 1, b = 1, u = 1, v = 1,
  nsamples = 200,
  lambda_init = 1, sigma2_init = 1,
  verbose = 0
)

summary(out$vlambda2)

Run the code above in your browser using DataLab