data(HighDim)
library(glmnet)
x <- as.matrix(HighDim[,-1])
y <- HighDim[,1]
lasso_fit <- glmnet(x = x, y = y, alpha = 1, intercept = FALSE)
# SPSP+Lasso method
K <- dim(lasso_fit$beta)[2]
LBETA <- as.matrix(lasso_fit$beta)
spsp_lasso_1 <- SPSP_step(x = x, y = y, BETA = LBETA,
init = 1, standardize = FALSE, intercept = FALSE)
head(spsp_lasso_1$nonzero)
head(spsp_lasso_1$beta_SPSP)
Run the code above in your browser using DataLab