Last updated: 2020-01-15

Checks: 7 0

Knit directory: pcarbo/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.6.0.9000). 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 730b73b. 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:    sbatch/makefile_demo/sims/sim0001.csv
    Ignored:    sbatch/makefile_demo/sims/sim0002.csv
    Ignored:    sbatch/makefile_demo/sims/sim0003.csv
    Ignored:    sbatch/makefile_demo/sims/sim0004.csv
    Ignored:    sbatch/makefile_demo/sims/sim0005.csv
    Ignored:    sbatch/makefile_demo/sims/sim0006.csv
    Ignored:    sbatch/makefile_demo/sims/sim0007.csv
    Ignored:    sbatch/makefile_demo/sims/sim0008.csv
    Ignored:    sbatch/makefile_demo/sims/sim0009.csv
    Ignored:    sbatch/makefile_demo/sims/sim0010.csv
    Ignored:    sbatch/makefile_demo/sims/sim0011.csv
    Ignored:    sbatch/makefile_demo/sims/sim0012.csv
    Ignored:    sbatch/makefile_demo/sims/sim0013.csv
    Ignored:    sbatch/makefile_demo/sims/sim0014.csv
    Ignored:    sbatch/makefile_demo/sims/sim0015.csv
    Ignored:    sbatch/makefile_demo/sims/sim0016.csv
    Ignored:    sbatch/makefile_demo/sims/sim0017.csv
    Ignored:    sbatch/makefile_demo/sims/sim0018.csv
    Ignored:    sbatch/makefile_demo/sims/sim0019.csv
    Ignored:    sbatch/makefile_demo/sims/sim0020.csv
    Ignored:    sbatch/makefile_demo/sims/sim0021.csv
    Ignored:    sbatch/makefile_demo/sims/sim0022.csv
    Ignored:    sbatch/makefile_demo/sims/sim0023.csv
    Ignored:    sbatch/makefile_demo/sims/sim0024.csv
    Ignored:    sbatch/makefile_demo/sims/sim0025.csv
    Ignored:    sbatch/makefile_demo/sims/sim0026.csv
    Ignored:    sbatch/makefile_demo/sims/sim0027.csv
    Ignored:    sbatch/makefile_demo/sims/sim0028.csv
    Ignored:    sbatch/makefile_demo/sims/sim0029.csv
    Ignored:    sbatch/makefile_demo/sims/sim0030.csv
    Ignored:    sbatch/makefile_demo/sims/sim0031.csv
    Ignored:    sbatch/makefile_demo/sims/sim0032.csv
    Ignored:    sbatch/makefile_demo/sims/sim0033.csv
    Ignored:    sbatch/makefile_demo/sims/sim0034.csv
    Ignored:    sbatch/makefile_demo/sims/sim0035.csv
    Ignored:    sbatch/makefile_demo/sims/sim0036.csv
    Ignored:    sbatch/makefile_demo/sims/sim0037.csv
    Ignored:    sbatch/makefile_demo/sims/sim0038.csv
    Ignored:    sbatch/makefile_demo/sims/sim0039.csv
    Ignored:    sbatch/makefile_demo/sims/sim0040.csv
    Ignored:    sbatch/makefile_demo/sims/sim0041.csv
    Ignored:    sbatch/makefile_demo/sims/sim0042.csv
    Ignored:    sbatch/makefile_demo/sims/sim0043.csv
    Ignored:    sbatch/makefile_demo/sims/sim0044.csv
    Ignored:    sbatch/makefile_demo/sims/sim0045.csv
    Ignored:    sbatch/makefile_demo/sims/sim0046.csv
    Ignored:    sbatch/makefile_demo/sims/sim0047.csv
    Ignored:    sbatch/makefile_demo/sims/sim0048.csv
    Ignored:    sbatch/makefile_demo/sims/sim0049.csv
    Ignored:    sbatch/makefile_demo/sims/sim0050.csv
    Ignored:    sbatch/makefile_demo/sims/sim0051.csv
    Ignored:    sbatch/makefile_demo/sims/sim0052.csv
    Ignored:    sbatch/makefile_demo/sims/sim0053.csv
    Ignored:    sbatch/makefile_demo/sims/sim0054.csv
    Ignored:    sbatch/makefile_demo/sims/sim0055.csv
    Ignored:    sbatch/makefile_demo/sims/sim0056.csv
    Ignored:    sbatch/makefile_demo/sims/sim0057.csv
    Ignored:    sbatch/makefile_demo/sims/sim0058.csv
    Ignored:    sbatch/makefile_demo/sims/sim0059.csv
    Ignored:    sbatch/makefile_demo/sims/sim0060.csv
    Ignored:    sbatch/makefile_demo/sims/sim0061.csv
    Ignored:    sbatch/makefile_demo/sims/sim0062.csv
    Ignored:    sbatch/makefile_demo/sims/sim0063.csv
    Ignored:    sbatch/makefile_demo/sims/sim0064.csv
    Ignored:    sbatch/makefile_demo/sims/sim0065.csv
    Ignored:    sbatch/makefile_demo/sims/sim0066.csv
    Ignored:    sbatch/makefile_demo/sims/sim0067.csv
    Ignored:    sbatch/makefile_demo/sims/sim0068.csv
    Ignored:    sbatch/makefile_demo/sims/sim0069.csv
    Ignored:    sbatch/makefile_demo/sims/sim0070.csv
    Ignored:    sbatch/makefile_demo/sims/sim0071.csv
    Ignored:    sbatch/makefile_demo/sims/sim0072.csv
    Ignored:    sbatch/makefile_demo/sims/sim0073.csv
    Ignored:    sbatch/makefile_demo/sims/sim0074.csv
    Ignored:    sbatch/makefile_demo/sims/sim0075.csv
    Ignored:    sbatch/makefile_demo/sims/sim0076.csv
    Ignored:    sbatch/makefile_demo/sims/sim0077.csv
    Ignored:    sbatch/makefile_demo/sims/sim0078.csv
    Ignored:    sbatch/makefile_demo/sims/sim0079.csv
    Ignored:    sbatch/makefile_demo/sims/sim0080.csv
    Ignored:    sbatch/makefile_demo/sims/sim0081.csv
    Ignored:    sbatch/makefile_demo/sims/sim0082.csv
    Ignored:    sbatch/makefile_demo/sims/sim0083.csv
    Ignored:    sbatch/makefile_demo/sims/sim0084.csv
    Ignored:    sbatch/makefile_demo/sims/sim0085.csv
    Ignored:    sbatch/makefile_demo/sims/sim0086.csv
    Ignored:    sbatch/makefile_demo/sims/sim0087.csv
    Ignored:    sbatch/makefile_demo/sims/sim0088.csv
    Ignored:    sbatch/makefile_demo/sims/sim0089.csv
    Ignored:    sbatch/makefile_demo/sims/sim0090.csv
    Ignored:    sbatch/makefile_demo/sims/sim0091.csv
    Ignored:    sbatch/makefile_demo/sims/sim0092.csv
    Ignored:    sbatch/makefile_demo/sims/sim0093.csv
    Ignored:    sbatch/makefile_demo/sims/sim0094.csv
    Ignored:    sbatch/makefile_demo/sims/sim0095.csv
    Ignored:    sbatch/makefile_demo/sims/sim0096.csv
    Ignored:    sbatch/makefile_demo/sims/sim0097.csv
    Ignored:    sbatch/makefile_demo/sims/sim0098.csv
    Ignored:    sbatch/makefile_demo/sims/sim0099.csv
    Ignored:    sbatch/makefile_demo/sims/sim0100.csv
    Ignored:    sbatch/makefile_demo/sims/sim0101.csv
    Ignored:    sbatch/makefile_demo/sims/sim0102.csv
    Ignored:    sbatch/makefile_demo/sims/sim0103.csv
    Ignored:    sbatch/makefile_demo/sims/sim0104.csv
    Ignored:    sbatch/makefile_demo/sims/sim0105.csv
    Ignored:    sbatch/makefile_demo/sims/sim0106.csv
    Ignored:    sbatch/makefile_demo/sims/sim0107.csv
    Ignored:    sbatch/makefile_demo/sims/sim0108.csv
    Ignored:    sbatch/makefile_demo/sims/sim0109.csv
    Ignored:    sbatch/makefile_demo/sims/sim0110.csv
    Ignored:    sbatch/makefile_demo/sims/sim0111.csv
    Ignored:    sbatch/makefile_demo/sims/sim0112.csv
    Ignored:    sbatch/makefile_demo/sims/sim0113.csv
    Ignored:    sbatch/makefile_demo/sims/sim0114.csv
    Ignored:    sbatch/makefile_demo/sims/sim0115.csv
    Ignored:    sbatch/makefile_demo/sims/sim0116.csv
    Ignored:    sbatch/makefile_demo/sims/sim0117.csv
    Ignored:    sbatch/makefile_demo/sims/sim0118.csv
    Ignored:    sbatch/makefile_demo/sims/sim0119.csv
    Ignored:    sbatch/makefile_demo/sims/sim0120.csv
    Ignored:    sbatch/makefile_demo/sims/sim0121.csv
    Ignored:    sbatch/makefile_demo/sims/sim0122.csv
    Ignored:    sbatch/makefile_demo/sims/sim0123.csv
    Ignored:    sbatch/makefile_demo/sims/sim0124.csv
    Ignored:    sbatch/makefile_demo/sims/sim0125.csv
    Ignored:    sbatch/makefile_demo/sims/sim0126.csv
    Ignored:    sbatch/makefile_demo/sims/sim0127.csv
    Ignored:    sbatch/makefile_demo/sims/sim0128.csv
    Ignored:    sbatch/makefile_demo/sims/sim0129.csv
    Ignored:    sbatch/makefile_demo/sims/sim0130.csv
    Ignored:    sbatch/makefile_demo/sims/sim0131.csv
    Ignored:    sbatch/makefile_demo/sims/sim0132.csv
    Ignored:    sbatch/makefile_demo/sims/sim0133.csv
    Ignored:    sbatch/makefile_demo/sims/sim0134.csv
    Ignored:    sbatch/makefile_demo/sims/sim0135.csv
    Ignored:    sbatch/makefile_demo/sims/sim0136.csv
    Ignored:    sbatch/makefile_demo/sims/sim0137.csv
    Ignored:    sbatch/makefile_demo/sims/sim0138.csv
    Ignored:    sbatch/makefile_demo/sims/sim0139.csv
    Ignored:    sbatch/makefile_demo/sims/sim0140.csv
    Ignored:    sbatch/makefile_demo/sims/sim0141.csv
    Ignored:    sbatch/makefile_demo/sims/sim0142.csv
    Ignored:    sbatch/makefile_demo/sims/sim0143.csv
    Ignored:    sbatch/makefile_demo/sims/sim0144.csv
    Ignored:    sbatch/makefile_demo/sims/sim0145.csv
    Ignored:    sbatch/makefile_demo/sims/sim0146.csv
    Ignored:    sbatch/makefile_demo/sims/sim0147.csv
    Ignored:    sbatch/makefile_demo/sims/sim0148.csv
    Ignored:    sbatch/makefile_demo/sims/sim0149.csv
    Ignored:    sbatch/makefile_demo/sims/sim0150.csv
    Ignored:    sbatch/makefile_demo/sims/sim0151.csv
    Ignored:    sbatch/makefile_demo/sims/sim0152.csv
    Ignored:    sbatch/makefile_demo/sims/sim0153.csv
    Ignored:    sbatch/makefile_demo/sims/sim0154.csv
    Ignored:    sbatch/makefile_demo/sims/sim0155.csv
    Ignored:    sbatch/makefile_demo/sims/sim0156.csv
    Ignored:    sbatch/makefile_demo/sims/sim0157.csv
    Ignored:    sbatch/makefile_demo/sims/sim0158.csv
    Ignored:    sbatch/makefile_demo/sims/sim0159.csv
    Ignored:    sbatch/makefile_demo/sims/sim0160.csv
    Ignored:    sbatch/makefile_demo/sims/sim0161.csv
    Ignored:    sbatch/makefile_demo/sims/sim0162.csv
    Ignored:    sbatch/makefile_demo/sims/sim0163.csv
    Ignored:    sbatch/makefile_demo/sims/sim0164.csv
    Ignored:    sbatch/makefile_demo/sims/sim0165.csv
    Ignored:    sbatch/makefile_demo/sims/sim0166.csv
    Ignored:    sbatch/makefile_demo/sims/sim0167.csv
    Ignored:    sbatch/makefile_demo/sims/sim0168.csv
    Ignored:    sbatch/makefile_demo/sims/sim0169.csv
    Ignored:    sbatch/makefile_demo/sims/sim0170.csv
    Ignored:    sbatch/makefile_demo/sims/sim0171.csv
    Ignored:    sbatch/makefile_demo/sims/sim0172.csv
    Ignored:    sbatch/makefile_demo/sims/sim0173.csv
    Ignored:    sbatch/makefile_demo/sims/sim0174.csv
    Ignored:    sbatch/makefile_demo/sims/sim0175.csv
    Ignored:    sbatch/makefile_demo/sims/sim0176.csv
    Ignored:    sbatch/makefile_demo/sims/sim0177.csv
    Ignored:    sbatch/makefile_demo/sims/sim0178.csv
    Ignored:    sbatch/makefile_demo/sims/sim0179.csv
    Ignored:    sbatch/makefile_demo/sims/sim0180.csv
    Ignored:    sbatch/makefile_demo/sims/sim0181.csv
    Ignored:    sbatch/makefile_demo/sims/sim0182.csv
    Ignored:    sbatch/makefile_demo/sims/sim0183.csv
    Ignored:    sbatch/makefile_demo/sims/sim0184.csv
    Ignored:    sbatch/makefile_demo/sims/sim0185.csv
    Ignored:    sbatch/makefile_demo/sims/sim0186.csv
    Ignored:    sbatch/makefile_demo/sims/sim0187.csv
    Ignored:    sbatch/makefile_demo/sims/sim0188.csv
    Ignored:    sbatch/makefile_demo/sims/sim0189.csv
    Ignored:    sbatch/makefile_demo/sims/sim0190.csv
    Ignored:    sbatch/makefile_demo/sims/sim0191.csv
    Ignored:    sbatch/makefile_demo/sims/sim0192.csv
    Ignored:    sbatch/makefile_demo/sims/sim0193.csv
    Ignored:    sbatch/makefile_demo/sims/sim0194.csv
    Ignored:    sbatch/makefile_demo/sims/sim0195.csv
    Ignored:    sbatch/makefile_demo/sims/sim0196.csv
    Ignored:    sbatch/makefile_demo/sims/sim0197.csv
    Ignored:    sbatch/makefile_demo/sims/sim0198.csv
    Ignored:    sbatch/makefile_demo/sims/sim0199.csv
    Ignored:    sbatch/makefile_demo/sims/sim0200.csv
    Ignored:    sbatch/makefile_demo/sims/sim0201.csv
    Ignored:    sbatch/makefile_demo/sims/sim0202.csv
    Ignored:    sbatch/makefile_demo/sims/sim0203.csv
    Ignored:    sbatch/makefile_demo/sims/sim0204.csv
    Ignored:    sbatch/makefile_demo/sims/sim0205.csv
    Ignored:    sbatch/makefile_demo/sims/sim0206.csv
    Ignored:    sbatch/makefile_demo/sims/sim0207.csv
    Ignored:    sbatch/makefile_demo/sims/sim0208.csv
    Ignored:    sbatch/makefile_demo/sims/sim0209.csv
    Ignored:    sbatch/makefile_demo/sims/sim0210.csv
    Ignored:    sbatch/makefile_demo/sims/sim0211.csv
    Ignored:    sbatch/makefile_demo/sims/sim0212.csv
    Ignored:    sbatch/makefile_demo/sims/sim0213.csv
    Ignored:    sbatch/makefile_demo/sims/sim0214.csv
    Ignored:    sbatch/makefile_demo/sims/sim0215.csv
    Ignored:    sbatch/makefile_demo/sims/sim0216.csv
    Ignored:    sbatch/makefile_demo/sims/sim0217.csv
    Ignored:    sbatch/makefile_demo/sims/sim0218.csv
    Ignored:    sbatch/makefile_demo/sims/sim0219.csv
    Ignored:    sbatch/makefile_demo/sims/sim0220.csv
    Ignored:    sbatch/makefile_demo/sims/sim0221.csv
    Ignored:    sbatch/makefile_demo/sims/sim0222.csv
    Ignored:    sbatch/makefile_demo/sims/sim0223.csv
    Ignored:    sbatch/makefile_demo/sims/sim0224.csv
    Ignored:    sbatch/makefile_demo/sims/sim0225.csv
    Ignored:    sbatch/makefile_demo/sims/sim0226.csv
    Ignored:    sbatch/makefile_demo/sims/sim0227.csv
    Ignored:    sbatch/makefile_demo/sims/sim0228.csv
    Ignored:    sbatch/makefile_demo/sims/sim0229.csv
    Ignored:    sbatch/makefile_demo/sims/sim0230.csv
    Ignored:    sbatch/makefile_demo/sims/sim0231.csv
    Ignored:    sbatch/makefile_demo/sims/sim0232.csv
    Ignored:    sbatch/makefile_demo/sims/sim0233.csv
    Ignored:    sbatch/makefile_demo/sims/sim0234.csv
    Ignored:    sbatch/makefile_demo/sims/sim0235.csv
    Ignored:    sbatch/makefile_demo/sims/sim0236.csv
    Ignored:    sbatch/makefile_demo/sims/sim0237.csv
    Ignored:    sbatch/makefile_demo/sims/sim0238.csv
    Ignored:    sbatch/makefile_demo/sims/sim0239.csv
    Ignored:    sbatch/makefile_demo/sims/sim0240.csv
    Ignored:    sbatch/makefile_demo/sims/sim0241.csv
    Ignored:    sbatch/makefile_demo/sims/sim0242.csv
    Ignored:    sbatch/makefile_demo/sims/sim0243.csv
    Ignored:    sbatch/makefile_demo/sims/sim0244.csv
    Ignored:    sbatch/makefile_demo/sims/sim0245.csv
    Ignored:    sbatch/makefile_demo/sims/sim0246.csv
    Ignored:    sbatch/makefile_demo/sims/sim0247.csv
    Ignored:    sbatch/makefile_demo/sims/sim0248.csv
    Ignored:    sbatch/makefile_demo/sims/sim0249.csv
    Ignored:    sbatch/makefile_demo/sims/sim0250.csv

