Last updated: 2020-04-28

Checks: 7 0

Knit directory: mr_mash_test/

This reproducible R Markdown analysis was created with workflowr (version 1.6.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(20200328) 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 9bdcd02. 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:    .sos/
    Ignored:    code/fit_mr_mash.66662433.err
    Ignored:    code/fit_mr_mash.66662433.out
    Ignored:    dsc/.sos/
    Ignored:    dsc/outfiles/
    Ignored:    output/dsc.html
    Ignored:    output/dsc/
    Ignored:    output/dsc_OLD.html
    Ignored:    output/dsc_OLD/

Untracked files:
    Untracked:  code/plot_test.R
    Untracked:  dsc/dsc.scripts.html

Unstaged changes:
    Modified:   dsc/midway2.yml

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/results_convergence.Rmd) and HTML (docs/results_convergence.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
html 3d61182 fmorgante 2020-04-28 Build site.
html 8ed3a7f fmorgante 2020-04-28 Build site.
html f2fa981 fmorgante 2020-04-28 Build site.
html e2c9550 fmorgante 2020-04-16 Build site.
html 161eea7 fmorgante 2020-04-16 Build site.
html dd40784 fmorgante 2020-04-16 Build site.
html 8f4456e fmorgante 2020-04-16 Build site.
html 422658e fmorgante 2020-04-16 Build site.
html 04f5485 fmorgante 2020-03-30 Build site.
Rmd df91113 fmorgante 2020-03-30 Add info about convergence
html cc50c05 fmorgante 2020-03-30 Build site.
Rmd ec880d7 fmorgante 2020-03-30 Adjust date format
html 378e278 fmorgante 2020-03-30 Build site.
Rmd e4b5d3f fmorgante 2020-03-30 Add simulation 4
html 40cd0cf fmorgante 2020-03-30 Build site.
Rmd a3d9023 fmorgante 2020-03-30 Add plots and additional info
html b48d34d fmorgante 2020-03-30 Build site.
html 7a2afe7 fmorgante 2020-03-30 Build site.
Rmd b3eb015 fmorgante 2020-03-30 Add simulation 3
html f7e2f68 fmorgante 2020-03-30 Build site.
html 4f5c291 fmorgante 2020-03-30 Build site.
Rmd f4eb72a fmorgante 2020-03-30 Add simulation 2
html 8621d7d fmorgante 2020-03-30 Build site.
Rmd 1cfb1f8 fmorgante 2020-03-30 Slight improvements
html d5773c9 fmorgante 2020-03-30 Build site.
Rmd 749d2ca fmorgante 2020-03-30 Add convergence results
html 07a9b4d fmorgante 2020-03-30 Build site.
html f2c716e fmorgante 2020-03-30 Build site.
html 8e7a5b5 fmorgante 2020-03-30 Build site.
html 4e9aad6 fmorgante 2020-03-30 Build site.
html 7911e81 fmorgante 2020-03-30 Build site.
html e1707b2 fmorgante 2020-03-30 Build site.
html f2451af fmorgante 2020-03-29 Build site.
html 2fe7214 fmorgante 2020-03-29 Build site.
Rmd d43e6a6 fmorgante 2020-03-29 Set current date automatically
html dbf0d8e fmorgante 2020-03-29 Build site.
Rmd 65fb659 fmorgante 2020-03-29 Add convergence example
html c71dfff fmorgante 2020-03-29 Build site.
Rmd bafd72f fmorgante 2020-03-29 Modify titles and author
html 796c93e fmorgante 2020-03-29 Build site.
Rmd ed9843a fmorgante 2020-03-29 Add additional pages

options(stringsAsFactors = FALSE)

Simulation 1 – Shared effects, independent variables

dat1 <- readRDS("output/fit_mr_mash_n600_p1000_p_caus50_r5_pve0.5_sigmaoffdiag1_sigmascale0.8_gammaoffdiag0_gammascale0.8_Voffdiag0.2_Vscale0_updatew0TRUE_updatew0TRUE_updatew0methodmixsqp_updateVTRUE.rds")
n1 <- dat1$params$n
p1 <- dat1$params$p
p_causal1 <- dat1$params$p_causal
r1 <- dat1$params$r
k1 <- length(dat1$fit$w0)
pve1 <- dat1$params$pve
prop_testset1 <- dat1$params$prop_testset
progress_dat1 <- dat1$fit$progress
V1 <- dat1$inputs$V
Sigma1 <- dat1$inputs$Sigma
Gamma1 <- dat1$inputs$Gamma

The results below are based on simulation with 600 samples, 1000 variables of which 50 were causal, 5 responses with a per-response proportion of variance explained (PVE) of 0.5. Variables, X, were drawn from MVN(0, Gamma), causal effects, B, were drawn from MVN(0, Sigma). The responses, Y, were drawn from MN(XB, I, V).

cat("Gamma (First 5 elements)")
Gamma (First 5 elements)
Gamma1[1:5, 1:5]
     [,1] [,2] [,3] [,4] [,5]
[1,]  0.8  0.0  0.0  0.0  0.0
[2,]  0.0  0.8  0.0  0.0  0.0
[3,]  0.0  0.0  0.8  0.0  0.0
[4,]  0.0  0.0  0.0  0.8  0.0
[5,]  0.0  0.0  0.0  0.0  0.8
cat("Sigma")
Sigma
Sigma1
     [,1] [,2] [,3] [,4] [,5]
[1,]  0.8  0.8  0.8  0.8  0.8
[2,]  0.8  0.8  0.8  0.8  0.8
[3,]  0.8  0.8  0.8  0.8  0.8
[4,]  0.8  0.8  0.8  0.8  0.8
[5,]  0.8  0.8  0.8  0.8  0.8
cat("V")
V
V1
         [,1]     [,2]     [,3]     [,4]     [,5]
[1,] 25.55836  0.00000  0.00000  0.00000  0.00000
[2,]  0.00000 25.55836  0.00000  0.00000  0.00000
[3,]  0.00000  0.00000 25.55836  0.00000  0.00000
[4,]  0.00000  0.00000  0.00000 25.55836  0.00000
[5,]  0.00000  0.00000  0.00000  0.00000 25.55836

mr.mash was fitted to the training data (80% of the data) updating V and updating the prior weights using mixSQP. The mixture prior consisted of 101 components.

Here, we investigate convergence. Convergence was reached when max(\(mu1_{t}\) - \(mu1_{t-1}\)) was less than 1e-8.

plot(progress_dat1$iter, progress_dat1$ELBO_diff, xlab="Iteration", ylab="log Difference in ELBO", main="ELBO vs iteration", type="b", pch=16, cex.lab=1.5, cex.axis=1.5, log="y")
Warning in xy.coords(x, y, xlabel, ylabel, log): 7 y values <= 0 omitted
from logarithmic plot

Version Author Date
422658e fmorgante 2020-04-16
40cd0cf fmorgante 2020-03-30
plot(progress_dat1$iter, progress_dat1$mu1_max.diff, xlab="Iteration", ylab="log max(Difference in mu1)", main="mu1 vs iteration", type="b", pch=16, cex.lab=1.5, cex.axis=1.5, log="y")

Version Author Date
422658e fmorgante 2020-04-16
04f5485 fmorgante 2020-03-30
40cd0cf fmorgante 2020-03-30

Simulation 2 – Independent effects, independent variables

dat2 <- readRDS("output/fit_mr_mash_n600_p1000_p_caus50_r5_pve0.5_sigmaoffdiag0_sigmascale0.8_gammaoffdiag0_gammascale0.8_Voffdiag0.2_Vscale0_updatew0TRUE_updatew0TRUE_updatew0methodmixsqp_updateVTRUE.rds")
n2 <- dat2$params$n
p2 <- dat2$params$p
p_causal2 <- dat2$params$p_causal
r2 <- dat2$params$r
k2 <- length(dat2$fit$w0)
pve2 <- dat2$params$pve
prop_testset2 <- dat2$params$prop_testset
progress_dat2 <- dat2$fit$progress
V2 <- dat2$inputs$V
Sigma2 <- dat2$inputs$Sigma
Gamma2 <- dat2$inputs$Gamma

The results below are based on simulation with 600 samples, 1000 variables of which 50 were causal, 5 responses with a per-response proportion of variance explained (PVE) of 0.5. Variables, X, were drawn from MVN(0, Gamma), causal effects, B, were drawn from MVN(0, Sigma). The responses, Y, were drawn from MN(XB, I, V).

cat("Gamma (First 5 elements)")
Gamma (First 5 elements)
Gamma2[1:5, 1:5]
     [,1] [,2] [,3] [,4] [,5]
[1,]  0.8  0.0  0.0  0.0  0.0
[2,]  0.0  0.8  0.0  0.0  0.0
[3,]  0.0  0.0  0.8  0.0  0.0
[4,]  0.0  0.0  0.0  0.8  0.0
[5,]  0.0  0.0  0.0  0.0  0.8
cat("Sigma")
Sigma
Sigma2
     [,1] [,2] [,3] [,4] [,5]
[1,]  0.8  0.0  0.0  0.0  0.0
[2,]  0.0  0.8  0.0  0.0  0.0
[3,]  0.0  0.0  0.8  0.0  0.0
[4,]  0.0  0.0  0.0  0.8  0.0
[5,]  0.0  0.0  0.0  0.0  0.8
cat("V")
V
V2
         [,1]     [,2]     [,3]     [,4]     [,5]
[1,] 39.87305  0.00000  0.00000  0.00000  0.00000
[2,]  0.00000 24.41042  0.00000  0.00000  0.00000
[3,]  0.00000  0.00000 27.69452  0.00000  0.00000
[4,]  0.00000  0.00000  0.00000 25.53166  0.00000
[5,]  0.00000  0.00000  0.00000  0.00000 29.00472

mr.mash was fitted to the training data (80% of the data) updating V and updating the prior weights using mixSQP. The mixture prior consisted of 101 components.

Here, we investigate convergence. Convergence was reached when max(\(mu1_{t}\) - \(mu1_{t-1}\)) was less than 1e-8.

plot(progress_dat2$iter, progress_dat2$ELBO_diff, xlab="Iteration", ylab="log Difference in ELBO", main="ELBO vs iteration", type="b", pch=16, cex.lab=1.5, cex.axis=1.5, log="y")
Warning in xy.coords(x, y, xlabel, ylabel, log): 13 y values <= 0 omitted
from logarithmic plot

Version Author Date
422658e fmorgante 2020-04-16
40cd0cf fmorgante 2020-03-30
plot(progress_dat2$iter, progress_dat2$mu1_max.diff, xlab="Iteration", ylab="log max(Difference in mu1)", main="mu1 vs iteration", type="b", pch=16, cex.lab=1.5, cex.axis=1.5, log="y")

Version Author Date
422658e fmorgante 2020-04-16
04f5485 fmorgante 2020-03-30
40cd0cf fmorgante 2020-03-30

Simulation 3 – Shared effects, correlated variables

dat3 <- readRDS("output/fit_mr_mash_n600_p1000_p_caus50_r5_pve0.5_sigmaoffdiag1_sigmascale0.8_gammaoffdiag0.5_gammascale0.8_Voffdiag0.2_Vscale0_updatew0TRUE_updatew0TRUE_updatew0methodmixsqp_updateVTRUE.rds")
n3 <- dat3$params$n
p3 <- dat3$params$p
p_causal3 <- dat3$params$p_causal
r3 <- dat3$params$r
k3 <- length(dat3$fit$w0)
pve3 <- dat3$params$pve
prop_testset3 <- dat3$params$prop_testset
progress_dat3 <- dat3$fit$progress
V3 <- dat3$inputs$V
Sigma3 <- dat3$inputs$Sigma
Gamma3 <- dat3$inputs$Gamma

The results below are based on simulation with 600 samples, 1000 variables of which 50 were causal, 5 responses with a per-response proportion of variance explained (PVE) of 0.5. Variables, X, were drawn from MVN(0, Gamma), causal effects, B, were drawn from MVN(0, Sigma). The responses, Y, were drawn from MN(XB, I, V).

cat("Gamma (First 5 elements)")
Gamma (First 5 elements)
Gamma3[1:5, 1:5]
     [,1] [,2] [,3] [,4] [,5]
[1,]  0.8  0.4  0.4  0.4  0.4
[2,]  0.4  0.8  0.4  0.4  0.4
[3,]  0.4  0.4  0.8  0.4  0.4
[4,]  0.4  0.4  0.4  0.8  0.4
[5,]  0.4  0.4  0.4  0.4  0.8
cat("Sigma")
Sigma
Sigma3
     [,1] [,2] [,3] [,4] [,5]
[1,]  0.8  0.8  0.8  0.8  0.8
[2,]  0.8  0.8  0.8  0.8  0.8
[3,]  0.8  0.8  0.8  0.8  0.8
[4,]  0.8  0.8  0.8  0.8  0.8
[5,]  0.8  0.8  0.8  0.8  0.8
cat("V")
V
V3
         [,1]     [,2]     [,3]     [,4]     [,5]
[1,] 13.98626  0.00000  0.00000  0.00000  0.00000
[2,]  0.00000 13.98625  0.00000  0.00000  0.00000
[3,]  0.00000  0.00000 13.98625  0.00000  0.00000
[4,]  0.00000  0.00000  0.00000 13.98625  0.00000
[5,]  0.00000  0.00000  0.00000  0.00000 13.98625

mr.mash was fitted to the training data (80% of the data) updating V and updating the prior weights using mixSQP. The mixture prior consisted of 101 components.

Here, we investigate convergence. Convergence was reached when max(\(mu1_{t}\) - \(mu1_{t-1}\)) was less than 1e-8.

plot(progress_dat3$iter, progress_dat3$ELBO_diff, xlab="Iteration", ylab="log Difference in ELBO", main="ELBO vs iteration", type="b", pch=16, cex.lab=1.5, cex.axis=1.5, log="y")
Warning in xy.coords(x, y, xlabel, ylabel, log): 18 y values <= 0 omitted
from logarithmic plot

Version Author Date
422658e fmorgante 2020-04-16
378e278 fmorgante 2020-03-30
40cd0cf fmorgante 2020-03-30
plot(progress_dat3$iter, progress_dat3$mu1_max.diff, xlab="Iteration", ylab="log max(Difference in mu1)", main="mu1 vs iteration", type="b", pch=16, cex.lab=1.5, cex.axis=1.5, log="y")

Version Author Date
422658e fmorgante 2020-04-16
04f5485 fmorgante 2020-03-30
378e278 fmorgante 2020-03-30
40cd0cf fmorgante 2020-03-30

Simulation 4 – Independent effects, correlated variables

dat4 <- readRDS("output/fit_mr_mash_n600_p1000_p_caus50_r5_pve0.5_sigmaoffdiag0_sigmascale0.8_gammaoffdiag0.5_gammascale0.8_Voffdiag0.2_Vscale0_updatew0TRUE_updatew0TRUE_updatew0methodmixsqp_updateVTRUE.rds")
n4 <- dat4$params$n
p4 <- dat4$params$p
p_causal4 <- dat4$params$p_causal
r4 <- dat4$params$r
k4 <- length(dat4$fit$w0)
pve4 <- dat4$params$pve
prop_testset4 <- dat4$params$prop_testset
progress_dat4 <- dat4$fit$progress
V4 <- dat4$inputs$V
Sigma4 <- dat4$inputs$Sigma
Gamma4 <- dat4$inputs$Gamma

The results below are based on simulation with 600 samples, 1000 variables of which 50 were causal, 5 responses with a per-response proportion of variance explained (PVE) of 0.5. Variables, X, were drawn from MVN(0, Gamma), causal effects, B, were drawn from MVN(0, Sigma). The responses, Y, were drawn from MN(XB, I, V).

cat("Gamma (First 5 elements)")
Gamma (First 5 elements)
Gamma4[1:5, 1:5]
     [,1] [,2] [,3] [,4] [,5]
[1,]  0.8  0.4  0.4  0.4  0.4
[2,]  0.4  0.8  0.4  0.4  0.4
[3,]  0.4  0.4  0.8  0.4  0.4
[4,]  0.4  0.4  0.4  0.8  0.4
[5,]  0.4  0.4  0.4  0.4  0.8
cat("Sigma")
Sigma
Sigma4
     [,1] [,2] [,3] [,4] [,5]
[1,]  0.8  0.0  0.0  0.0  0.0
[2,]  0.0  0.8  0.0  0.0  0.0
[3,]  0.0  0.0  0.8  0.0  0.0
[4,]  0.0  0.0  0.0  0.8  0.0
[5,]  0.0  0.0  0.0  0.0  0.8
cat("V")
V
V4
         [,1]     [,2]     [,3]     [,4]     [,5]
[1,] 31.75545  0.00000  0.00000  0.00000  0.00000
[2,]  0.00000 31.47091  0.00000  0.00000  0.00000
[3,]  0.00000  0.00000 14.55202  0.00000  0.00000
[4,]  0.00000  0.00000  0.00000 42.12604  0.00000
[5,]  0.00000  0.00000  0.00000  0.00000 15.37456

mr.mash was fitted to the training data (80% of the data) updating V and updating the prior weights using mixSQP. The mixture prior consisted of 101 components.

Here, we investigate convergence. Convergence was reached when max(\(mu1_{t}\) - \(mu1_{t-1}\)) was less than 1e-8.

plot(progress_dat4$iter, progress_dat4$ELBO_diff, xlab="Iteration", ylab="log Difference in ELBO", main="ELBO vs iteration", type="b", pch=16, cex.lab=1.5, cex.axis=1.5, log="y")

Version Author Date
422658e fmorgante 2020-04-16
378e278 fmorgante 2020-03-30
plot(progress_dat4$iter, progress_dat4$mu1_max.diff, xlab="Iteration", ylab="log max(Difference in mu1)", main="mu1 vs iteration", type="b", pch=16, cex.lab=1.5, cex.axis=1.5, log="y")

Version Author Date
422658e fmorgante 2020-04-16
04f5485 fmorgante 2020-03-30
378e278 fmorgante 2020-03-30

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)

Matrix products: default
BLAS/LAPACK: /software/openblas-0.2.19-el7-x86_64/lib/libopenblas_haswellp-r0.2.19.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] workflowr_1.6.1 Rcpp_1.0.4.6    digest_0.6.25   later_0.7.5    
 [5] rprojroot_1.3-2 R6_2.4.1        backports_1.1.5 git2r_0.26.1   
 [9] magrittr_1.5    evaluate_0.12   stringi_1.4.3   fs_1.3.1       
[13] promises_1.0.1  whisker_0.3-2   rmarkdown_1.10  tools_3.5.1    
[17] stringr_1.4.0   glue_1.4.0      httpuv_1.4.5    yaml_2.2.1     
[21] compiler_3.5.1  htmltools_0.3.6 knitr_1.20