Skip to contents

In this short vignette, we fit a sparse linear regression model with up to L > 0 non-zero effects. Generally, there is no harm in over-stating L (that is, the method is pretty robust to overfitting), except that computation will grow as L grows.

Here is a minimal example:

library(susieR)
set.seed(1)
n    <- 1000
p    <- 1000
beta <- rep(0,p)
beta[c(1,2,300,400)] <- 1
X   <- matrix(rnorm(n*p),nrow=n,ncol=p)
y   <- X %*% beta + rnorm(n)
res <- susie(X,y,L=10)
plot(coef(res)[-1],pch = 20)
&nbsp;

 

Plot the ground-truth outcomes vs. the predicted outcomes:

plot(y,predict(res),pch = 20)
&nbsp;

 

Session information

Here are some details about the computing environment, including the versions of R, and the R packages, used to generate these results.

sessionInfo()
# R version 4.4.3 (2025-02-28)
# Platform: x86_64-conda-linux-gnu
# Running under: Ubuntu 24.04.3 LTS
# 
# Matrix products: default
# BLAS/LAPACK: /home/runner/work/susieR/susieR/.pixi/envs/r44/lib/libopenblasp-r0.3.30.so;  LAPACK version 3.12.0
# 
# locale:
#  [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
#  [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
#  [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
# [10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
# 
# time zone: Etc/UTC
# tzcode source: system (glibc)
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] susieR_0.14.2
# 
# loaded via a namespace (and not attached):
#  [1] Matrix_1.7-4          gtable_0.3.6          jsonlite_2.0.0       
#  [4] compiler_4.4.3        crayon_1.5.3          Rcpp_1.1.0           
#  [7] jquerylib_0.1.4       systemfonts_1.3.1     scales_1.4.0         
# [10] textshaping_1.0.4     yaml_2.3.10           fastmap_1.2.0        
# [13] lattice_0.22-7        ggplot2_4.0.1         R6_2.6.1             
# [16] plyr_1.8.9            mixsqp_0.3-54         knitr_1.50           
# [19] htmlwidgets_1.6.4     zigg_0.0.2            desc_1.4.3           
# [22] bslib_0.9.0           RColorBrewer_1.1-3    rlang_1.1.6          
# [25] cachem_1.1.0          reshape_0.8.10        xfun_0.54            
# [28] fs_1.6.6              sass_0.4.10           S7_0.2.1             
# [31] RcppParallel_5.1.11-1 cli_3.6.5             pkgdown_2.2.0        
# [34] digest_0.6.39         grid_4.4.3            irlba_2.3.5.1        
# [37] lifecycle_1.0.4       vctrs_0.6.5           Rfast_2.1.5.2        
# [40] evaluate_1.0.5        glue_1.8.0            farver_2.1.2         
# [43] ragg_1.5.0            rmarkdown_2.30        matrixStats_1.5.0    
# [46] tools_4.4.3           htmltools_0.5.8.1