Learn R Programming

tidyBF (version 0.3.0)

bf_expr: Prepare caption with expression for Bayes Factor results

Description

Convenience function to create an expression with Bayes Factor results.

Usage

bf_expr(
  bf.object,
  k = 2L,
  conf.level = 0.95,
  conf.method = "hdi",
  centrality = "median",
  output = "null",
  caption = NULL,
  anova.design = FALSE,
  ...
)

Arguments

bf.object

An object from BayesFactor package.

k

Number of digits after decimal point (should be an integer) (Default: k = 2L).

conf.level

Value or vector of probability of the CI (between 0 and 1) to be estimated. Default to 0.95 (95%).

conf.method

The type of index used for Credible Interval. Can be "hdi" (default, see bayestestR::hdi()), "eti" (see bayestestR::eti()) or "si" (see bayestestR::si()).

centrality

The point-estimates (centrality indices) to compute. Character (vector) or list with one or more of these options: "median", "mean", "MAP" or "all".

output

Can either be "null" (or "caption" or "H0" or "h0"), which will return expression with evidence in favor of the null hypothesis, or "alternative" (or "title" or "H1" or "h1"), which will return expression with evidence in favor of the alternative hypothesis, or "results", which will return a dataframe with results all the details).

caption

Text to display as caption (will be displayed on top of the Bayes Factor caption/message).

anova.design

Whether the object is from BayesFactor::anovaBF (default: FALSE). The expression is different for anova designs because not all details are available.

...

Additional arguments passed to parameters::model_parameters.BFBayesFactor().

Examples

Run this code
# NOT RUN {
# for reproducibility
set.seed(123)
library(tidyBF)

# creating caption (for null)
bf_expr(
  BayesFactor::correlationBF(
    x = iris$Sepal.Length,
    y = iris$Petal.Length
  ),
  output = "null",
  k = 3,
  caption = "Note: Iris dataset"
)
# }

Run the code above in your browser using DataLab