Last updated: 2023-03-29

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 3fb3c39. 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/bhglm_censoring.Rmd
    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/survival.svb.Rmd) and HTML (docs/survival.svb.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 3fb3c39 yunqiyang0215 2023-03-29 Build site.
html 53c811f yunqiyang0215 2023-03-29 Build site.
Rmd eaea25d yunqiyang0215 2023-03-29 wflow_publish("analysis/survival.svb.Rmd")
html efab759 yunqiyang0215 2023-03-03 Build site.
Rmd bcfcc2c yunqiyang0215 2023-03-03 wflow_publish("analysis/survival.svb.Rmd")
html 962ae00 yunqiyang0215 2023-03-03 Build site.
Rmd 37854d0 yunqiyang0215 2023-03-03 wflow_publish("analysis/survival.svb.Rmd")

Description:

The candidate method is called survival.svb.

Publication link: https://doi.org/10.1093/bioinformatics/btac416

Software link:https://github.com/mkomod/survival.svb

Conclusion: Scenario 2 doesn’t work well. But all other scenarios work.

library(survival)
library(survival.svb)

Example code from their package

# Question: Why re-scale censored data???
n <- 200                        # number of sample
p <- 1000                       # number of features
s <- 10                         # number of non-zero coefficients
censoring_lvl <- 0.4            # degree of censoring


# generate some test data
set.seed(1)
b <- sample(c(runif(s, -2, 2), rep(0, p-s)))
X <- matrix(rnorm(n * p), nrow=n)
Y <- log(1 - runif(n)) / -exp(X %*% b)
delta  <- runif(n) > censoring_lvl          # 0: censored, 1: uncensored
Y[!delta] <- Y[!delta] * runif(sum(!delta)) # rescale censored data


# fit the model
f <- survival.svb::svb.fit(Y, delta, X)

# plot the results
plot(b, xlab=expression(beta), main="Coefficient value", pch=8, ylim=c(-2,2))
# effect size mu * gamma
points(f$m * f$g, pch=20, col=2)
legend("topleft", legend=c(expression(beta), expression(hat(beta))),
       pch=c(8, 20), col=c(1, 2))
dat = readRDS("./data/sim_dat_simple.rds")

Data 1: null model with X independent

# In survival.svb, 0: censored & 1: uncensored
p = 50
X = as.matrix(dat[[1]][, c(2:(p+1))])
y = dat[[1]]$surT
delta = rep(1, length(dat[[1]]$status))
f <- survival.svb::svb.fit(y, delta, X)
Converged in 5 iterations
f$inclusion_prob
 [1] 0.004215247 0.002405425 0.003885219 0.002197453 0.002480116 0.002179166
 [7] 0.009197673 0.007679196 0.006547252 0.003632627 0.067284778 0.005776586
[13] 0.002560499 0.004261836 0.002766186 0.003039267 0.002133205 0.002213125
[19] 0.011484034 0.002619105 0.002427597 0.002749414 0.002621227 0.002354707
[25] 0.003480766 0.003350277 0.002431151 0.002306227 0.005756021 0.003339219
[31] 0.002568220 0.010740179 0.002270132 0.003037108 0.002882421 0.003599217
[37] 0.005466617 0.002181848 0.002649357 0.002975775 0.003543029 0.002475959
[43] 0.091327778 0.002595519 0.003152200 0.007025485 0.002468074 0.002779005
[49] 0.005144080 0.002373226
# effect size
f$beta_hat
 [1] -4.402820e-04  9.471992e-05  3.951573e-04 -1.224396e-05  4.690114e-05
 [6] -5.876275e-05  1.517346e-03  1.372326e-03  8.835843e-04 -3.370147e-04
[11] -1.958774e-02  8.401750e-04 -2.691906e-05  4.484041e-04  1.929894e-04
[16] -2.202050e-04  5.199899e-05  2.823654e-08  2.296192e-03 -1.316329e-04
[21]  1.302152e-04  7.625108e-05  1.171852e-04 -1.044044e-04  2.590958e-04
[26] -2.810963e-04  9.783886e-05  6.471638e-05  7.735279e-04 -2.778431e-04
[31] -8.161181e-05  1.866148e-03 -9.647470e-05  2.228922e-04  1.987607e-04
[36]  3.256843e-04 -6.857959e-04 -2.632696e-05 -5.957337e-05  2.530102e-05
[41]  3.325918e-04 -6.701009e-05  2.391298e-02 -1.250912e-04  2.526823e-04
[46] -1.052009e-03 -8.519364e-05 -1.657100e-04 -6.199818e-04 -3.791429e-05
sort(f$inclusion_prob, decreasing = TRUE)
 [1] 0.091327778 0.067284778 0.011484034 0.010740179 0.009197673 0.007679196
 [7] 0.007025485 0.006547252 0.005776586 0.005756021 0.005466617 0.005144080
[13] 0.004261836 0.004215247 0.003885219 0.003632627 0.003599217 0.003543029
[19] 0.003480766 0.003350277 0.003339219 0.003152200 0.003039267 0.003037108
[25] 0.002975775 0.002882421 0.002779005 0.002766186 0.002749414 0.002649357
[31] 0.002621227 0.002619105 0.002595519 0.002568220 0.002560499 0.002480116
[37] 0.002475959 0.002468074 0.002431151 0.002427597 0.002405425 0.002373226
[43] 0.002354707 0.002306227 0.002270132 0.002213125 0.002197453 0.002181848
[49] 0.002179166 0.002133205

Data 2: simulated from null model with highly correlated X. corr = 0.9

Wrongly selected two effects of different signs, cancelled out…

# In survival.svb, 0: censored & 1: uncensored
p = 50
X = as.matrix(dat[[2]][, c(2:(p+1))])
y = dat[[2]]$surT
delta = rep(1, length(dat[[2]]$status))
f <- survival.svb::svb.fit(y, delta, X)
Converged in 40 iterations
f$inclusion_prob
 [1] 0.002707982 0.002556844 0.003077556 0.002548439 0.002544967 0.002568364
 [7] 0.002768210 0.999999926 0.003350906 0.002763167 0.999602626 0.003373272
[13] 0.002590265 0.003171694 0.002943468 0.002498387 0.002687154 0.002649961
[19] 0.003413079 0.002571318 0.003303820 0.002682225 0.002531015 0.002643111
[25] 0.002868107 0.002636391 0.002889297 0.002735314 0.003326027 0.002600851
[31] 0.002542675 0.002881791 0.002528922 0.002969617 0.002856023 0.003210380
[37] 0.002482221 0.002730531 0.002704633 0.002662414 0.002457422 0.002568791
[43] 0.003869697 0.002750198 0.003043072 0.002944571 0.002384961 0.002655110
[49] 0.002754122 0.002409878
# effect size
f$beta_hat
 [1] -9.488776e-05  6.688688e-05  2.254107e-04  5.229387e-05  2.180386e-05
 [6]  7.473810e-06  1.583960e-04  7.881063e-01  2.943875e-04 -3.361565e-05
[11] -6.230241e-01  2.630869e-04  6.388543e-05  2.389103e-04  1.928895e-04
[16] -1.894465e-05  8.750375e-05  7.453773e-05  3.021515e-04  2.808786e-05
[21]  2.824344e-04  8.981229e-05  7.895421e-05  2.774715e-05  1.436848e-04
[26] -2.896842e-05  1.493228e-04  1.105573e-04  2.794348e-04  1.705938e-05
[31]  3.882342e-05  1.861898e-04  5.508422e-05  1.789521e-04  1.712380e-04
[36]  2.343031e-04 -8.342456e-05 -2.156446e-05  6.228872e-05  5.470414e-05
[41]  6.356487e-05  5.235201e-05  4.193750e-04  3.678720e-05  2.131771e-04
[46] -1.035488e-04  1.180003e-05 -1.634696e-05 -9.947651e-05 -1.331904e-05
sort(f$inclusion_prob, decreasing = TRUE)
 [1] 0.999999926 0.999602626 0.003869697 0.003413079 0.003373272 0.003350906
 [7] 0.003326027 0.003303820 0.003210380 0.003171694 0.003077556 0.003043072
[13] 0.002969617 0.002944571 0.002943468 0.002889297 0.002881791 0.002868107
[19] 0.002856023 0.002768210 0.002763167 0.002754122 0.002750198 0.002735314
[25] 0.002730531 0.002707982 0.002704633 0.002687154 0.002682225 0.002662414
[31] 0.002655110 0.002649961 0.002643111 0.002636391 0.002600851 0.002590265
[37] 0.002571318 0.002568791 0.002568364 0.002556844 0.002548439 0.002544967
[43] 0.002542675 0.002531015 0.002528922 0.002498387 0.002482221 0.002457422
[49] 0.002409878 0.002384961

Data 3: simulated from one predictor model. Predictors are independent.

# In survival.svb, 0: censored & 1: uncensored
p = 50
X = as.matrix(dat[[3]][, c(2:(p+1))])
y = dat[[3]]$surT
delta = rep(1, length(dat[[3]]$status))
f <- survival.svb::svb.fit(y, delta, X)
Converged in 5 iterations
sort(f$inclusion_prob, decreasing = TRUE)
 [1] 1.000000000 0.031720006 0.028860204 0.014779944 0.012857261 0.008346438
 [7] 0.008098484 0.006579119 0.005786003 0.005229547 0.004881743 0.004835365
[13] 0.004315706 0.004045642 0.003991214 0.003896513 0.003894880 0.003635249
[19] 0.003462271 0.003222249 0.003196571 0.003170309 0.003076746 0.003060976
[25] 0.003045663 0.002980706 0.002936528 0.002911709 0.002860795 0.002854527
[31] 0.002818801 0.002676577 0.002593314 0.002554819 0.002461351 0.002447755
[37] 0.002426864 0.002403745 0.002403626 0.002371357 0.002371304 0.002350683
[43] 0.002287849 0.002221769 0.002221300 0.002214093 0.002193175 0.002182060
[49] 0.002092224 0.001981784

Data 4: simulated from one predictor model. Predictors are highly correlated, corr = 0.9

# In survival.svb, 0: censored & 1: uncensored
p = 50
X = as.matrix(dat[[4]][, c(2:(p+1))])
y = dat[[4]]$surT
delta = rep(1, length(dat[[4]]$status))
f <- survival.svb::svb.fit(y, delta, X)
Converged in 23 iterations
sort(f$inclusion_prob, decreasing = TRUE)
 [1] 1.000000000 0.010780585 0.005391930 0.005377254 0.005300515 0.005113063
 [7] 0.005059171 0.004794748 0.004770906 0.004150362 0.003744448 0.003692960
[13] 0.003517473 0.003493004 0.003396799 0.003323867 0.003255042 0.003199249
[19] 0.003172374 0.003162700 0.003155136 0.003120949 0.003102270 0.003086998
[25] 0.003058726 0.002958741 0.002909621 0.002731189 0.002713933 0.002710828
[31] 0.002705930 0.002616932 0.002606719 0.002548228 0.002535105 0.002523482
[37] 0.002517542 0.002516842 0.002514661 0.002493330 0.002486051 0.002479656
[43] 0.002466852 0.002436535 0.002414240 0.002392626 0.002329798 0.002289335
[49] 0.002243603 0.002136450
f$inclusion_prob
 [1] 1.000000000 0.003086998 0.004150362 0.002466852 0.003199249 0.002329798
 [7] 0.005300515 0.005059171 0.005391930 0.002516842 0.002616932 0.005377254
[13] 0.002731189 0.003692960 0.003744448 0.002243603 0.003255042 0.002514661
[19] 0.004770906 0.002486051 0.003517473 0.003058726 0.003120949 0.002517542
[25] 0.002909621 0.002705930 0.003155136 0.003102270 0.005113063 0.002606719
[31] 0.002710828 0.004794748 0.002414240 0.003172374 0.003323867 0.003162700
[37] 0.002136450 0.003493004 0.002713933 0.003396799 0.002535105 0.002436535
[43] 0.010780585 0.002548228 0.002958741 0.002523482 0.002289335 0.002479656
[49] 0.002392626 0.002493330

Data 5: simulated from two predictor model. Predictors have high correlation, corr = 0.9

# In survival.svb, 0: censored & 1: uncensored
p = 50
X = as.matrix(dat[[5]][, c(2:(p+1))])
y = dat[[5]]$surT
delta = rep(1, length(dat[[5]]$status))
f <- survival.svb::svb.fit(y, delta, X)
Converged in 11 iterations
sort(f$inclusion_prob, decreasing = TRUE)
 [1] 1.000000000 0.999495350 0.004839843 0.004800177 0.003961190 0.003936441
 [7] 0.003797739 0.003572050 0.003523504 0.003243205 0.003042474 0.002837179
[13] 0.002824088 0.002793942 0.002786034 0.002692349 0.002689118 0.002674730
[19] 0.002668858 0.002666592 0.002645855 0.002587617 0.002573599 0.002568837
[25] 0.002566003 0.002563730 0.002548961 0.002504767 0.002502951 0.002496425
[31] 0.002483920 0.002481945 0.002475012 0.002473123 0.002465439 0.002464324
[37] 0.002462429 0.002462269 0.002422099 0.002418340 0.002417182 0.002409658
[43] 0.002406634 0.002397834 0.002386797 0.002378291 0.002359137 0.002343265
[49] 0.002321199 0.002314496

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] survival.svb_0.0-2 survival_3.2-11    workflowr_1.6.2   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3     pillar_1.6.4     compiler_4.1.1   bslib_0.4.1     
 [5] later_1.3.0      jquerylib_0.1.4  git2r_0.28.0     iterators_1.0.14
 [9] tools_4.1.1      digest_0.6.28    lattice_0.20-44  jsonlite_1.7.2  
[13] evaluate_0.14    lifecycle_1.0.1  tibble_3.1.5     pkgconfig_2.0.3 
[17] rlang_1.0.6      foreach_1.5.2    Matrix_1.5-3     cli_3.1.0       
[21] rstudioapi_0.13  yaml_2.2.1       xfun_0.27        fastmap_1.1.0   
[25] stringr_1.4.0    knitr_1.36       fs_1.5.0         vctrs_0.3.8     
[29] sass_0.4.4       glmnet_4.1-4     grid_4.1.1       rprojroot_2.0.2 
[33] glue_1.4.2       R6_2.5.1         fansi_0.5.0      rmarkdown_2.11  
[37] magrittr_2.0.1   whisker_0.4      codetools_0.2-18 splines_4.1.1   
[41] promises_1.2.0.1 ellipsis_0.3.2   htmltools_0.5.2  shape_1.4.6     
[45] httpuv_1.6.3     utf8_1.2.2       stringi_1.7.5    cachem_1.0.6    
[49] crayon_1.4.1