p2bfb: Convert p-values into Bayes Factor Bounds (BFBs)

View source: R/P-value_Functions.R

p2bfbR Documentation

Convert p-values into Bayes Factor Bounds (BFBs)

Description

This function converts p-values into Bayes Factor Bounds (BFBs), which are the data-based odds of the alternative hypotheis H1 being true to the null hypothesis H0 being true and the upper bound on the Bayes Factor.

Usage

p2bfb(p, digits = NULL)

Arguments

p

A numeric p-value (or numeric vector of p-values), obtained from running a statistical model or test. All values should be proportions within the closed unit interval (0 <= p <= 1).

digits

An integer specifying the number of decimal places to used when rounding the BFB. Defaults to NULL, which does not round the result.

Details

=============================================================================

Bayes Factor Bounds (BFBs) are the data-based odds of the alternative hypotheis H1 being true to the null hypothesis H0 being true (Benjamin & Berger, 2019). They are the upper bound on the Bayes Factor for a given test. The BFBs are most useful when the p-value lies in the open unit interval (0 < p < 1). Plugging in p = 0 or p = 1 will return NaN or -Inf, respectively.

The second example is intended to replicate the table on p. 188 of Benjamin and Berger's (2019) paper. Personal communication with Dan Benjamin (11/27/2019) indicates that my code is correct, but the published table either contains a mistake or has rounding errors that lead to discrepancies.

Value

A numeric vector of BFB values of the same length as p.

References

Benjamin, D. J., & Berger, J. O. (2019). Three recommendations for improving the use of p-values. The American Statistician, 73 (Supplement 1), 186-191. doi:10.1080/00031305.2018.1543135

Wasserstein, R. L., Schirm, A. L., & Lazar, N. A. (2019). Moving to a world beyond "p < .05". The American Statistician, 73(Supplement 1), 1-19. doi:10.1080/00031305.2019.1583913

Examples

p2bfb(.05)
p2bfb(c(.1, .05, .01, .005, .001, .0001, .00001), digits = 2)
p2bfb(0)
p2bfb(p = NA) # Missing p returns a missing value.


sjpierce/piercer documentation built on Dec. 30, 2024, 3:28 p.m.