Learn R Programming

DPI (version 2025.11)

p_to_bf: Convert p values to approximate (pseudo) Bayes Factors (PseudoBF10).

Description

Convert p values to approximate (pseudo) Bayes Factors (PseudoBF10). This transformation has been suggested by Wagenmakers (2022).

Usage

p_to_bf(p, n, log = FALSE, label = FALSE)

Value

A (named) numeric vector of pseudo Bayes Factors (\(\text{PseudoBF}_{10}\)).

Arguments

p

p value(s).

n

Number of observations.

log

Return log(BF10) or raw BF10. Defaults to FALSE.

label

Add labels (i.e., names) to returned values. Defaults to FALSE.

References

Wagenmakers, E.-J. (2022). Approximate objective Bayes factors from p-values and sample size: The \(3p\sqrt{n}\) rule. PsyArXiv. tools:::Rd_expr_doi("10.31234/osf.io/egydq")

See Also

bayestestR::p_to_bf()

Examples

Run this code
p_to_bf(0.05, 100)
p_to_bf(c(0.01, 0.05), 100)
p_to_bf(c(0.001, 0.01, 0.05, 0.1), 100, label=TRUE)
p_to_bf(c(0.001, 0.01, 0.05, 0.1), 1000, label=TRUE)

Run the code above in your browser using DataLab