Last updated: 2019-03-03
workflowr checks: (Click a bullet for more information) ✔ R Markdown file: up-to-date
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.
✔ Environment: empty
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.
✔ Seed:
set.seed(20190115)
The command set.seed(20190115) 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.
✔ Session information: recorded
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
✔ Repository version: 28260cb
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: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: .sos/
Ignored: data/.DS_Store
Ignored: output/.DS_Store
Untracked files:
Untracked: analysis/SuSiEDAP_Power_data31_35.Rmd
Untracked: analysis/SuSiERobustNum.Rmd
Untracked: data/random_data_31.rds
Untracked: data/random_data_31_sim_gaussian_35.rds
Untracked: data/random_data_31_sim_gaussian_35_get_sumstats_1.rds
Untracked: data/small_data_46.rds
Untracked: data/small_data_46_sim_gaussian_10.rds
Untracked: data/small_data_46_sim_gaussian_10_get_sumstats_2.rds
Untracked: docs/figure/SuSiEDAP_Power_data31_35.Rmd/
Untracked: docs/figure/test.Rmd/
Untracked: docs/random_data_31_sim_gaussian_35_get_sumstats_1_dap_z_1_plot_dap_1.plot_file.pdf
Untracked: output/dscoutProblem475.rds
Untracked: output/dscoutProblem75.rds
Untracked: output/finemap_compare_random_data_null_dscout.rds
Untracked: output/finemap_compare_random_data_signal_dscout.rds
Untracked: output/finemap_compare_small_data_signal_dscout.rds
Untracked: output/finemap_compare_small_data_signal_dscout_RE8.rds
Untracked: output/random_data_100_sim_gaussian_null_1_get_sumstats_1_finemap_1.rds
Untracked: output/random_data_76.rds
Untracked: output/random_data_76_sim_gaussian_8.rds
Untracked: output/random_data_76_sim_gaussian_8_get_sumstats_1.rds
Untracked: output/small_data_42_sim_gaussian_36_get_sumstats_2_susie_z_2.rds
Untracked: output/small_data_92_sim_gaussian_30_get_sumstats_2_susie_z_2.rds
Unstaged changes:
Modified: analysis/Problem475.Rmd
Modified: analysis/SusieZPerformance.Rmd
Modified: analysis/SusieZPerformanceRE3.Rmd
Modified: analysis/index.Rmd
Modified: output/dsc_susie_z_v_output.rds
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.
| File | Version | Author | Date | Message |
|---|---|---|---|---|
| Rmd | 28260cb | zouyuxin | 2019-03-03 | wflow_publish(“analysis/SuSiERobust.Rmd”) |
library(susieR)
library(R.utils)
We use the data in susieR package. It is simulated to have exactly 3 non-zero effects.
data(N3finemapping)
b <- N3finemapping$data$true_coef[,1]
R <- cor(N3finemapping$dat$X)
z_scores = N3finemapping$sumstats[1,,1]/N3finemapping$sumstats[2,,1]
plot(z_scores, pch=16, ylab='z scores')
points(which(b!=0),z_scores[which(b!=0)], col=2, pch=16)

fit1 = susie_z(z_scores, R, L=5)
susie_plot(fit1, y = 'PIP', b=b, main=paste0('objective:', round(susie_get_objective(fit1), 2)))

We fit the model with var \(\sigma^2(R + \lambda I)\).
sourceDirectory("~/Documents/GitHub/susieR/inst/code/susiez_fix/")
fit2 = susie_z_general_fix(z_scores, R, L=5, lambda = 1e-8, track_fit = TRUE, verbose = TRUE)
[1] "before estimate sigma objective:-176108.356082106"
[1] "after estimate sigma2 objective:341.575476122518"
[1] "before estimate sigma objective:349.018680645267"
[1] "after estimate sigma2 objective:349.018681622517"
[1] "before estimate sigma objective:349.022409715368"
[1] "after estimate sigma2 objective:349.022409728946"
[1] "before estimate sigma objective:349.022409728946"
[1] "after estimate sigma2 objective:349.022409728946"
susie_plot(fit2, y = 'PIP', b=b, main=paste0('lambda = 1e-8, objective:', round(susie_get_objective(fit2), 2)))

