Last updated: 2026-10-23

Checks: 7 0

Knit directory: ebverse-workflowr/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(1) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 9128c04. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    analysis/figure/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/ser_demo.Rmd) and HTML (docs/ser_demo.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 9128c04 Peter Carbonetto 2026-10-23 wflow_publish("ser_demo.Rmd", verbose = T, view = F)
Rmd bb58c12 Peter Carbonetto 2026-10-23 Added a basic comparison of the ebverse SER implementation to susieR with L = 1.
Rmd 92030cc Peter Carbonetto 2026-10-22 Small fix to ser_demo.Rmd.
Rmd 2fa8c8b Peter Carbonetto 2026-10-22 Added susie results with L = 1 to ser_demo workflowr.
html c91b016 Peter Carbonetto 2026-10-22 First build of the ser_demo workflowr.
Rmd afa3972 Peter Carbonetto 2026-10-22 workflowr::wflow_publish("ser_demo.Rmd")
html 90487e4 Peter Carbonetto 2026-10-22 Build site.
Rmd efc659e Peter Carbonetto 2026-10-22 workflowr::wflow_publish("ser_demo.Rmd")

Add text here.

Load the susieR and ebverse packages:

library(susieR)
library(ebverse)

Set the seed to ensure that the results are reproducible:

set.seed(1)

Add text here.

load(file.path(system.file(package="ebverse"),"datasets/jsm_data.RData"))
n <- nrow(X)
J <- ncol(X)
dim(X)
# [1] 574 740

Fit a single effect regression using the susieR package:

fit_susie <- susie(X,y,L = 1,standardize = FALSE)

Add text here.

par(mar = c(4,4,2,1))
pips <- fit_susie$pip
plot(pips,pch = 20,xlab = "SNP",ylab = "PIP")
j <- fit_susie$sets$cs[[1]]
points(j,pips[j],pch = 1,col = "dodgerblue",cex = 1.25)
j <- which(b_true != 0)
points(j,pips[j],pch = 20,col = "red")

Add text here.

fit0 <- init_ser_model_normal(J,
  prior = list(prob = 1/J,prior_variance = fit_susie$V))
X <- scale(X,center = TRUE,scale = FALSE)
y <- y - mean(y)
xx <- colSums(X^2)
bhat <- drop(t(X) %*% y)/xx
s <- fit_susie$sigma2/xx
ser_data <- cbind(bhat = bhat,s = s)
fit_ser <- fit_ser_model(fit0,ser_data)

Add text there.

b1_susie <- fit_susie$alpha * fit_susie$mu
range(fit_susie$pip - fit_ser$posterior[,"pip"])
range(b1_susie - fit_ser$posterior[,"b1"])
cat("susie logBF:",format(fit_susie$lbf,digits = 10),"\n")
cat("SER logBF:",format(fit_ser$lbf,digits = 10),"\n")
# [1] -7.327472e-15  7.993606e-15
# [1] -6.439294e-15  7.022161e-15
# susie logBF: 150.9309227 
# SER logBF: 150.9309117

Add text here.

par(mar = c(4,4,2,1),mfrow = c(1,2))
plot(fit_susie$pip,fit_ser$posterior[,"pip"],pch = 20,
     xlab = "susieR",ylab = "ebverse",main = "PIPs")
abline(a = 0,b = 1,lty = "dotted",col = "magenta")
plot(b1_susie,fit_ser$posterior[,"b1"],pch = 20,
     xlab = "susieR",ylab = "ebverse",main = "posterior mean coefs")
abline(a = 0,b = 1,lty = "dotted",col = "magenta")


sessionInfo()
# R version 4.3.3 (2024-02-29)
# Platform: aarch64-apple-darwin20 (64-bit)
# Running under: macOS 26.5.2
# 
# Matrix products: default
# BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
# LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
# 
# locale:
# [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
# 
# time zone: America/Chicago
# tzcode source: internal
# 
# attached base packages:
# [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
# [1] ebverse_0.1-12 susieR_0.14.4 
# 
# loaded via a namespace (and not attached):
#  [1] sass_0.4.10         generics_0.1.4      stringi_1.8.7      
#  [4] lattice_0.22-5      digest_0.6.37       magrittr_2.0.3     
#  [7] evaluate_1.0.4      grid_4.3.3          RColorBrewer_1.1-3 
# [10] fastmap_1.2.0       rprojroot_2.0.4     workflowr_1.7.1    
# [13] plyr_1.8.9          jsonlite_2.0.0      Matrix_1.6-5       
# [16] whisker_0.4.1       reshape_0.8.9       mixsqp_0.3-54      
# [19] promises_1.3.3      scales_1.4.0        jquerylib_0.1.4    
# [22] cli_3.6.5           rlang_1.1.6         crayon_1.5.3       
# [25] cachem_1.1.0        yaml_2.3.10         tools_4.3.3        
# [28] parallel_4.3.3      dplyr_1.1.4         ggplot2_3.5.2      
# [31] httpuv_1.6.14       Rfast_2.1.0         RcppZiggurat_0.1.6 
# [34] vctrs_0.6.5         R6_2.6.1            matrixStats_1.2.0  
# [37] lifecycle_1.0.4     git2r_0.33.0        stringr_1.5.1      
# [40] fs_1.6.6            irlba_2.3.5.1       pkgconfig_2.0.3    
# [43] RcppParallel_5.1.10 pillar_1.11.0       bslib_0.9.0        
# [46] later_1.4.2         gtable_0.3.6        glue_1.8.0         
# [49] Rcpp_1.1.0          xfun_0.52           tibble_3.3.0       
# [52] tidyselect_1.2.1    knitr_1.50          dichromat_2.0-0.1  
# [55] farver_2.1.2        htmltools_0.5.8.1   rmarkdown_2.29     
# [58] compiler_4.3.3