Skip to content

Commit

Permalink
Updated MPM output in coef.BayesSurvive()
Browse files Browse the repository at this point in the history
  • Loading branch information
zhizuio committed Jul 10, 2024
1 parent 3e5e1a1 commit a82e430
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 4,106 deletions.
15 changes: 7 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Package: BayesSurvive
Title: Bayesian Survival Models for High-Dimensional Data
Version: 0.0.3
Date: 2024-06-05
Version: 0.0.4
Date: 2024-07-10
Authors@R: c(person("Zhi", "Zhao", role=c("aut","cre"), email = "[email protected]"),
person("Waldir", "Leoncio", role=c("aut")),
person("Katrin", "Madjar", role=c("aut")),
person("Tobias", "Østmo Hermansen", role=c("aut")),
person("Manuela", "Zucknick", role=c("ctb")),
Expand All @@ -15,19 +16,17 @@ VignetteBuilder: knitr
Depends: R (>= 4.0)
Encoding: UTF-8
RoxygenNote: 7.3.1
LinkingTo: Rcpp, RcppArmadillo (>= 0.9.000)
LinkingTo: Rcpp, RcppArmadillo, testthat
Imports: Rcpp, ggplot2, GGally, mvtnorm, survival, riskRegression,
utils, stats
Suggests:
knitr,
testthat (>= 3.0.0)
Suggests: knitr, testthat
LazyData: true
NeedsCompilation: yes
Packaged: 2024-06-05 07:00:29 UTC; zhiz
Packaged: 2024-07-10 08:34:27 UTC; zhiz
Author: Zhi Zhao [aut, cre],
Waldir Leoncio [aut],
Katrin Madjar [aut],
Tobias Østmo Hermansen [aut],
Manuela Zucknick [ctb],
Jörg Rahnenführer [ctb]
Maintainer: Zhi Zhao <[email protected]>
Config/testthat/edition: 3
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# BayesSurvive 0.0.4

* Add units tests
* Rename the output of MPM coefficients in function `coef.BayesSurvive()`

# BayesSurvive 0.0.3

* Add IPA in function `predict.BayesSurvive()`
Expand Down
10 changes: 10 additions & 0 deletions R/BayesSurvive-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@
#' @useDynLib BayesSurvive, .registration = TRUE
## usethis namespace: end
NULL

## nocov start

.onLoad <- function(libname, pkgname) {
# CRAN OMP THREAD LIMIT
Sys.setenv("OMP_THREAD_LIMIT" = 1)

}

## nocov end
7 changes: 3 additions & 4 deletions R/coef.BayesSurvive.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,10 @@ coef.BayesSurvive <- function(object, MPM = FALSE, type = "mean", CI = 95,
}
tbl <- data.frame(
term = x_names,
beta_MPM = object$output$beta.margin,
gamma = object$output$gamma.margin
estimate = object$output$beta.margin
)
tbl$estimate <- (object$output$gamma.margin >= 0.5) *
object$output$beta.margin / object$output$gamma.margin
tbl$estimate <- tbl$estimate / object$output$gamma.margin *
(object$output$gamma.margin >= 0.5)
tbl$estimate[is.na(tbl$estimate)] <- 0
}

Expand Down
10 changes: 4 additions & 6 deletions R/func_MCMC.R
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,8 @@ func_MCMC <- function(survObj, hyperpar, initial,
# MCMC sampling

# Initializes the progress bar
if (verbose) {
cat(" Running MCMC iterations ...\n")
pb <- txtProgressBar(min = 0, max = nIter, style = 3, width = 50, char = "=")
}
if (verbose) cat(" Running MCMC iterations ...\n")
pb <- txtProgressBar(min = 0, max = nIter, style = 3, width = 50, char = "=")

for (M in 1:nIter) {
# if (method %in% c("CoxBVSSL", "Sub-struct") ||
Expand Down Expand Up @@ -285,9 +283,9 @@ func_MCMC <- function(survObj, hyperpar, initial,
# }

# Sets the progress bar to the current state
if (verbose) setTxtProgressBar(pb, M)
setTxtProgressBar(pb, M)
} # the end of MCMC sampling
if (verbose) close(pb) # Close the connection of progress bar
close(pb) # Close the connection of progress bar

if (S == 1 && MRF_G) {
mcmcOutcome$gamma.margin <- mcmcOutcome$gamma.margin / (nIter - burnin)
Expand Down
Binary file modified build/partial.rdb
Binary file not shown.
Binary file modified build/vignette.rds
Binary file not shown.
Loading

0 comments on commit a82e430

Please sign in to comment.