boot.glmnet: Calculate confidence intervals for lasso using bootstrap

View source: R/boot-glmnet.R

boot.glmnetR Documentation

Calculate confidence intervals for lasso using bootstrap

Description

Calculate confidence intervals for lasso using bootstrap

Usage

boot.glmnet(X, y, B = 500, lambda, seed, alpha = 0.05, bar = TRUE)

Arguments

X

Design matrix

y

Response vector

B

Number of bootstrap resamples (default 500)

lambda

Regularization parameter at which solutions are to be bootstrapped (by default, uses cross-validation to find lambda)

seed

Seed (optional)

alpha

Error rate; 0.05 (default) corresponds to 95% confidence interval

bar

Print a progress bar?

Examples

Data <- genDataABN(n=100, p=20, a=2, b=3)
CI <- boot.glmnet(Data$X, Data$y)
covered <- Data$beta >= CI[,1] & Data$beta <= CI[,2]
table(covered)
CI <- boot.glmnet(Data$X, Data$y, lambda=0.65)
covered <- Data$beta >= CI[,1] & Data$beta <= CI[,2]
table(covered)

pbreheny/hdrm documentation built on May 24, 2024, 9:30 p.m.