Performs a hybrid bootstrapping approach to construct quantile based confidence intervals around the original lasso/MCP/SCAD estimator. Specifically, a traditional pairs bootstrap is performed with 1 adjustment: if the bootstrap sample for a given covariate is zero, a random sample from the full conditional posterior is used as the bootstrap sample instead. This avoids the creation of intervals with endpoints exactly equal to zero.
boot_ncvreg(
X,
y,
fit,
lambda,
sigma2,
cluster,
seed,
nboot = 1000,
penalty = "lasso",
level = 0.95,
gamma = switch(penalty, SCAD = 3.7, 3),
alpha = 1,
returnCV = FALSE,
return_boot = FALSE,
verbose = FALSE,
...
)A list with:
A data.frame with the original point estimates along with lower and upper bounds of Hybrid CIs.
The value of lambda the confidence_intervals were constructed at.
The value of sigma2 used for the Hybrid bootstrap sampling.
The penalty the intervals correspond to.
The tuning parameter for the Enet estimator used.
The confidence level the intervals correspond to.
If a penalty other than "lasso" is used,
The tuning parameter for MCP/SCAD penalty.
If returnCV is TRUE and a cv.ncvreg object was fit or supplied
The cv.ncvreg fit used to estimate lambda and sigma2 (if applicable).
If return_boot is TRUE
A data.frame of the Hybrid bootstrap draws are returned.
The design matrix, without an intercept. boot_ncvreg
standardizes the data and includes an intercept by default.
The response vector.
(optional) An object of class ncvreg or
cv.ncvreg. An object of class ncvreg
provides data, penalty choices, and lambda sequence to
boot_ncvreg. An object of class cv.ncvreg can in
addition can provide information for selecting lambda
and estimating sigma2. If provided, y should not
be provided and X should only be provided if fit
does not contain X.
(optional) The value of lambda to provide interval estimates
for. If left missing will be selected using CV. If user wants
to set the lambda sequence used to select lambda via
cross validation, they should call cv.ncvreg separately
and pass the resulting object to fit.
(optional) The variance to use for the Hybrid sampling. If left missing will be set using the estimator suggested by Reid et. al. (2016) using CV.
Bootstrapping and cv.ncvreg (if applicable) can be run
in parallel across a cluster using the parallel package.
The cluster must be set up in advance using the
parallel::makeCluster() function from that package. The
cluster must then be passed to boot_ncvreg.
You may set the seed of the random number generator in order
to obtain reproducible results. This is set for the overall
process. If the user wishes to set a seed specifically for
cv.ncvreg they should call it separately then pass the
fitted object as an argument to fit.
The number of bootstrap replications to use.
The penalty to be applied to the model. Either "lasso" (the default), "MCP", or "SCAD".
The confidence level required.
The tuning parameter of the MCP/SCAD penalty
(see ncvreg for details). Default is 3 for MCP and 3.7
for SCAD. Ignored if fit is provided.
Tuning parameter for the Elastc net estimator which controls
the relative contributions from the lasso/MCP/SCAD penalty and
the ridge, or L2 penalty. alpha=1 is equivalent to
lasso/MCP/SCAD penalty, while alpha=0 would be equivalent to
ridge regression. However, alpha=0 is not supported; alpha
may be arbitrarily small, but not exactly 0. Ignored if fit is
provided.
If TRUE, the cv.ncvreg fit will be returned
(if applicable).
If TRUE, the bootstrap draws will be returned.
If FALSE, non-essential messages are suppressed.
named arguments to be passed to ncvreg and
cv.ncvreg.
The resulting intervals WILL NOT have exact nominal coverage for all covariates. They are instead constructed in a way that overall coverage will be approximately equal to nominal so long as the true distribution of betas is Laplace and the covariates are independent. That said, in practice, average coverage is fairly robust to these assumptions.
Note: Draws from the full conditional posterior are approximations for
MCP/SCAD or when alpha is not 1.
data(Prostate)
X <- Prostate$X
y <- Prostate$y
boot_ncvreg(X, y, level = 0.8)
Run the code above in your browser using DataLab