boot.glmnet | R Documentation |
Calculate confidence intervals for lasso using bootstrap
boot.glmnet(X, y, B = 500, lambda, seed, alpha = 0.05, bar = TRUE)
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? |
Data <- gen_data_abn(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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.