https://github.com/cran/bayestestR
Raw File
Tip revision: 3da49db3cf0eea4d2c5eba241ddb5470cd7dd929 authored by Dominique Makowski on 26 January 2021, 16:40:03 UTC
version 0.8.2
Tip revision: 3da49db
print.bayesfactor_restricted.R
#' @export
print.bayesfactor_restricted <- function(x, digits = 3, log = FALSE, ...) {
  BFE <- as.data.frame(x)

  # Format
  if (log) {
    BFE$BF <- log(BFE$BF)
  }
  BFE$BF <- insight::format_value(BFE$BF, digits = digits, missing = "NA")
  colnames(BFE) <- c("Hypothesis", "P(Prior)", "P(Posterior)", "BF")

  # footer
  footer <- list(
    c("\n* Bayes factors for the restricted model vs. the un-restricted model.\n"),
    if (log) c("\nBayes Factors are on the log-scale.\n", "red")
  )


  cat(insight::export_table(
    BFE, digits = digits, sep = " ", header = NULL,
    caption = c("# Bayes Factor (Order-Restriction)", "blue"),
    footer = footer
  ))


  invisible(x)
}
back to top