Metropolis-Hastings sampler for lasso estimator under the fixed active set.
MHLS(X, PE, sig2, lbd, weights = rep(1, ncol(X)), B0, S0, A = which(B0 !=
0), tau = rep(1, ncol(X)), niter = 2000, burnin = 0, PEtype = "coeff",
updateS.itv = 1, verbose = FALSE, ...)
predictor matrix.
parameters of target distribution.
(point estimate of beta or E(y)
depends on PEtype
, variance estimate of error and lambda).
weight vector with length p
(the number of covariates).
Default is weights = rep(1, p)
.
numeric vector with length p
.
Initial value of lasso estimator.
numeric vector with length p
.
Initial value of subgradients.
If not given, this will be generated in a default way.
numeric vector. Active coefficient index.
Every active coefficient index in B0
must be included.
Default is A = which(B0 != 0)
.
numeric vector with length p
.
Standard deviaion of proposal distribution for each coefficient.
integer. The number of iterations. Default is niter = 2000
integer. The length of burin-in periods. Default is burnin = 0
Type of PE
which is needed to characterize the target distribution.
Users can choose either "coeff"
or "mu"
.
integer. Update subgradients every updateS.itv
iterations.
Set this value larger than niter
if one wants to skip updating subgradients.
logical. If true, print out the progress step.
complementary arguments.
FlipSA :
optional parameter.
This has to be a subset of active set, A. If the index is not listed in FlipSA,
the sign of coefficients which correspond to the listed index will remain fixed.
The default is FlipSA=A
SFindex :
optional parameter. subgradient index for the free coordinate.
randomSFindex :
logical. If true
, resample SFindex
every
updateSF.itv
iterations.
updateSF.itv :
integer. In every updateSF.itv
iterations,
randomize SFindex
.
MHLS
returns an object of class "MHLS"
.
The functions summary.MHLS
and plot.MHLS
provide a brief summary and generate plots.
lasso samples.
subgradient samples.
numbers of acceptance and proposal.
same as function arguments.
Given appropriate initial value, provides Metropolis-Hastings samples under the fixed active set.
Zhou, Q. (2014), "Monte Carlo simulation for Lasso-type problems by estimator augmentation," Journal of the American Statistical Association, 109, 1495-1516.
Zhou, Q. and Min, S. (2017), "Estimator augmentation with applications in high-dimensional group inference," Electronic Journal of Statistics, 11(2), 3039-3080.
# NOT RUN {
#-------------------------
# Low dim
#-------------------------
set.seed(123)
n <- 10
p <- 5
X <- matrix(rnorm(n * p), n)
Y <- X %*% rep(1, p) + rnorm(n)
sigma2 <- 1
lbd <- .37
weights <- rep(1, p)
LassoResult <- Lasso.MHLS(X = X, Y = Y, lbd = lbd, type = "lasso", weights = weights)
B0 <- LassoResult$B0
S0 <- LassoResult$S0
MHLS(X = X, PE = rep(0, p), sig2 = 1, lbd = 1,
weights = weights, B0 = B0, S0 = S0, niter = 50, burnin = 0,
PEtype = "coeff")
MHLS(X = X, PE = rep(0, n), sig2 = 1, lbd = 1,
weights = weights, B0 = B0, S0 = S0, niter = 50, burnin = 0,
PEtype = "mu")
#-------------------------
# High dim
#-------------------------
set.seed(123)
n <- 5
p <- 10
X <- matrix(rnorm(n*p),n)
Y <- X %*% rep(1,p) + rnorm(n)
weights <- rep(1,p)
LassoResult <- Lasso.MHLS(X = X,Y = Y,lbd = lbd, type = "lasso", weights = weights)
B0 <- LassoResult$B0
S0 <- LassoResult$S0
MHLS(X = X, PE = rep(0, p), sig2 = 1, lbd = 1,
weights = weights, B0 = B0, S0 = S0, niter = 50, burnin = 0,
PEtype = "coeff")
MHLS(X = X, PE = rep(0, n), sig2 = 1, lbd = 1,
weights = weights, B0 = B0, S0 = S0, niter = 50, burnin = 0,
PEtype = "mu")
# }
Run the code above in your browser using DataLab