R Under development (unstable) (2025-04-16 r88149 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > stopifnot(require(hdi)) Loading required package: hdi Loading required package: scalreg Loading required package: lars Loaded lars 1.3 > > ## this is the example code of the help file of lasso.proj > > x <- matrix(rnorm(100 * 10), nrow = 100, ncol = 10) > y <- x[,1] + x[,2] + rnorm(100) > fit.lasso <- lasso.proj(x, y) Nodewise regressions will be computed as no argument Z was provided. You can store Z to avoid the majority of the computation next time around. Z only depends on the design matrix x. > which(fit.lasso$pval.corr < 0.05) # typically: '1' and '2' and no other [1] 1 2 > > ## Group-wise testing of the first two coefficients > fit.lasso$groupTest(1:2) [1] 1.832905e-20 > > ## Hierarchical testing using distance matrix based on > ## correlation matrix > out.clust <- fit.lasso$clusterGroupTest() > plot(out.clust) > > ## Fit the lasso projection method without doing the preparations > ## for group testing (saves time and memory) > fit.lasso.faster <- lasso.proj(x, y, suppress.grouptesting = TRUE) Nodewise regressions will be computed as no argument Z was provided. You can store Z to avoid the majority of the computation next time around. Z only depends on the design matrix x. > > ## Use the scaled lasso for the initial estimate > fit.lasso.scaled <- lasso.proj(x, y, betainit = "scaled lasso") Nodewise regressions will be computed as no argument Z was provided. You can store Z to avoid the majority of the computation next time around. Z only depends on the design matrix x. > which(fit.lasso.scaled$pval.corr < 0.05) [1] 1 2 > > ## Use a robust estimate for the standard error > fit.lasso.robust <- lasso.proj(x, y, robust = TRUE) Nodewise regressions will be computed as no argument Z was provided. You can store Z to avoid the majority of the computation next time around. Z only depends on the design matrix x. > which(fit.lasso.robust$pval.corr < 0.05) [1] 1 2 > > ## Perform the Z&Z version of the lasso projection method > fit.lasso <- lasso.proj(x, y, do.ZnZ = TRUE) Nodewise regressions will be computed as no argument Z was provided. You can store Z to avoid the majority of the computation next time around. Z only depends on the design matrix x. > > which(fit.lasso$pval.corr < 0.05) # typically: '1' and '2' and no other [1] 1 2 > > proc.time() user system elapsed 5.45 0.40 5.82