formatBF {BayesRep}R Documentation

Formatting of Bayes factors

Description

Formats Bayes factors such that Bayes factors smaller than 1 are represented as ratios 1/x, where x is rounded to the specified number of digits, while Bayes factors larger than 1 are only rounded to the specified number of digits.

Usage

formatBF(BF, digits = "default")

Arguments

BF

Bayes factor

digits

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

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 \leq BF \leq 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 \leq BF < 10 are rounded to one decimal place, Bayes factors 10 \leq BF \leq 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 \geq 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 \geq 1) ).

Author(s)

Manuela Ott (creator of package pCalibrate), Leonhard Held (contributor of package pCalibrate), Samuel Pawel (made small changes to pCalibrate::formatBF)

References

Held, L. and Ott, M. (2018). On p-values and Bayes factors. Annual Review of Statistics and Its Application, 5, 393-419. doi:10.1146/annurev-statistics-031017-100307

Examples

(bf <- BFr(to = 2, so = 0.5, tr = 2.5, sr = 0.9))
formatBF(BF = bf)


[Package BayesRep version 0.42.2 Index]