Main function:
bvs(
X,
resp,
prep = TRUE, # If preprocessing
logT = FALSE,
fixed_cols = NULL,
eff_size = 0.5, # expected effect size
family = c("logistic", "survival"),
hselect = TRUE, # whether the automatic procedure for hyperparameter selection should be run or not.
nlptype = "piMOM",
r = 1,
tau = 0.25,
niter = 30,
mod_prior = c("unif", "beta"),
inseed = NULL,
cplng = FALSE, # This parameter is only used in logistic regression models
ncpu = 4,
parallel.MPI = FALSE
)
Data 1: null model with X independent
# Create survival response
dat[[1]]$y <- with(dat[[1]], Surv(surT, status))
p = 50
X = as.data.frame(dat[[1]][, c(2:(p+1))])
y = dat[[1]]$y
# prep: standardizing non-binary columns and adding intercept
fit1 = bvs(X, resp = y, prep = TRUE, family = "survival", mod_prior = "beta", niter = 100)
# The coefficient vector for the selected model.
# The first component is always for the intercept.
fit1$beta_hat
[1] -0.416437
# The indices of the model with highest posterior probability among all visited
# models, with respect to the columns in the output des_mat.
fit1$HPM
[,1]
[1,] 4
hist(fit1$inc_probs, breaks = 30)
Data 3: simulated from one predictor model. Predictors are independent.
# Create survival response
dat[[3]]$y <- with(dat[[3]], Surv(surT, status))
p = 50
X = as.data.frame(dat[[3]][, c(2:(p+1))])
y = dat[[3]]$y
fit3 = bvs(X, resp = y, prep = TRUE, family = "survival", mod_prior = "beta", niter = 100)
fit3$beta_hat
[1] -3.600575
fit3$HPM
[,1]
[1,] 1
hist(fit3$inc_probs, breaks = 30)
Data 5: simulated from two predictor model. Predictors have high correlation, corr = 0.9
# Create survival response
dat[[5]]$y <- with(dat[[5]], Surv(surT, status))
p = 50
X = as.data.frame(dat[[5]][, c(2:(p+1))])
y = dat[[5]]$y
fit5 = bvs(X, resp = y, prep = TRUE, family = "survival", mod_prior = "beta", niter = 100)
fit5$beta_hat
[1] -2.778218 -1.924257
fit5$HPM
[,1]
[1,] 1
[2,] 2
hist(fit5$inc_probs, breaks = 30)
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] BVSNLP_1.1.9 survival_3.2-11 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] iterators_1.0.14 tools_4.1.1 digest_0.6.28 lattice_0.20-44
[13] jsonlite_1.7.2 evaluate_0.14 lifecycle_1.0.1 tibble_3.1.5
[17] pkgconfig_2.0.3 rlang_1.0.6 foreach_1.5.2 Matrix_1.5-3
[21] cli_3.1.0 rstudioapi_0.13 parallel_4.1.1 yaml_2.2.1
[25] xfun_0.27 fastmap_1.1.0 stringr_1.4.0 knitr_1.36
[29] fs_1.5.0 vctrs_0.3.8 sass_0.4.4 grid_4.1.1
[33] rprojroot_2.0.2 glue_1.4.2 R6_2.5.1 fansi_0.5.0
[37] rmarkdown_2.11 magrittr_2.0.1 whisker_0.4 codetools_0.2-18
[41] splines_4.1.1 promises_1.2.0.1 ellipsis_0.3.2 htmltools_0.5.2
[45] httpuv_1.6.3 utf8_1.2.2 stringi_1.7.5 doParallel_1.0.17
[49] cachem_1.0.6 crayon_1.4.1