https://github.com/cran/bayestestR
Revision d8462ad2168ad7ee61c0d7e679174e775f01a9be authored by Dominique Makowski on 18 January 2020, 07:10 UTC, committed by cran-robot on 18 January 2020, 07:10 UTC
1 parent 4936034
Raw File
Tip revision: d8462ad2168ad7ee61c0d7e679174e775f01a9be authored by Dominique Makowski on 18 January 2020, 07:10 UTC
version 0.5.0
Tip revision: d8462ad
print.bayesfactor_parameters.R
#' @export
print.bayesfactor_parameters <- function(x, digits = 2, log = FALSE, ...) {
  BFE <- x
  null <- attr(BFE, "hypothesis")
  direction <- attr(BFE, "direction")

  if (log) {
    BFE$BF <- log(BFE$BF)
  }

  BFE$BF <- .format_big_small(BFE$BF, digits = digits)

  if (length(null) == 1) {
    insight::print_color("# Bayes Factor (Savage-Dickey density ratio)\n\n", "blue")
  } else {
    insight::print_color("# Bayes Factor (Null-Interval)\n\n", "blue")
  }

  print_data_frame(BFE, digits = digits)

  cat("* Evidence Against The Null: ")
  insight::print_color(
    paste0("[", paste0(round(null, digits), collapse = ", "), "]\n", sep = ""),
    "cyan"
  )

  if (direction < 0) {
    cat("*                 Direction: ")
    insight::print_color("Left-Sided test\n", "cyan")
  } else if (direction > 0) {
    cat("*                 Direction: ")
    insight::print_color("Right-Sided test\n", "cyan")
  }

  if (log) insight::print_color("\nBayes Factors are on the log-scale.\n", "red")
  invisible(x)
}
back to top