View source: R/P-value_Functions.R
p2bfb | R Documentation |
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.
p2bfb(p, digits = NULL)
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. |
=============================================================================
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.
A numeric vector of BFB values of the same length as p.
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
p2bfb(.05)
p2bfb(c(.1, .05, .01, .005, .001, .0001, .00001), digits = 2)
p2bfb(0)
p2bfb(p = NA) # Missing p returns a missing value.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.