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.1.0 (2021-05-18)
# Platform: x86_64-apple-darwin17.0 (64-bit)
# Running under: macOS Big Sur 10.16
# 
# Matrix products: default
# BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
# LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib
# 
# locale:
# [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] susieR_0.12.00
# 
# loaded via a namespace (and not attached):
#  [1] tidyselect_1.1.1   xfun_0.26          bslib_0.3.1        purrr_0.3.4       
#  [5] lattice_0.20-44    colorspace_2.0-3   vctrs_0.3.8        generics_0.1.1    
#  [9] htmltools_0.5.2    yaml_2.2.1         utf8_1.2.2         rlang_1.0.2       
# [13] mixsqp_0.3-43      pkgdown_2.0.2      jquerylib_0.1.4    pillar_1.7.0      
# [17] glue_1.6.2         DBI_1.1.2          RcppZiggurat_0.1.6 plyr_1.8.7        
# [21] matrixStats_0.61.0 lifecycle_1.0.1    stringr_1.4.0      munsell_0.5.0     
# [25] gtable_0.3.0       ragg_1.2.2         memoise_2.0.0      evaluate_0.14     
# [29] knitr_1.36         fastmap_1.1.0      parallel_4.1.0     irlba_2.3.5       
# [33] fansi_1.0.3        highr_0.9          Rfast_2.0.3        Rcpp_1.0.8.3      
# [37] scales_1.1.1       cachem_1.0.6       desc_1.4.0         jsonlite_1.7.2    
# [41] systemfonts_1.0.4  fs_1.5.0           textshaping_0.3.6  ggplot2_3.3.5     
# [45] digest_0.6.29      stringi_1.7.4      dplyr_1.0.7        grid_4.1.0        
# [49] rprojroot_2.0.2    cli_3.2.0          tools_4.1.0        magrittr_2.0.2    
# [53] sass_0.4.1         tibble_3.1.6       crayon_1.5.1       pkgconfig_2.0.3   
# [57] ellipsis_0.3.2     Matrix_1.3-3       reshape_0.8.8      assertthat_0.2.1  
# [61] rmarkdown_2.11     rstudioapi_0.13    R6_2.5.1           compiler_4.1.0