Postinference.MHLS: Post-selection individual inference with lasso estimator

Description Usage Arguments Details Value Examples

Description

Provides confidence intervals for the set of active coefficients of lasso using Metropolis-Hastings sampler.

Usage

1
2
3
4
postInference.MHLS(LassoEst, Ctype = "CI", X, Y, sig2.hat, tau = rep(1,
  ncol(X)), alpha = 0.05, MHsamples, target = which(LassoEst$B0 != 0),
  nChain = 10, method, niterPerChain = 500, parallel = FALSE,
  ncores = 2L, returnSamples = FALSE, ...)

Arguments

LassoEst

The result from lassoFit function with type="lasso".

Ctype

either "CI" or "CS" which represent confidence intervals and confidence sets, respectively. If "CI", confidence intervals for all active coefficients are generated. If "CS", target argument needs to be specified.

X

predictor matrix.

Y

response vector.

sig2.hat

variance of error term.

tau

numeric vector. Standard deviation of proposal distribution for each beta. Adjust the value to get relevant level of acceptance rate. Default is rep(1, ncol(X)).

alpha

confidence level for confidence interval.

MHsamples

optional argument. MHsamples from postInference.MHLS. If MHsamples is supplied, MH sampling step is omitted. See the example for the detail.

target

target active variables of which one wants to generate confidence set. Needs to be a subset of active set. See the example for the detail.

nChain

the number of chains. For each chain, different plug-in beta will be generated from its confidence region.

method

Type of robust method. Users can choose either "coeff" or "mu".

niterPerChain

the number of iterations per chain.

parallel

logical. If parallel = TRUE, uses parallelization. Default is parallel = FALSE.

ncores

integer. The number of cores to use for parallelization.

returnSamples

logical. If returnSamples = TRUE, print Metropolis-Hastings samples. If MHsamples is supplied, returnSamples = FALSE is forced.

...

auxiliary MHLS arguments.

Details

This function provides post-selection inference for the active coefficients selected by lasso. Uses Metropolis-Hastings sampler with multiple chains to draw from the distribution under a fixed active set and generates (1-alpha) confidence interval for each active coefficients. Set returnSamples = TRUE to check the Metropolis-Hastings samples. Check the acceptance rate and adjust tau accordingly. We recommend to set nChain >= 10 and niterPerChain >= 500.

Value

MHsamples

a list of class MHLS.

confidenceInterval

(1-alpha) confidence interval for each active coefficient.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
set.seed(123)
n <- 6
p <- 10
X <- matrix(rnorm(n*p),n)
Y <- X %*% rep(1,p) + rnorm(n)
sig2 <- 1
lbd <- .37
weights <- rep(1,p)
LassoEst <- lassoFit(X = X, Y = Y, type = "lasso", lbd = lbd, weights = weights)
parallel <- (.Platform$OS.type != "windows")
P1 <- postInference.MHLS(LassoEst= LassoEst, X = X, Y = Y, sig2.hat = 1, alpha = .05,
nChain = 3, niterPerChain = 20, method = "coeff", parallel = parallel, returnSamples = TRUE)
P1
postInference.MHLS(LassoEst= LassoEst, MHsamples = P1$MHsamples,
                   Ctype = "CI", X = X, Y = Y, method = "coeff")
postInference.MHLS(LassoEst= LassoEst, MHsamples = P1$MHsamples,
                   Ctype = "CS", X = X, Y = Y, method = "coeff")

seunghyunmin/EAlasso documentation built on May 31, 2019, 8:31 a.m.