We fit the model with var \(\sigma^2R + \lambda I\).
sourceDirectory("~/Documents/GitHub/susieR/inst/code/susiez_num/")
par(mfrow = c(2, 3))
fit3 = susie_z_general_num(z_scores, R, L=5, lambda = 1e-8, track_fit = TRUE, verbose = TRUE)
[1] "before estimate sigma2 objective:-176108.356082106"
[1] "after estimate sigma2 objective:-176107.431097485"
[1] "before estimate sigma2 objective:-176102.530490343"
[1] "after estimate sigma2 objective:-176102.184350997"
[1] "before estimate sigma2 objective:-176087.167964295"
[1] "after estimate sigma2 objective:-176087.167964295"
[1] "before estimate sigma2 objective:-176080.196067129"
[1] "after estimate sigma2 objective:-176079.74293158"
[1] "before estimate sigma2 objective:-176076.83603438"
[1] "after estimate sigma2 objective:-176076.83603438"
[1] "before estimate sigma2 objective:-176076.495338684"

[1] "after estimate sigma2 objective:-176076.495338684"
[1] "before estimate sigma2 objective:-176076.4809328"
[1] "after estimate sigma2 objective:-176076.4809328"
[1] "before estimate sigma2 objective:-176076.480770257"
[1] "after estimate sigma2 objective:-176076.480770257"
par(mfrow = c(1, 1))

susie_plot(fit3, y = 'PIP', b=b, main=paste0('lambda = 1e-8, objective:', round(susie_get_objective(fit3), 2)))

par(mfrow = c(2, 3))
fit4 = susie_z_general_num(z_scores, R, L=5, lambda = 0.1, track_fit = TRUE, verbose = TRUE)
[1] "before estimate sigma2 objective:-268.382924136224"
[1] "after estimate sigma2 objective:-268.382924136224"
[1] "before estimate sigma2 objective:-263.583517059885"
[1] "after estimate sigma2 objective:-262.582217811463"
[1] "before estimate sigma2 objective:-246.293667680361"
[1] "after estimate sigma2 objective:-244.398921702326"
[1] "before estimate sigma2 objective:-232.726801436096"
[1] "after estimate sigma2 objective:-232.720246921936"
[1] "before estimate sigma2 objective:-229.849008457783"
[1] "after estimate sigma2 objective:-229.849008457783"
[1] "before estimate sigma2 objective:-229.656391292686"

[1] "after estimate sigma2 objective:-229.656391292686"
[1] "before estimate sigma2 objective:-229.649501048445"
[1] "after estimate sigma2 objective:-229.649501048445"
[1] "before estimate sigma2 objective:-229.648954904787"
[1] "after estimate sigma2 objective:-229.648954904787"
par(mfrow = c(1, 1))

susie_plot(fit4, y = 'PIP', b=b, main=paste0('lambda = 0.1, objective:', round(susie_get_objective(fit4), 2)))

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS 10.14.3
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/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] R.utils_2.7.0 R.oo_1.22.0 R.methodsS3_1.7.1 susieR_0.6.4.0454
loaded via a namespace (and not attached):
[1] workflowr_1.1.1 Rcpp_1.0.0 lattice_0.20-38 digest_0.6.18
[5] rprojroot_1.3-2 grid_3.5.1 backports_1.1.3 git2r_0.24.0
[9] magrittr_1.5 evaluate_0.12 stringi_1.2.4 whisker_0.3-2
[13] Matrix_1.2-15 rmarkdown_1.11 tools_3.5.1 stringr_1.3.1
[17] yaml_2.2.0 compiler_3.5.1 htmltools_0.3.6 knitr_1.20
This reproducible R Markdown analysis was created with workflowr 1.1.1