Skip to content

Commit 62b24d9

Browse files
committed
Fix code for print_priors
1 parent e04e33f commit 62b24d9

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

R/print.survHE.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#' significant digits to be shown in the summary table (default = 6);
1414
#' \code{original} = a flag to say whether the *original* table
1515
#' from either \code{flexsurv} or \code{INLA} or \code{rstan} should be printed;
16-
#' \code{print_priors} = a flag to sy whether the Stan table should also
17-
#' include a summary of the prior used in the HMC model
16+
#' \code{print_priors} = a flag to say whether the distributional assumptions
17+
#' for the HMC model (only)
1818
#'
1919
#' @author Gianluca Baio
2020
#' @template refs
@@ -37,7 +37,7 @@ print.survHE <- function(x,mod=1,...) {
3737
# ... optional arguments
3838
# digits = number of *significant* digits to be shown in the summary table (default = 6)
3939
# original = a flag to say whether the *original* table from either INLA or MCMC should be printed
40-
# print_priors = a flag to say whether the Stan table should also print a summary of the prior distributions
40+
# print_priors = a flag to say whether the distributional assumptions for the HMC model (only)
4141

4242
exArgs <- list(...)
4343

@@ -49,13 +49,14 @@ print.survHE <- function(x,mod=1,...) {
4949
if(!exists("original",where=exArgs)){original=FALSE} else {original=exArgs$original}
5050
# Aliases for 'original'
5151
if(exists("orig",exArgs)){original=exArgs$orig}
52+
if(!exists("print_priors",where=exArgs)){print_priors=FALSE} else {print_priors=exArgs$print_priors}
5253

5354
# Now computes the stats, using different helpers depending on the underlying method
5455
# Can ask for the original output from either 'flexsurv', 'inla' or 'rstan'
5556
if(original==TRUE) {
5657
do.call(
5758
paste0("original_table_",x$method),
58-
args=list(x,mod,digits,...)
59+
args=list(x,mod,digits,print_priors)
5960
)
6061
} # If not, go with the default formatting using the standardised 'survHE' output
6162
else {

R/utils_print_survHE.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ add_effects_hmc <- function(table,x) {
616616
#' @references Baio (2020). survHE
617617
#' @keywords MLE
618618
#' @noRd
619-
original_table_mle <- function(x,mod,digits,...) {
619+
original_table_mle <- function(x,mod,digits,print_priors) {
620620
print(x$models[[mod]],digits=digits)
621621
}
622622

@@ -630,7 +630,7 @@ original_table_mle <- function(x,mod,digits,...) {
630630
#' @references Baio (2020). survHE
631631
#' @keywords INLA
632632
#' @noRd
633-
original_table_inla <- function(x,mod,digits,...) {
633+
original_table_inla <- function(x,mod,digits,print_priors) {
634634
print(summary(x$models[[mod]]),digits=digits)
635635
cat("\n")
636636
cat("NB: notice that INLA models are fitted to data rescaled in [0-1] for computational stability.")
@@ -648,9 +648,7 @@ original_table_inla <- function(x,mod,digits,...) {
648648
#' @references Baio (2020). survHE
649649
#' @keywords HMC
650650
#' @noRd
651-
original_table_hmc <- function(x,mod,digits,...) {
652-
exArgs=list(...)
653-
if(!exists("print_priors",where=exArgs)){print_priors=FALSE} else {print_priors=exArgs$print_priors}
651+
original_table_hmc <- function(x,mod,digits,print_priors) {
654652
print(x$models[[mod]],digits=digits)
655653
if (print_priors==TRUE) {
656654
cat("\nPrior modelling assumptions")

man/print.survHE.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)