Untracked files:
    Untracked:  R/demo.nmf.R
    Untracked:  R/nmfmu.R

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/susie_jrssb_example.Rmd) and HTML (docs/susie_jrssb_example.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 730b73b Peter Carbonetto 2020-01-15 wflow_publish(“susie_jrssb_example.Rmd”)
html 1a30594 Peter Carbonetto 2020-01-15 A few fixes to the susie example.
Rmd 5bfb0a2 Peter Carbonetto 2020-01-15 wflow_publish(“susie_jrssb_example.Rmd”)
Rmd 2b5482b Peter Carbonetto 2020-01-15 Minor edit to susie example.
html e0c7ea6 Peter Carbonetto 2020-01-15 Made a few small revisions to the susie example.
Rmd 0e08193 Peter Carbonetto 2020-01-15 wflow_publish(“susie_jrssb_example.Rmd”)
html 72fe4c0 Peter Carbonetto 2020-01-15 I have a complete first draft of the susie example.
Rmd 63a0e77 Peter Carbonetto 2020-01-15 wflow_publish(“susie_jrssb_example.Rmd”)
html 81df87b Peter Carbonetto 2020-01-15 Added more to susie example.
Rmd e69de40 Peter Carbonetto 2020-01-15 wflow_publish(“susie_jrssb_example.Rmd”)
Rmd a70ba28 Peter Carbonetto 2020-01-14 Removed old home page.
html 040c081 Peter Carbonetto 2020-01-14 Adjusted the knitr settings in the susie example.
Rmd 88668a4 Peter Carbonetto 2020-01-14 wflow_publish(“susie_jrssb_example.Rmd”)
html f73d1cb Peter Carbonetto 2020-01-14 First build of the susie example.
Rmd fd08150 Peter Carbonetto 2020-01-14 wflow_publish(“susie_jrssb_example.Rmd”)
Rmd 781b68e Peter Carbonetto 2020-01-14 Added/modified workflowr files.
Rmd 43ad1c3 Peter Carbonetto 2020-01-14 Added workflowr files.

Here we explore the behaviour of SuSiE in a toy example where the correlations between the predictors are not so straightforward. Despite being more complicated, SuSiE still correctly infers Credible Sets.

Load packages

The mvtnorm package is used to simulate the data.

library(mvtnorm)
library(varbvs)
library(susieR)

Overview

One of the referees was interested in understanding the behaviour of SuSiE in an example in which the correlation structure is slightly more complex than the motivating example provided in the paper.

Consider five correlated predictors in a simple linear regression, \(y = x_1\beta_1, \ldots, x_5\beta_5\), in which only two variables, \(x1\) and \(x3\), have an effect on the outcome, \(y\); that is, the coefficients \(\beta_1\) and \(\beta_3\) are both nonzero. The first two predictors are very strongly correlated with each other, and the third and fourth predictors are also very strongly correlated. Therefore, it will be difficult to distinguish between \(x1\) and \(x2\), and likewise for \(x3\) and \(x4\). This correlation structure is the same as the simple motivating example given in the paper.

To complicate the example, there is a fifth predictor that has no effect on the outcome, and is also strongly correlated with the other variables. This is the correlation matrix for the five predictors:

S <- rbind(c(   1, 0.99,  0.8,  0.8, 0.9),
           c(0.99,    1,  0.8,  0.8, 0.9),
           c( 0.8,  0.8,    1, 0.99, 0.9),
           c( 0.8,  0.8, 0.99,    1, 0.9),
           c( 0.9,  0.9,  0.9,  0.9,   1))

Therefore, without an abundance of data, it will be difficult to distinguish between variables 1, 2 and 5, and likewise for variables 3, 4 and 5. The inferential statement that would best capture our uncertainty about which variables affect the outcome would look something like this:

\[\mbox{Among coefficients $\beta_1, \ldots, \beta_5$, two (or more) are not zero}\]

SuSiE is not designed to produce such inferential statements, but could state instead:

\[(\beta_1 \neq 0 \mbox{ or } \beta_2 \neq 0 \mbox{ or } \beta_5 \neq 0) \mbox{ and } (\beta_3 \neq 0 \mbox{ or } \beta_4 \neq 0)\]

Another valid statement could be:

\[(\beta_1 \neq 0 \mbox{ or } \beta_2 \neq 0) \mbox{ and } (\beta_3 \neq 0 \mbox{ or } \beta_4 \neq 0 \mbox{ or } \beta_5 \neq 0)\]

Although neither of these statements completely capture our uncertainty about which variables affect the outcome, it does satisfy our aim as it is stated in the paper:

"A key feature of our method, which distinguishes it from most existing BVSR methods, is that it produces Credible Sets of variables that quantify uncertainty in which variable should be selected when multiple, highly correlated variables compete with one another. These Credible Sets are designed to be as small as possible while still each capturing a relevant variable.

The key point here is that the Credible Sets are not intended to capture full uncertainty in which variables should be selected. But they are intended to capture all relevant variables.

Below, we investigate these claims empirically.

Simulate data

We simulate 200 samples in this scenario.

set.seed(1)
n <- 200
b <- c(1, 0, -1, 0, 0)
X <- rmvnorm(n,sigma = S)
y <- drop(X %*% b + rnorm(n)/0.3)

Multiple regression using varbvs

First, to provide a counterexample that does not accomplish what we set out to achieve, we fit the “varbvs” model, and show that varbvs, although similar to SuSiE in many ways, does not adequately capture uncertainty in the selected variables.

fit1 <- varbvs(X,NULL,y,logodds = log10(0.5),sa = 1,verbose = FALSE)
summary(fit1)$top.vars
#   index variable       prob         PVE          coef  Pr(coef.>0.95)
# 1     3       X3 0.99995825 0.128995948 -1.3311483474 [-1.836,-0.826]
# 2     1       X1 0.98264586 0.073088751  0.9266196082 [+0.460,+1.425]
# 3     4       X4 0.03756227 0.004674475  0.0005357177 [-0.495,+0.524]
# 4     5       X5 0.03643073 0.004849222 -0.0017998663 [-0.534,+0.435]
# 5     2       X2 0.03618984 0.004751830  0.0012398904 [-0.452,+0.521]

varbvs has correctly determined that two variables are useful for predicting the outcome. However, it incorrectly placed all the weight on the first and third variables. This is expected behaviour—it is due to the particular variational approximation used in varbvs—but it is undesirable when we want to better quantify uncertainty in the correlated variables.

Multiple regression using SuSiE

Next, we fit a SuSiE model. (For simplicity, we fit a SuSiE model with \(L = 2\), but SuSiE will give similar results for \(L > 2\).)

fit2 <- susie(X,y,L = 2,standardize = FALSE,estimate_prior_variance = FALSE,
              scaled_prior_variance = 1,min_abs_corr = 0)
susie_get_cs(fit2,X,min_abs_corr = 0)$cs
# $L2
# [1] 1 2 5
# 
# $L1
# [1] 3 4 5

SuSiE identified two Credible Sets:

\[(\beta_1 \neq 0 \mbox{ or } \beta_2 \neq 0 \mbox{ or } \beta_5 \neq 0) \mbox{ and } (\beta_3 \neq 0 \mbox{ or } \beta_4 \neq 0 \mbox{ or } \beta_5 \neq 0)\]

Looking more closely at the posterior inclusion probabilities, most of the weight is assigned to \(x_3\) and \(x_4\) in the first Credible Set, and to \(x_1\) and \(x_2\) in the second Credible Set, and, in light of the strong correlations with \(x_5\), each Credible Set also allows for the possibility that \(x_5\) affects the outcome:

round(fit2$alpha,digits = 3)
#       [,1]  [,2]  [,3]  [,4]  [,5]
# [1,] 0.001 0.001 0.628 0.319 0.051
# [2,] 0.466 0.477 0.010 0.012 0.035

Therefore, although this statement is not the same as, “among coefficients \(\beta_1, \ldots, \beta_5\), two (or more) are not zero”, SuSiE still has correctly achieves the useful aim of identifying “Credible Sets” that capture all relevant variables.


sessionInfo()
# R version 3.6.2 (2019-12-12)
# Platform: x86_64-apple-darwin15.6.0 (64-bit)
# Running under: macOS Catalina 10.15.2
# 
# Matrix products: default
# BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
# LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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.9.0.0575 varbvs_2.6-5      mvtnorm_1.0-11   
# 
# loaded via a namespace (and not attached):
#  [1] Rcpp_1.0.3           knitr_1.26           whisker_0.4         
#  [4] magrittr_1.5         workflowr_1.6.0.9000 lattice_0.20-38     
#  [7] R6_2.4.1             jpeg_0.1-8.1         rlang_0.4.2         
# [10] nor1mix_1.3-0        stringr_1.4.0        tools_3.6.2         
# [13] grid_3.6.2           xfun_0.11            png_0.1-7           
# [16] latticeExtra_0.6-29  git2r_0.26.1         htmltools_0.4.0     
# [19] yaml_2.2.0           digest_0.6.23        rprojroot_1.3-2     
# [22] Matrix_1.2-18        RColorBrewer_1.1-2   later_1.0.0         
# [25] promises_1.1.0       fs_1.3.1             glue_1.3.1          
# [28] evaluate_0.14        rmarkdown_2.0        stringi_1.4.3       
# [31] compiler_3.6.2       backports_1.1.5      httpuv_1.5.2