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

  BFE_ <- as.data.frame(BFE)
  if (log) {
    BFE_$BF <- log(BFE_$BF)
  }


  # indicate null-model
  BFE_$Model[BFE_$Model == "1"] <- "(Intercept only)"

  rownames(BFE_) <- paste0("[", seq_len(nrow(BFE_)), "] ", BFE_$Model, "   ")
  denM <- rownames(BFE_)[denominator]
  BFE_ <- BFE_[-denominator, "BF", drop = FALSE]
  colnames(BFE_) <- ""

  cat("Bayes factor analysis
---------------------")
  print.data.frame(BFE_, digits = digits)
  cat("
Against denominator:
	", denM)
  cat("
---
Bayes factor type: ", grid.type, "
")
  if (log) cat("Presenting log(BF)
")
  invisible(x)
}
back to top