diff --git a/R/func_MCMC.R b/R/func_MCMC.R index c1ee4fa..20e8933 100755 --- a/R/func_MCMC.R +++ b/R/func_MCMC.R @@ -156,8 +156,10 @@ 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") || @@ -284,9 +286,9 @@ func_MCMC <- function(survObj, hyperpar, initial, # } # Sets the progress bar to the current state - setTxtProgressBar(pb, M) + if (verbose) setTxtProgressBar(pb, M) } # the end of MCMC sampling - close(pb) # Close the connection of progress bar + if (verbose) close(pb) # Close the connection of progress bar if (S == 1 && MRF_G) { mcmcOutcome$gamma.margin <- mcmcOutcome$gamma.margin / (nIter - burnin)