Last updated: 2023-04-07
Checks: 7 0
Knit directory: survival-susie/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). 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(20230201)
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 d7669c3. 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: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/.DS_Store
Ignored: analysis/.RData
Ignored: analysis/.Rhistory
Untracked files:
Untracked: analysis/ibss_null_model.Rmd
Unstaged changes:
Modified: analysis/check_coxph_fit.Rmd
Deleted: analysis/null_model_demo.Rmd
Modified: analysis/null_model_zscore.Rmd
Deleted: analysis/one_predictor_investigation.Rmd
Deleted: analysis/ser_survival.Rmd
Modified: analysis/sim_survival_with_censoring.Rmd
Modified: code/VI_exponential.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/compare_pip.Rmd
) and HTML (docs/compare_pip.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 | d7669c3 | yunqiyang0215 | 2023-04-07 | wflow_publish("analysis/compare_pip.Rmd") |
html | e14c11f | yunqiyang0215 | 2023-04-06 | Build site. |
Rmd | 3f0fe1d | yunqiyang0215 | 2023-04-06 | wflow_publish("analysis/compare_pip.Rmd") |
html | ab9bcba | yunqiyang0215 | 2023-04-06 | Build site. |
Rmd | 236fff4 | yunqiyang0215 | 2023-04-06 | wflow_publish("analysis/compare_pip.Rmd") |
html | 60fa9df | yunqiyang0215 | 2023-04-06 | Build site. |
Rmd | 9c2e674 | yunqiyang0215 | 2023-04-06 | wflow_publish("analysis/compare_pip.Rmd") |
Simulation results based on real genotype data from GTEx. I took the SNPs for a certain gene, Thyroid.ENSG00000132855. Therefore, sample size \(n=584\), and I choose variable number \(p=1000\).
Select a random point on the genome, indx_start. Then the predictors are from [indx_start:(indx_start + p -1)].
Select effect variables. The number of effects are 1,2,3. Select SNPs that have correlation between (0.9 - 0.99) with other SNPs.
Two correlation types: real correlation and independent. In independent, I simply permute each variable values. The max correlation can be 0.3, but a lot of correlation will be close to 0.
Effect size \(b\sim N(0,1)\).
Simulate survival time using exponential survival model.
Set L = true number of effects.
Set prior variance to the true prior variance.
When using the real correlation matrix, susie result is very different from survival.svb. And survival.svb seems to have better results, as capturing more effects.
In other scenarios, results are more consistent across methods.
compare_pip <- function(pip1, pip2, effect_indx, dat_indx, p){
is_effect = c()
for (i in dat_indx){
init = rep(0, p)
indx = effect_indx[[i]]
init[indx] = 1
is_effect = c(is_effect, init)
}
res = data.frame(cbind(pip1, pip2, is_effect))
}
plot_pip <- function(res.pip, labs, main){
pch = ifelse(res.pip$is_effect == 1, 16, 1)
cex = ifelse(res.pip$is_effect == 1, 1, 0.5)
col = ifelse(res.pip$is_effect == 1, "red", "dark grey")
plot(res.pip$pip1, res.pip$pip2, col = col, pch = pch, cex = cex,
xlab = labs[1], ylab = labs[2], main = main)
}
susie = readRDS("./data/susie.rds")
survsvb = readRDS("./data/survsvb.rds")
bvsnlp = readRDS("./data/bvsnlp.rds")
par(mfrow = c(1,3))
for (num in 1:3){
indx = which(susie$simulate.cor_type == "real" & susie$simulate.num_effect == num)[1:50]
pip.susie = unlist(lapply(indx, function(x) susie$susie.pip[[x]]))
pip.survsvb = unlist(lapply(indx, function(x) survsvb$survivalsvb.pip[[x]]))
res.pip = compare_pip(pip.susie, pip.survsvb, susie$simulate.effect_indx, dat_indx = indx, p =1e3)
plot_pip(res.pip, labs = c("susie", "survival.svb"), main = paste0(num, " effect, max corr=0.9-0.99"))
}
par(mfrow = c(1,3))
for (num in 1:3){
indx = which(susie$simulate.cor_type == "real" & susie$simulate.num_effect == num)[1:50]
pip.susie = unlist(lapply(indx, function(x) susie$susie.pip[[x]]))
pip.bvsnlp = unlist(lapply(indx, function(x) bvsnlp$bvsnlp.pip[[x]]))
res.pip = compare_pip(pip.susie, pip.bvsnlp, susie$simulate.effect_indx, dat_indx = indx, p =1e3)
plot_pip(res.pip, labs = c("susie", "bvsnlp"), main = paste0(num, " effect, max corr=0.9-0.99"))
abline(a = 0, b = 1, lty = 2, col = "blue")
}
par(mfrow = c(1,3))
for (num in 1:3){
indx = which(susie$simulate.cor_type == "independent" & susie$simulate.num_effect == num)[1:50]
pip.susie = unlist(lapply(indx, function(x) susie$susie.pip[[x]]))
pip.survsvb = unlist(lapply(indx, function(x) survsvb$survivalsvb.pip[[x]]))
res.pip = compare_pip(pip.susie, pip.survsvb, susie$simulate.effect_indx, dat_indx = indx, p =1e3)
plot_pip(res.pip, labs = c("susie", "survival.svb"), main = paste0(num, " effect, X close to independent"))
abline(a = 0, b = 1, lty = 2, col = "blue")
}
par(mfrow = c(1,3))
for (num in 1:3){
indx = which(susie$simulate.cor_type == "independent" & susie$simulate.num_effect == num)[1:50]
pip.susie = unlist(lapply(indx, function(x) susie$susie.pip[[x]]))
pip.bvsnlp = unlist(lapply(indx, function(x) bvsnlp$bvsnlp.pip[[x]]))
res.pip = compare_pip(pip.susie, pip.bvsnlp, susie$simulate.effect_indx, dat_indx = indx, p =1e3)
plot_pip(res.pip, labs = c("susie", "bvsnlp"), main = paste0(num, " effect, X close to independent"))
abline(a = 0, b = 1, lty = 2, col = "blue")
}
sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin20.6.0 (64-bit)
Running under: macOS Monterey 12.0.1
Matrix products: default
BLAS: /usr/local/Cellar/openblas/0.3.18/lib/libopenblasp-r0.3.18.dylib
LAPACK: /usr/local/Cellar/r/4.1.1_1/lib/R/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] workflowr_1.6.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 highr_0.9 pillar_1.6.4 compiler_4.1.1
[5] bslib_0.4.1 later_1.3.0 jquerylib_0.1.4 git2r_0.28.0
[9] tools_4.1.1 digest_0.6.28 jsonlite_1.7.2 evaluate_0.14
[13] lifecycle_1.0.1 tibble_3.1.5 pkgconfig_2.0.3 rlang_1.0.6
[17] cli_3.1.0 rstudioapi_0.13 yaml_2.2.1 xfun_0.27
[21] fastmap_1.1.0 stringr_1.4.0 knitr_1.36 fs_1.5.0
[25] vctrs_0.3.8 sass_0.4.4 rprojroot_2.0.2 glue_1.4.2
[29] R6_2.5.1 fansi_0.5.0 rmarkdown_2.11 magrittr_2.0.1
[33] whisker_0.4 promises_1.2.0.1 ellipsis_0.3.2 htmltools_0.5.2
[37] httpuv_1.6.3 utf8_1.2.2 stringi_1.7.5 cachem_1.0.6
[41] crayon_1.4.1