| bf {bridgesampling} | R Documentation |
Bayes Factor(s) from Marginal Likelihoods
Description
Generic function that computes Bayes factor(s) from marginal likelihoods. bayes_factor() is simply an (S3 generic) alias for bf().
Usage
bf(x1, x2, log = FALSE, ...)
bayes_factor(x1, x2, log = FALSE, ...)
## Default S3 method:
bayes_factor(x1, x2, log = FALSE, ...)
## S3 method for class 'bridge'
bf(x1, x2, log = FALSE, ...)
## S3 method for class 'bridge_list'
bf(x1, x2, log = FALSE, ...)
## Default S3 method:
bf(x1, x2, log = FALSE, ...)
Arguments
x1 |
Object of class |
x2 |
Object of class |
log |
Boolean. If |
... |
currently not used here, but can be used by other methods. |
Details
Computes the Bayes factor (Kass & Raftery, 1995) in favor of the model associated with x1 over the model associated with x2.
Value
For the default method returns a list of class "bf_default" with components:
-
bf: (scalar) value of the Bayes factor in favor of the model associated withx1over the model associated withx2. -
log: Boolean which indicates whetherbfcorresponds to the log Bayes factor.
For the method for "bridge" objects returns a list of class "bf_bridge" with components:
-
bf: (scalar) value of the Bayes factor in favor of the model associated withx1over the model associated withx2. -
log: Boolean which indicates whetherbfcorresponds to the log Bayes factor.
For the method for "bridge_list" objects returns a list of class "bf_bridge_list" with components:
-
bf: a numeric vector consisting of Bayes factors where each element gives the Bayes factor for one set of logmls in favor of the model associated withx1over the model associated withx2. The length of this vector is given by the"bridge_list"element with the mostrepetitions. Elements with fewer repetitions will be recycled (with warning). -
bf_median_based: (scalar) value of the Bayes factor in favor of the model associated withx1over the model associated withx2that is based on the median values of the logml estimates. -
log: Boolean which indicates whetherbfcorresponds to the log Bayes factor.
Note
For examples, see bridge_sampler and the accompanying vignettes:
vignette("bridgesampling_example_jags")
vignette("bridgesampling_example_stan")
Author(s)
Quentin F. Gronau
References
Kass, R. E., & Raftery, A. E. (1995). Bayes factors. Journal of the American Statistical Association, 90(430), 773-795. doi: 10.1080/01621459.1995.10476572