https://github.com/cran/bayestestR
Raw File
Tip revision: 9985109256c08d654edb46adb9cb20c913fb1888 authored by Dominique Makowski on 29 May 2019, 14:10:02 UTC
version 0.2.0
Tip revision: 9985109
print.bayesfactor_savagedickey.R
#' @export
print.bayesfactor_savagedickey <- function(x, digits = 2, log = FALSE, ...) {
  BFE <- x
  hypothesis <- attr(BFE, "hypothesis")
  direction <- attr(BFE, "direction")

  if (log) {
    BFE$BF <- log(BFE$BF)
    colnames(BFE)[colnames(BFE) == "BF"] <- "log(Bayes Factor)"
  } else {
    colnames(BFE)[colnames(BFE) == "BF"] <- "Bayes Factor"
  }

  insight::print_color("# Bayes Factor (Savage-Dickey density ratio)\n\n", "blue")

  print.data.frame(BFE, digits = digits, row.names = FALSE)
  cat("---\n")
  cat(paste0("Evidence Against Test Value: ", round(hypothesis, digits), "\n"))
  if (direction < 0) {
    cat(paste0("Left-Sided test\n"))
  } else if (direction > 0) {
    cat(paste0("Right-Sided test\n"))
  }
  invisible(x)
}
back to top