Prints a Bayes factor as a number, in the regime that keeps it
readable, with the subscript that matches the direction of the number.
No verbal category is attached; see apa_bf_label() for the opt-in
helper and the caveat.
Arguments
- x
Numeric vector of Bayes factors as BF10, evidence for H1 over H0, the scale that
bayestestR,brms::hypothesis()andBayesFactorreturn. Values of 0 or more;NAandInfallowed.- direction
"10"prints BF10 as given;"01"prints BF01 = 1 / BF10 and the subscript01.- style
Regime selection; see Details.
- digits
Decimals in the two-decimal regime and in the mantissa under
style = "sci".- big_mark
TRUEseparates groups of three digits with a comma (1,240), the APA rule for numbers of 1,000 or more.- markup
NULLor one of"md","latex","typst","plain".NULLusesgetOption("apabayes.markup"), then the knitr output format, then"md". Decides the minus sign (U+2212 outside"plain") and the infinity symbol.- symbol
TRUEprepends*BF*~10~ =(or*BF*~01~ =).
Details
With style = "auto", the value after direction is applied prints
as
the infinity symbol when infinite,
0when zero;a mantissa with
digitsdecimals times a power of ten when 10,000 or more, or below10^-digits(1.23 × 10^5^,4.00 × 10^−4^at the defaultdigits = 2), so that a small BF10 never prints as0.00;one decimal from 10 up to 10,000 (
20.9);digitsdecimals otherwise (5.34).
style = "sci" prints every finite positive value as a mantissa with
digits decimals times a power of ten (2.09 × 10^1^).
style = "plain" never uses scientific notation: one decimal from 10
up, digits decimals below.
The reporting guidelines this package follows treat the Bayes factor as a continuous measure of relative evidence and ask for the number with an unambiguous direction (Tendeiro et al., 2024; van Doorn et al., 2021). Report the prior, the estimation method and the posterior estimate next to it, and do not read a value near 1 as evidence of absence.
References
Tendeiro, J. N., Kiers, H. A. L., Hoekstra, R., Wong, T. K., & Morey, R. D. (2024). Diagnosing the misuse of the Bayes factor in applied research. Advances in Methods and Practices in Psychological Science, 7(1). doi:10.1177/25152459231213371
van Doorn, J., van den Bergh, D., Böhm, U., Dablander, F., Derks, K., Draws, T., Etz, A., Evans, N. J., Gronau, Q. F., Haaf, J. M., Hinne, M., Kucharský, Š., Ly, A., Marsman, M., Matzke, D., Gupta, A. R. K. N., Sarafoglou, A., Stefan, A., Voelkel, J. G., & Wagenmakers, E.-J. (2021). The JASP guidelines for conducting and reporting a Bayesian analysis. Psychonomic Bulletin & Review, 28(3), 813–826. doi:10.3758/s13423-020-01798-5
See also
apa_er() for evidence ratios from brms::hypothesis(),
apa_bf_label() for verbal categories.
Examples
apa_bf(c(0.05, 5.3412, 20.86, 123456, Inf, NA))
#> [1] "0.05" "5.34" "20.9" "1.23 × 10^5^" "∞"
#> [6] NA
apa_bf(20.86, direction = "01", symbol = TRUE)
#> [1] "*BF*~01~ = 0.05"
apa_bf(20.86, style = "sci")
#> [1] "2.09 × 10^1^"
apa_bf(123456, markup = "latex")
#> [1] "1.23 $\\times$ 10^5^"
