formatBF: Formatting of Bayes factors

Description Usage Arguments Details Value References Examples

View source: R/formatBF.R

Description

Bayes factors <1 are represented as ratios 1/x, where x is rounded to the specified number of digits. Bayes factors >=1 are rounded to the specified number of digits.

Usage

1
formatBF(BF, digits="default")

Arguments

BF

a numeric vector of Bayes factors

digits

either "default" (see Details) or a positive integer specifiying the number of decimal places to round the Bayes factor (for Bayes factors >= 1) or its inverse (for Bayes factors < 1) to

Details

The default formatting, which is recommended in Held and Ott (2018), is as follows : For very small Bayes factors BF < 1/1000, "< 1/1000" is returned. Bayes factors BF with 1/1000 <= BF <=1/10 are formatted as 1/x, where x is an integer and Bayes factors BF with 1/10 < BF < 1 as 1/x, where x is rounded to one decimal place. Accordingly, Bayes factors 1 <= BF < 10 are rounded to one decimal place, Bayes factors 10 <= BF <= 1000 are rounded to the next integer and for larger Bayes factors, "> 1000" is returned.

If digits is specified, the Bayes factor (if it is >= 1) or its inverse (if the Bayes factor is <1) is rounded to the number of decimal places specified and returned as a ratio if the Bayes factor is <1.

Value

A character vector of ratios (for inputs <1) or rounded numeric values (for inputs >=1).

References

Held, L. and Ott, M. (2018). On p-values and Bayes factors. Annual Review of Statistics and Its Application, 5, 393–419.

Examples

1
2
3
4
5
 BF <- c(0.0001, 0.0049, 0.0258, 0.24, 2.798)
 # use the default formatting
 formatBF(BF)
 # specify the number of digits
 formatBF(c(0.087, 4.65), digits=1)

pCalibrate documentation built on March 23, 2020, 3:01 a.m.