Last updated: 2023-04-14
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 b94af8b. 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
Ignored: data/.DS_Store
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: analysis/susie_poor_performance_example.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/run_ser_simple_dat.Rmd
) and HTML (docs/run_ser_simple_dat.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 | b94af8b | yunqiyang0215 | 2023-04-14 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | fa52731 | yunqiyang0215 | 2023-03-15 | Build site. |
Rmd | 4631138 | yunqiyang0215 | 2023-03-15 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | aef86a7 | yunqiyang0215 | 2023-02-23 | Build site. |
Rmd | 8fceddd | yunqiyang0215 | 2023-02-23 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | 7fc8ac9 | yunqiyang0215 | 2023-02-23 | Build site. |
Rmd | 26f177f | yunqiyang0215 | 2023-02-23 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | 86471c9 | yunqiyang0215 | 2023-02-21 | Build site. |
html | 2edb747 | yunqiyang0215 | 2023-02-21 | Build site. |
Rmd | 91d4fb7 | yunqiyang0215 | 2023-02-21 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | babbca4 | yunqiyang0215 | 2023-02-21 | Build site. |
Rmd | eecfb7f | yunqiyang0215 | 2023-02-21 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | 7a533c6 | yunqiyang0215 | 2023-02-21 | Build site. |
Rmd | afa4e95 | yunqiyang0215 | 2023-02-21 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | 69498d8 | yunqiyang0215 | 2023-02-16 | Build site. |
Rmd | 7f7cab7 | yunqiyang0215 | 2023-02-16 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | 8f08853 | yunqiyang0215 | 2023-02-15 | Build site. |
Rmd | 0b9d885 | yunqiyang0215 | 2023-02-15 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | fa55cee | yunqiyang0215 | 2023-02-15 | Build site. |
Rmd | 2aab4d2 | yunqiyang0215 | 2023-02-15 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | 973f023 | yunqiyang0215 | 2023-02-13 | Build site. |
Rmd | cfd4df5 | yunqiyang0215 | 2023-02-13 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | b407f93 | yunqiyang0215 | 2023-02-12 | Build site. |
Rmd | 4f242bd | yunqiyang0215 | 2023-02-12 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | d7a14e4 | yunqiyang0215 | 2023-02-12 | Build site. |
Rmd | a70c34c | yunqiyang0215 | 2023-02-12 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | d16db2f | yunqiyang0215 | 2023-02-12 | Build site. |
Rmd | 4910cfc | yunqiyang0215 | 2023-02-12 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | 9d83f72 | yunqiyang0215 | 2023-02-12 | Build site. |
Rmd | 55b418b | yunqiyang0215 | 2023-02-12 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | b67c343 | yunqiyang0215 | 2023-02-09 | Build site. |
Rmd | b2b3b99 | yunqiyang0215 | 2023-02-09 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | 210cf66 | yunqiyang0215 | 2023-02-09 | Build site. |
Rmd | 2360f30 | yunqiyang0215 | 2023-02-09 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | cc386a1 | yunqiyang0215 | 2023-02-09 | Build site. |
Rmd | 4f1c5c3 | yunqiyang0215 | 2023-02-09 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
html | ba5113f | yunqiyang0215 | 2023-02-09 | Build site. |
Rmd | 4e06f27 | yunqiyang0215 | 2023-02-09 | wflow_publish("analysis/run_ser_simple_dat.Rmd") |
I simulated data in 5 different scenarios, and apply both coxph model and susie procedure. The data simulation procedure is available at https://yunqiyang0215.github.io/survival-susie/sim_survival.html
\[ ABF(H_1/H_0)=\sqrt\frac{V}{V+W}\exp\{\frac{z^2}{2}\frac{W}{V+W}\}, \] where \(V\) is the variance of estimated regression coefficient, and \(W\) is variance in the normal prior, \(N(0,W)\).
# Function to calculate approximate BF based on Wakefield approximation
# @param z: zscore of the regression coefficient
# @param s: standard deviation of the estimated coefficient
compute_abf <- function(z, s, prior_variance){
abf <- sqrt(s^2/(s^2+prior_variance))*exp(z^2/2*(prior_variance/(s^2+prior_variance)))
return(abf)
}
compute_approx_post_var <- function(z, s, prior_variance){
post_var <- 1/(1/s^2 + 1/prior_variance)
return(post_var)
}
# @param post_var: posterior variance
# @param s: standard deviation of the estimated coefficient
# @param bhat: estimated beta effect
compute_approx_post_mean <- function(post_var, s, bhat){
mu <- post_var/(s^2)*bhat
return(mu)
}
dat = readRDS("./data/sim_dat_simple.rds")
library(survival)
# Modified Karl's code for intercept part
devtools::load_all("/Users/nicholeyang/Desktop/logisticsusie")
ℹ Loading logisticsusie
surv_uni_fun <- function(x, y, o, prior_variance, estimate_intercept = 0, ...){
fit <- coxph(y~ x + offset(o))
bhat <- summary(fit)$coefficients[1, 1] # bhat = -alphahat
sd <- summary(fit)$coefficients[1, 3]
zscore <- bhat/sd
bf <- compute_abf(zscore, sd, prior_variance)
var <- compute_approx_post_var(zscore, sd, prior_variance)
mu <- compute_approx_post_mean(var, sd, bhat)
lbf <- log(bf)
return(list(mu = mu, var=var, lbf=lbf, intercept=0))
}
fit_coxph <- ser_from_univariate(surv_uni_fun)
\(\log T_i =\beta_0+\epsilon_i\) and \(\beta_0 = 1\).
## Create survival object. status == 2 is death
dat[[1]]$y <- with(dat[[1]], Surv(surT, status == 2))
# Fit cox ph. Cox ph model with select multiple significant predictors..
cox1 <- coxph(y ~ .-status - surT, data = dat[[1]])
p = 50
X = as.matrix(dat[[1]][, c(2:(p+1))])
y = dat[[1]]$y
# IBSS of susie
set.seed(1)
fit1 <- ibss_from_ser(X, y, L = 1, prior_variance = 1., prior_weights = rep(1/p, p), tol = 1e-3, maxit = 500, estimate_intercept = TRUE, ser_function = fit_coxph)
1.645 sec elapsed
par(mfrow = c(1,2))
hist(fit1$alpha, breaks = 20)
hist(fit1$mu* fit1$alpha, breaks = 20)
# IBSS of susie
t1 <- proc.time()
fit2 <- ibss_from_ser(X, y, L = 5, prior_variance = 1., prior_weights = rep(1/p, p), tol = 1e-3, maxit = 500, estimate_intercept = TRUE, ser_function = fit_coxph)
8.327 sec elapsed
t2 <- proc.time()
t(apply(fit2$alpha, 1, function(x) sort(x, decreasing = TRUE)))
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0.06080722 0.04844447 0.02852006 0.02713950 0.02711385 0.02476079
[2,] 0.05798113 0.04645935 0.02813999 0.02682591 0.02676712 0.02463161
[3,] 0.05765773 0.04619174 0.02808999 0.02678241 0.02671300 0.02461218
[4,] 0.05750483 0.04604271 0.02806341 0.02675660 0.02668147 0.02460096
[5,] 0.05737282 0.04590957 0.02803984 0.02673323 0.02665307 0.02459085
[,7] [,8] [,9] [,10] [,11] [,12]
[1,] 0.02433713 0.02292726 0.02256125 0.02230962 0.02225681 0.02131121
[2,] 0.02417474 0.02288659 0.02244058 0.02225109 0.02221870 0.02128078
[3,] 0.02415146 0.02287385 0.02242009 0.02224225 0.02221773 0.02127032
[4,] 0.02413827 0.02286374 0.02240690 0.02223717 0.02221946 0.02126169
[5,] 0.02412642 0.02285415 0.02239482 0.02223258 0.02222136 0.02125351
[,13] [,14] [,15] [,16] [,17] [,18]
[1,] 0.02071900 0.02057158 0.01998106 0.01894611 0.01881278 0.01869590
[2,] 0.02077713 0.02062201 0.02003886 0.01904832 0.01890613 0.01879683
[3,] 0.02077865 0.02062699 0.02004723 0.01906067 0.01891951 0.01880715
[4,] 0.02077675 0.02062911 0.02005228 0.01906693 0.01892735 0.01881136
[5,] 0.02077455 0.02063087 0.02005684 0.01907242 0.01893443 0.01881486
[,19] [,20] [,21] [,22] [,23] [,24]
[1,] 0.01832149 0.01825743 0.01818302 0.01810264 0.01773937 0.01760294
[2,] 0.01844566 0.01837056 0.01830947 0.01825037 0.01788778 0.01777091
[3,] 0.01845825 0.01838229 0.01832516 0.01826820 0.01790456 0.01779287
[4,] 0.01846331 0.01838714 0.01833325 0.01827714 0.01791234 0.01780471
[5,] 0.01846750 0.01839118 0.01834035 0.01828496 0.01791902 0.01781521
[,25] [,26] [,27] [,28] [,29] [,30]
[1,] 0.01751419 0.01726894 0.01723432 0.01688927 0.01683389 0.01668718
[2,] 0.01766562 0.01742537 0.01739913 0.01706514 0.01700868 0.01686957
[3,] 0.01768585 0.01744460 0.01742108 0.01708800 0.01703102 0.01689356
[4,] 0.01769697 0.01745433 0.01743309 0.01710021 0.01704276 0.01690649
[5,] 0.01770688 0.01746287 0.01744377 0.01711104 0.01705315 0.01691798
[,31] [,32] [,33] [,34] [,35] [,36]
[1,] 0.01663990 0.01656988 0.01646926 0.01646377 0.01637391 0.01636337
[2,] 0.01682167 0.01675460 0.01665956 0.01665349 0.01656637 0.01655698
[3,] 0.01684560 0.01677952 0.01668481 0.01667817 0.01659170 0.01658211
[4,] 0.01685851 0.01679324 0.01669851 0.01669133 0.01660535 0.01659547
[5,] 0.01686999 0.01680549 0.01671071 0.01670299 0.01661748 0.01660731
[,37] [,38] [,39] [,40] [,41] [,42]
[1,] 0.01628047 0.01622349 0.01611734 0.01607707 0.01598358 0.01592950
[2,] 0.01647941 0.01642182 0.01632178 0.01628124 0.01618919 0.01613838
[3,] 0.01650443 0.01644788 0.01634938 0.01630860 0.01621795 0.01616586
[4,] 0.01651735 0.01646189 0.01636458 0.01632356 0.01623425 0.01618065
[5,] 0.01652872 0.01647433 0.01637816 0.01633690 0.01624887 0.01619379
[,43] [,44] [,45] [,46] [,47] [,48]
[1,] 0.01582348 0.01566875 0.01559254 0.01541767 0.01535973 0.01535158
[2,] 0.01603735 0.01588370 0.01581252 0.01564100 0.01558478 0.01557838
[3,] 0.01606592 0.01591369 0.01584378 0.01567173 0.01561584 0.01560858
[4,] 0.01608149 0.01593065 0.01586170 0.01568889 0.01563322 0.01562498
[5,] 0.01609537 0.01594586 0.01587782 0.01570424 0.01564878 0.01563958
[,49] [,50]
[1,] 0.01525552 0.01518891
[2,] 0.01548340 0.01541925
[3,] 0.01551506 0.01545101
[4,] 0.01553288 0.01546877
[5,] 0.01554884 0.01548466
beta <- colSums(fit2$alpha * fit2$mu)
pip <- logisticsusie:::get_pip(fit2$alpha)
pip
[1] 0.09891704 0.07829960 0.09624177 0.07545605 0.07938170 0.07498011
[7] 0.12719772 0.10729779 0.11727321 0.09099496 0.21231442 0.10194633
[13] 0.08006045 0.09960276 0.08568893 0.08622536 0.07467651 0.07572008
[19] 0.12696647 0.08049818 0.07891532 0.08213025 0.08094681 0.07757779
[25] 0.08847984 0.08882116 0.07872442 0.07686421 0.10642906 0.08820371
[31] 0.08046723 0.13313793 0.07653184 0.08520746 0.08396068 0.09046293
[37] 0.10928856 0.07541919 0.08125797 0.08407694 0.09163803 0.08001409
[43] 0.25930039 0.08148138 0.08791766 0.11521838 0.07964465 0.08239555
[49] 0.10630233 0.07805069
hist(beta, breaks = 20)
\(\beta_0 = 1, \beta_1 = 3\)
dat[[3]]$y <- with(dat[[3]], Surv(surT, status == 2))
X = as.matrix(dat[[3]][, c(2:(p+1))])
y = dat[[3]]$y
# IBSS of susie
t1 <- proc.time()
fit3 <- ibss_from_ser(X, y, L = 5, prior_variance = 1., prior_weights = rep(1/p, p), tol = 1e-3, maxit = 500, estimate_intercept = TRUE, ser_function = fit_coxph)
11.43 sec elapsed
t2 <- proc.time()
t2 - t1
user system elapsed
11.204 0.125 11.433
fit3$alpha
[,1] [,2] [,3] [,4] [,5]
[1,] 1.00000000 3.906069e-27 1.675419e-26 2.014098e-27 1.926575e-27
[2,] 0.01950887 1.658920e-02 2.386479e-02 1.673322e-02 1.800562e-02
[3,] 0.01950209 1.656710e-02 2.388698e-02 1.671189e-02 1.798953e-02
[4,] 0.01949367 1.653608e-02 2.391816e-02 1.668192e-02 1.796740e-02
[5,] 0.01948528 1.650605e-02 2.394827e-02 1.665291e-02 1.794583e-02
[,6] [,7] [,8] [,9] [,10]
[1,] 1.817758e-27 1.918188e-27 2.069025e-27 2.956494e-27 1.801192e-27
[2,] 1.714715e-02 2.277042e-02 1.911092e-02 2.070770e-02 1.979865e-02
[3,] 1.712880e-02 2.278482e-02 1.910203e-02 2.070776e-02 1.979646e-02
[4,] 1.710270e-02 2.280491e-02 1.909014e-02 2.070789e-02 1.979306e-02
[5,] 1.707749e-02 2.282421e-02 1.907847e-02 2.070788e-02 1.978979e-02
[,11] [,12] [,13] [,14] [,15]
[1,] 2.183687e-27 1.879390e-27 1.925594e-27 1.628959e-27 1.685278e-27
[2,] 3.411831e-02 1.815886e-02 1.733244e-02 3.131829e-02 1.585318e-02
[3,] 3.422621e-02 1.814401e-02 1.731394e-02 3.138915e-02 1.582863e-02
[4,] 3.438158e-02 1.812354e-02 1.728805e-02 3.148984e-02 1.579398e-02
[5,] 3.453195e-02 1.810359e-02 1.726295e-02 3.158682e-02 1.576051e-02
[,16] [,17] [,18] [,19] [,20]
[1,] 1.817461e-27 3.625354e-27 6.344088e-27 2.497488e-27 2.009520e-27
[2,] 1.805968e-02 1.633921e-02 1.676995e-02 1.844274e-02 1.696057e-02
[3,] 1.804321e-02 1.631636e-02 1.674885e-02 1.843202e-02 1.694020e-02
[4,] 1.802058e-02 1.628418e-02 1.671921e-02 1.841676e-02 1.691163e-02
[5,] 1.799850e-02 1.625307e-02 1.669050e-02 1.840199e-02 1.688395e-02
[,21] [,22] [,23] [,24] [,25]
[1,] 2.324401e-27 2.498763e-27 2.180259e-27 1.659838e-27 3.708013e-27
[2,] 1.849149e-02 1.744273e-02 1.861789e-02 1.683627e-02 1.786814e-02
[3,] 1.848081e-02 1.742445e-02 1.860717e-02 1.681473e-02 1.785184e-02
[4,] 1.846520e-02 1.739897e-02 1.859204e-02 1.678459e-02 1.782932e-02
[5,] 1.845013e-02 1.737425e-02 1.857736e-02 1.675537e-02 1.780741e-02
[,26] [,27] [,28] [,29] [,30]
[1,] 2.214105e-27 1.641400e-27 2.489806e-27 1.810529e-27 2.168610e-27
[2,] 1.844724e-02 1.645180e-02 1.943341e-02 2.061541e-02 1.734142e-02
[3,] 1.843323e-02 1.642927e-02 1.942795e-02 2.061747e-02 1.732268e-02
[4,] 1.841413e-02 1.639758e-02 1.941978e-02 2.062002e-02 1.729653e-02
[5,] 1.839546e-02 1.636693e-02 1.941188e-02 2.062248e-02 1.727115e-02
[,31] [,32] [,33] [,34] [,35]
[1,] 1.779007e-27 5.660515e-27 4.555199e-27 2.327610e-27 1.911868e-27
[2,] 1.698430e-02 2.433003e-02 1.872659e-02 1.794182e-02 2.153487e-02
[3,] 1.696400e-02 2.436003e-02 1.871583e-02 1.792636e-02 2.154304e-02
[4,] 1.693556e-02 2.440151e-02 1.870031e-02 1.790479e-02 2.155412e-02
[5,] 1.690801e-02 2.444172e-02 1.868523e-02 1.788383e-02 2.156478e-02
[,36] [,37] [,38] [,39] [,40]
[1,] 1.149648e-26 1.422744e-27 1.820093e-27 2.807403e-27 2.144626e-27
[2,] 1.968575e-02 1.653145e-02 1.883478e-02 1.744258e-02 1.806534e-02
[3,] 1.967821e-02 1.650896e-02 1.882118e-02 1.742434e-02 1.805010e-02
[4,] 1.966856e-02 1.647739e-02 1.880287e-02 1.739892e-02 1.802912e-02
[5,] 1.965895e-02 1.644683e-02 1.878487e-02 1.737424e-02 1.800869e-02
[,41] [,42] [,43] [,44] [,45]
[1,] 1.711567e-27 2.346235e-27 2.824466e-27 2.169208e-27 1.899895e-27
[2,] 1.957269e-02 1.697462e-02 4.205938e-02 1.682496e-02 2.637732e-02
[3,] 1.956795e-02 1.695368e-02 4.225444e-02 1.680387e-02 2.641444e-02
[4,] 1.956078e-02 1.692450e-02 4.252276e-02 1.677431e-02 2.646692e-02
[5,] 1.955381e-02 1.689618e-02 4.278521e-02 1.674568e-02 2.651746e-02
[,46] [,47] [,48] [,49] [,50]
[1,] 2.378427e-27 1.768879e-27 1.908734e-27 1.975948e-26 3.633366e-27
[2,] 3.140730e-02 1.697480e-02 2.117853e-02 2.192969e-02 1.748765e-02
[3,] 3.149610e-02 1.695394e-02 2.118510e-02 2.193953e-02 1.746929e-02
[4,] 3.161914e-02 1.692486e-02 2.119382e-02 2.195256e-02 1.744379e-02
[5,] 3.173893e-02 1.689665e-02 2.120226e-02 2.196522e-02 1.741902e-02
beta <- colSums(fit3$alpha * fit3$mu)
pip <- logisticsusie:::get_pip(fit3$alpha)
pip
[1] 1.00000000 0.06457314 0.09224394 0.06512614 0.06999246 0.06671876
[7] 0.08811351 0.07422149 0.08029368 0.07685789 0.13035341 0.07058100
[13] 0.06742241 0.11997440 0.06175248 0.07019472 0.06361629 0.06526739
[19] 0.07168188 0.06599711 0.07186546 0.06784275 0.07234463 0.06551685
[25] 0.06946990 0.07167863 0.06404719 0.07545860 0.07995943 0.06745504
[31] 0.06608786 0.09402365 0.07275431 0.06975417 0.08345042 0.07639965
[37] 0.06435074 0.07314709 0.06784244 0.07022433 0.07598857 0.06604712
[43] 0.15913437 0.06547681 0.10165389 0.12040808 0.06604832 0.08210348
[49] 0.08493910 0.06801288
hist(beta, breaks = 20)
Version | Author | Date |
---|---|---|
7fc8ac9 | yunqiyang0215 | 2023-02-23 |
dat[[4]]$y <- with(dat[[4]], Surv(surT, status == 2))
X = as.matrix(dat[[4]][, c(2:(p+1))])
y = dat[[4]]$y
# IBSS of susie
t1 <- proc.time()
fit4 <- ibss_from_ser(X, y, L = 5, prior_variance = 1., prior_weights = rep(1/p, p), tol = 1e-3, maxit = 500, estimate_intercept = TRUE, ser_function = fit_coxph)
27.721 sec elapsed
t2 <- proc.time()
t2 - t1
user system elapsed
27.235 0.299 27.724
t(apply(fit4$alpha, 1, function(x) sort(x, decreasing = TRUE)))
[,1] [,2] [,3] [,4] [,5]
[1,] 0.99999850 4.401840e-07 4.281348e-07 2.176884e-07 1.228304e-07
[2,] 0.02596882 2.209487e-02 2.190327e-02 2.187464e-02 2.170810e-02
[3,] 0.02539242 2.190002e-02 2.172530e-02 2.170210e-02 2.155148e-02
[4,] 0.02523157 2.184554e-02 2.167565e-02 2.165397e-02 2.150796e-02
[5,] 0.02515415 2.181939e-02 2.165188e-02 2.163095e-02 2.148727e-02
[,6] [,7] [,8] [,9] [,10]
[1,] 6.179238e-08 5.971687e-08 4.082684e-08 3.073258e-08 9.656813e-09
[2,] 2.161067e-02 2.157691e-02 2.146093e-02 2.097649e-02 2.067124e-02
[3,] 2.145937e-02 2.142804e-02 2.132289e-02 2.088758e-02 2.061042e-02
[4,] 2.141738e-02 2.138635e-02 2.128428e-02 2.086296e-02 2.059335e-02
[5,] 2.139739e-02 2.136624e-02 2.126570e-02 2.085132e-02 2.058514e-02
[,11] [,12] [,13] [,14] [,15]
[1,] 9.641031e-09 9.360633e-09 9.177612e-09 8.910110e-09 8.101539e-09
[2,] 2.058472e-02 2.033650e-02 2.018600e-02 2.011790e-02 2.010220e-02
[3,] 2.053274e-02 2.030621e-02 2.016905e-02 2.010594e-02 2.009234e-02
[4,] 2.051842e-02 2.029802e-02 2.016440e-02 2.010296e-02 2.008962e-02
[5,] 2.051173e-02 2.029430e-02 2.016224e-02 2.010175e-02 2.008835e-02
[,16] [,17] [,18] [,19] [,20]
[1,] 7.305757e-09 6.182657e-09 5.445837e-09 3.404812e-09 2.755229e-09
[2,] 2.008718e-02 2.005067e-02 2.001103e-02 1.997314e-02 1.993812e-02
[3,] 2.007928e-02 2.004607e-02 2.000991e-02 1.997487e-02 1.994321e-02
[4,] 2.007714e-02 2.004489e-02 2.000964e-02 1.997570e-02 1.994487e-02
[5,] 2.007616e-02 2.004439e-02 2.000955e-02 1.997632e-02 1.994582e-02
[,21] [,22] [,23] [,24] [,25]
[1,] 2.686229e-09 1.970575e-09 1.945238e-09 1.034144e-09 9.581599e-10
[2,] 1.993455e-02 1.993088e-02 1.989158e-02 1.985836e-02 1.985338e-02
[3,] 1.994063e-02 1.993670e-02 1.990208e-02 1.987147e-02 1.986589e-02
[4,] 1.994261e-02 1.993870e-02 1.990516e-02 1.987529e-02 1.986966e-02
[5,] 1.994375e-02 1.993991e-02 1.990674e-02 1.987722e-02 1.987162e-02
[,26] [,27] [,28] [,29] [,30]
[1,] 7.818399e-10 7.674309e-10 6.830067e-10 6.227205e-10 5.723133e-10
[2,] 1.970565e-02 1.957202e-02 1.951608e-02 1.948703e-02 1.946217e-02
[3,] 1.973205e-02 1.961132e-02 1.957019e-02 1.953413e-02 1.950965e-02
[4,] 1.973961e-02 1.962239e-02 1.958405e-02 1.954739e-02 1.952340e-02
[5,] 1.974334e-02 1.962775e-02 1.959003e-02 1.955382e-02 1.953027e-02
[,31] [,32] [,33] [,34] [,35]
[1,] 5.466910e-10 5.075080e-10 3.539676e-10 3.063875e-10 1.842842e-10
[2,] 1.944486e-02 1.936554e-02 1.923525e-02 1.923406e-02 1.923228e-02
[3,] 1.949664e-02 1.942399e-02 1.930689e-02 1.930337e-02 1.930317e-02
[4,] 1.951107e-02 1.944039e-02 1.932680e-02 1.932302e-02 1.932297e-02
[5,] 1.951798e-02 1.944830e-02 1.933629e-02 1.933256e-02 1.933251e-02
[,36] [,37] [,38] [,39] [,40]
[1,] 1.747430e-10 1.334637e-10 1.089957e-10 8.936026e-11 8.865551e-11
[2,] 1.920417e-02 1.916831e-02 1.915272e-02 1.914395e-02 1.908812e-02
[3,] 1.927703e-02 1.924697e-02 1.923607e-02 1.923115e-02 1.917189e-02
[4,] 1.929751e-02 1.926872e-02 1.926023e-02 1.925307e-02 1.919537e-02
[5,] 1.930741e-02 1.927903e-02 1.927098e-02 1.926357e-02 1.920667e-02
[,41] [,42] [,43] [,44] [,45]
[1,] 8.630030e-11 7.890267e-11 7.037296e-11 6.782809e-11 4.697939e-11
[2,] 1.907400e-02 1.906334e-02 1.902531e-02 1.902182e-02 1.897374e-02
[3,] 1.915901e-02 1.915248e-02 1.911487e-02 1.911129e-02 1.907563e-02
[4,] 1.918284e-02 1.917706e-02 1.913995e-02 1.913640e-02 1.910321e-02
[5,] 1.919430e-02 1.918866e-02 1.915200e-02 1.914849e-02 1.911597e-02
[,46] [,47] [,48] [,49] [,50]
[1,] 2.203146e-11 1.651673e-11 1.074914e-11 6.882859e-12 5.781682e-12
[2,] 1.894228e-02 1.890247e-02 1.879540e-02 1.875689e-02 1.873040e-02
[3,] 1.904510e-02 1.900447e-02 1.890217e-02 1.887402e-02 1.885045e-02
[4,] 1.907318e-02 1.903286e-02 1.893250e-02 1.890637e-02 1.888355e-02
[5,] 1.908629e-02 1.904639e-02 1.894729e-02 1.892167e-02 1.889917e-02
beta <- colSums(fit4$alpha * fit4$mu)
pip <- logisticsusie:::get_pip(fit4$alpha)
pip
[1] 0.99999862 0.07739294 0.08099515 0.07488627 0.07766961 0.07384827
[7] 0.08482017 0.08264175 0.08407306 0.07441021 0.07472129 0.08303888
[13] 0.07615657 0.07994512 0.07965149 0.07335042 0.07740738 0.07498521
[19] 0.08315813 0.07471118 0.07879369 0.07712401 0.07803512 0.07448618
[25] 0.07661556 0.07544467 0.07714453 0.07793276 0.08416148 0.07499862
[31] 0.07586377 0.08350476 0.07346223 0.07753776 0.07827329 0.07741725
[37] 0.07326036 0.07780692 0.07572025 0.07798244 0.07577225 0.07443731
[43] 0.09793040 0.07477015 0.07726054 0.07411481 0.07425626 0.07426921
[49] 0.07399996 0.07498698
hist(beta, breaks = 20)
Version | Author | Date |
---|---|---|
7fc8ac9 | yunqiyang0215 | 2023-02-23 |
\(\beta_0 = 1, \beta_1 = 3, \beta_2 = 1.5\) and \(cor=0.9\).
dat[[5]]$y <- with(dat[[5]], Surv(surT, status == 2))
X = as.matrix(dat[[5]][, c(2:(p+1))])
y = dat[[5]]$y
# IBSS of susie
t1 <- proc.time()
fit5 <- ibss_from_ser(X, y, L = 5, prior_variance = 1., prior_weights = rep(1/p, p), tol = 1e-3, maxit = 500, estimate_intercept = TRUE, ser_function = fit_coxph)
12.427 sec elapsed
t2 <- proc.time()
t2 - t1
user system elapsed
11.950 0.143 12.430
fit5$alpha
[,1] [,2] [,3] [,4] [,5]
[1,] 1.000000e+00 2.951448e-14 4.744705e-14 4.408142e-12 9.683011e-13
[2,] 5.565027e-06 9.963555e-01 9.777105e-06 2.393370e-05 6.284830e-06
[3,] 2.019930e-02 1.973330e-02 2.032103e-02 1.963040e-02 2.054747e-02
[4,] 2.019795e-02 1.973279e-02 2.032195e-02 1.963087e-02 2.054779e-02
[5,] 2.019702e-02 1.973165e-02 2.032361e-02 1.963052e-02 2.054937e-02
[,6] [,7] [,8] [,9] [,10]
[1,] 3.048429e-12 1.215586e-12 5.497960e-13 3.516810e-14 1.045804e-12
[2,] 2.224939e-05 5.842976e-06 6.912325e-06 1.768849e-05 4.317834e-04
[3,] 1.958598e-02 2.102606e-02 2.102190e-02 1.987497e-02 1.988565e-02
[4,] 1.958590e-02 2.102635e-02 2.102177e-02 1.987626e-02 1.988460e-02
[5,] 1.958488e-02 2.102899e-02 2.102403e-02 1.987730e-02 1.988323e-02
[,11] [,12] [,13] [,14] [,15]
[1,] 2.854467e-10 6.340245e-14 3.774246e-12 4.224781e-13 8.656499e-14
[2,] 3.097643e-04 6.611563e-06 2.759469e-04 2.556870e-06 2.507300e-05
[3,] 2.098559e-02 2.152798e-02 1.981642e-02 2.114514e-02 1.978303e-02
[4,] 2.098033e-02 2.152734e-02 1.981612e-02 2.114500e-02 1.978416e-02
[5,] 2.097715e-02 2.153027e-02 1.981537e-02 2.114747e-02 1.978482e-02
[,16] [,17] [,18] [,19] [,20]
[1,] 5.880693e-12 2.613779e-14 2.965874e-11 1.154110e-12 3.226502e-12
[2,] 1.652633e-04 1.229575e-04 1.726851e-05 4.154448e-05 6.008049e-05
[3,] 2.001052e-02 1.959511e-02 1.962234e-02 2.001759e-02 1.975518e-02
[4,] 2.000853e-02 1.959610e-02 1.962275e-02 2.001835e-02 1.975459e-02
[5,] 2.000647e-02 1.959622e-02 1.962232e-02 2.001919e-02 1.975342e-02
[,21] [,22] [,23] [,24] [,25]
[1,] 2.622744e-13 1.095544e-12 1.772813e-11 3.664805e-13 3.892065e-13
[2,] 2.932769e-05 1.600562e-05 4.937783e-05 4.332621e-05 8.106863e-05
[3,] 1.952384e-02 2.000942e-02 1.962716e-02 1.952012e-02 1.983567e-02
[4,] 1.952461e-02 2.001021e-02 1.962792e-02 1.952057e-02 1.983617e-02
[5,] 1.952433e-02 2.001105e-02 1.962787e-02 1.951995e-02 1.983632e-02
[,26] [,27] [,28] [,29] [,30]
[1,] 9.092741e-13 1.297225e-12 2.321350e-11 7.054506e-13 3.030540e-12
[2,] 8.974182e-05 1.293551e-05 6.599732e-06 1.846119e-05 6.410664e-05
[3,] 1.972464e-02 1.960200e-02 1.986565e-02 2.025504e-02 1.978652e-02
[4,] 1.972400e-02 1.960274e-02 1.986631e-02 2.025575e-02 1.978590e-02
[5,] 1.972271e-02 1.960262e-02 1.986670e-02 2.025706e-02 1.978476e-02
[,31] [,32] [,33] [,34] [,35]
[1,] 9.822121e-12 1.989826e-14 1.621724e-14 1.596807e-12 2.420515e-12
[2,] 2.347786e-05 9.891101e-06 1.010676e-04 6.441805e-06 1.531396e-05
[3,] 1.971101e-02 2.085632e-02 1.934376e-02 1.968721e-02 1.990278e-02
[4,] 1.971132e-02 2.085728e-02 1.934423e-02 1.968845e-02 1.990340e-02
[5,] 1.971098e-02 2.086018e-02 1.934324e-02 1.968902e-02 1.990382e-02
[,36] [,37] [,38] [,39] [,40]
[1,] 1.794880e-13 2.797555e-11 1.212677e-13 2.220262e-13 1.870529e-12
[2,] 6.416582e-05 1.586921e-04 1.566082e-04 1.729688e-04 3.210676e-05
[3,] 1.975526e-02 2.009616e-02 1.964815e-02 1.978597e-02 1.995486e-02
[4,] 1.975590e-02 2.009386e-02 1.964844e-02 1.978581e-02 1.995513e-02
[5,] 1.975601e-02 2.009167e-02 1.964794e-02 1.978515e-02 1.995532e-02
[,41] [,42] [,43] [,44] [,45]
[1,] 7.312392e-12 1.101674e-11 8.375986e-14 3.513362e-13 7.216898e-14
[2,] 4.683982e-06 2.165192e-04 4.488447e-06 3.724935e-05 2.739111e-05
[3,] 1.989583e-02 1.977641e-02 2.149288e-02 1.969921e-02 1.986360e-02
[4,] 1.989703e-02 1.977566e-02 2.149333e-02 1.969937e-02 1.986417e-02
[5,] 1.989802e-02 1.977436e-02 2.149716e-02 1.969885e-02 1.986444e-02
[,46] [,47] [,48] [,49] [,50]
[1,] 8.998351e-13 3.299784e-11 2.417541e-13 3.609632e-10 4.266177e-13
[2,] 5.526940e-05 3.554366e-04 1.498477e-04 1.405245e-05 7.074424e-05
[3,] 1.975519e-02 1.999706e-02 1.961242e-02 1.970938e-02 1.962153e-02
[4,] 1.975443e-02 1.999536e-02 1.961251e-02 1.970881e-02 1.962181e-02
[5,] 1.975307e-02 1.999359e-02 1.961171e-02 1.970753e-02 1.962125e-02
t(apply(fit5$alpha, 1, function(x) sort(x, decreasing = TRUE)))
[,1] [,2] [,3] [,4] [,5]
[1,] 1.00000000 3.609632e-10 2.854467e-10 3.299784e-11 2.965874e-11
[2,] 0.99635553 4.317834e-04 3.554366e-04 3.097643e-04 2.759469e-04
[3,] 0.02152798 2.149288e-02 2.114514e-02 2.102606e-02 2.102190e-02
[4,] 0.02152734 2.149333e-02 2.114500e-02 2.102635e-02 2.102177e-02
[5,] 0.02153027 2.149716e-02 2.114747e-02 2.102899e-02 2.102403e-02
[,6] [,7] [,8] [,9] [,10]
[1,] 2.797555e-11 2.321350e-11 1.772813e-11 1.101674e-11 9.822121e-12
[2,] 2.165192e-04 1.729688e-04 1.652633e-04 1.586921e-04 1.566082e-04
[3,] 2.098559e-02 2.085632e-02 2.054747e-02 2.032103e-02 2.025504e-02
[4,] 2.098033e-02 2.085728e-02 2.054779e-02 2.032195e-02 2.025575e-02
[5,] 2.097715e-02 2.086018e-02 2.054937e-02 2.032361e-02 2.025706e-02
[,11] [,12] [,13] [,14] [,15]
[1,] 7.312392e-12 5.880693e-12 4.408142e-12 3.774246e-12 3.226502e-12
[2,] 1.498477e-04 1.229575e-04 1.010676e-04 8.974182e-05 8.106863e-05
[3,] 2.019930e-02 2.009616e-02 2.001759e-02 2.001052e-02 2.000942e-02
[4,] 2.019795e-02 2.009386e-02 2.001835e-02 2.001021e-02 2.000853e-02
[5,] 2.019702e-02 2.009167e-02 2.001919e-02 2.001105e-02 2.000647e-02
[,16] [,17] [,18] [,19] [,20]
[1,] 3.048429e-12 3.030540e-12 2.420515e-12 1.870529e-12 1.596807e-12
[2,] 7.074424e-05 6.416582e-05 6.410664e-05 6.008049e-05 5.526940e-05
[3,] 1.999706e-02 1.995486e-02 1.990278e-02 1.989583e-02 1.988565e-02
[4,] 1.999536e-02 1.995513e-02 1.990340e-02 1.989703e-02 1.988460e-02
[5,] 1.999359e-02 1.995532e-02 1.990382e-02 1.989802e-02 1.988323e-02
[,21] [,22] [,23] [,24] [,25]
[1,] 1.297225e-12 1.215586e-12 1.154110e-12 1.095544e-12 1.045804e-12
[2,] 4.937783e-05 4.332621e-05 4.154448e-05 3.724935e-05 3.210676e-05
[3,] 1.987497e-02 1.986565e-02 1.986360e-02 1.983567e-02 1.981642e-02
[4,] 1.987626e-02 1.986631e-02 1.986417e-02 1.983617e-02 1.981612e-02
[5,] 1.987730e-02 1.986670e-02 1.986444e-02 1.983632e-02 1.981537e-02
[,26] [,27] [,28] [,29] [,30]
[1,] 9.683011e-13 9.092741e-13 8.998351e-13 7.054506e-13 5.497960e-13
[2,] 2.932769e-05 2.739111e-05 2.507300e-05 2.393370e-05 2.347786e-05
[3,] 1.978652e-02 1.978597e-02 1.978303e-02 1.977641e-02 1.975526e-02
[4,] 1.978590e-02 1.978581e-02 1.978416e-02 1.977566e-02 1.975590e-02
[5,] 1.978515e-02 1.978482e-02 1.978476e-02 1.977436e-02 1.975601e-02
[,31] [,32] [,33] [,34] [,35]
[1,] 4.266177e-13 4.224781e-13 3.892065e-13 3.664805e-13 3.513362e-13
[2,] 2.224939e-05 1.846119e-05 1.768849e-05 1.726851e-05 1.600562e-05
[3,] 1.975519e-02 1.975518e-02 1.973330e-02 1.972464e-02 1.971101e-02
[4,] 1.975459e-02 1.975443e-02 1.973279e-02 1.972400e-02 1.971132e-02
[5,] 1.975342e-02 1.975307e-02 1.973165e-02 1.972271e-02 1.971098e-02
[,36] [,37] [,38] [,39] [,40]
[1,] 2.622744e-13 2.417541e-13 2.220262e-13 1.794880e-13 1.212677e-13
[2,] 1.531396e-05 1.405245e-05 1.293551e-05 9.891101e-06 9.777105e-06
[3,] 1.970938e-02 1.969921e-02 1.968721e-02 1.964815e-02 1.963040e-02
[4,] 1.970881e-02 1.969937e-02 1.968845e-02 1.964844e-02 1.963087e-02
[5,] 1.970753e-02 1.969885e-02 1.968902e-02 1.964794e-02 1.963052e-02
[,41] [,42] [,43] [,44] [,45]
[1,] 8.656499e-14 8.375986e-14 7.216898e-14 6.340245e-14 4.744705e-14
[2,] 6.912325e-06 6.611563e-06 6.599732e-06 6.441805e-06 6.284830e-06
[3,] 1.962716e-02 1.962234e-02 1.962153e-02 1.961242e-02 1.960200e-02
[4,] 1.962792e-02 1.962275e-02 1.962181e-02 1.961251e-02 1.960274e-02
[5,] 1.962787e-02 1.962232e-02 1.962125e-02 1.961171e-02 1.960262e-02
[,46] [,47] [,48] [,49] [,50]
[1,] 3.516810e-14 2.951448e-14 2.613779e-14 1.989826e-14 1.621724e-14
[2,] 5.842976e-06 5.565027e-06 4.683982e-06 4.488447e-06 2.556870e-06
[3,] 1.959511e-02 1.958598e-02 1.952384e-02 1.952012e-02 1.934376e-02
[4,] 1.959610e-02 1.958590e-02 1.952461e-02 1.952057e-02 1.934423e-02
[5,] 1.959622e-02 1.958488e-02 1.952433e-02 1.951995e-02 1.934324e-02
beta <- colSums(fit5$alpha * fit5$mu)
pip <- logisticsusie:::get_pip(fit5$alpha)
pip
[1] 1.00000000 0.99656704 0.05974520 0.05776583 0.06039253 0.05763446
[7] 0.06176975 0.06175763 0.05846785 0.05888170 0.06192237 0.06321133
[13] 0.05853754 0.06210802 0.05820914 0.05898804 0.05775883 0.05773612
[19] 0.05890004 0.05815678 0.05746428 0.05885252 0.05778131 0.05746581
[25] 0.05841190 0.05809648 0.05767431 0.05842871 0.05956262 0.05825089
[31] 0.05799751 0.06128698 0.05701124 0.05791550 0.05854387 0.05816445
[37] 0.05922783 0.05794152 0.05835316 0.05870887 0.05851550 0.05836489
[43] 0.06311146 0.05797599 0.05844209 0.05815177 0.05912910 0.05783148
[49] 0.05798133 0.05778379
hist(beta, breaks = 20)
Version | Author | Date |
---|---|---|
7fc8ac9 | yunqiyang0215 | 2023-02-23 |
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] logisticsusie_0.0.0.9004 testthat_3.1.0 survival_3.2-11
[4] workflowr_1.6.2
loaded via a namespace (and not attached):
[1] tidyselect_1.1.1 xfun_0.27 bslib_0.4.1 remotes_2.4.1
[5] purrr_0.3.4 splines_4.1.1 lattice_0.20-44 generics_0.1.2
[9] vctrs_0.3.8 usethis_2.1.3 htmltools_0.5.2 yaml_2.2.1
[13] utf8_1.2.2 rlang_1.0.6 pkgbuild_1.2.0 jquerylib_0.1.4
[17] later_1.3.0 pillar_1.6.4 glue_1.4.2 withr_2.5.0
[21] sessioninfo_1.1.1 matrixStats_0.63.0 lifecycle_1.0.1 stringr_1.4.0
[25] tictoc_1.1 devtools_2.4.2 evaluate_0.14 memoise_2.0.1
[29] knitr_1.36 callr_3.7.0 fastmap_1.1.0 httpuv_1.6.3
[33] ps_1.6.0 fansi_0.5.0 highr_0.9 Rcpp_1.0.8.3
[37] promises_1.2.0.1 cachem_1.0.6 desc_1.4.0 pkgload_1.2.3
[41] jsonlite_1.7.2 fs_1.5.0 digest_0.6.28 stringi_1.7.5
[45] dplyr_1.0.7 processx_3.5.2 rprojroot_2.0.2 grid_4.1.1
[49] cli_3.1.0 tools_4.1.1 magrittr_2.0.1 sass_0.4.4
[53] tibble_3.1.5 crayon_1.4.1 whisker_0.4 pkgconfig_2.0.3
[57] ellipsis_0.3.2 Matrix_1.5-3 prettyunits_1.1.1 rmarkdown_2.11
[61] rstudioapi_0.13 R6_2.5.1 git2r_0.28.0 compiler_4.1.1