Description Arguments Value Examples
This method is used primarily in the backend, and will only rarely be called by the end user. But see the examples below for a demonstration.
numerator |
first model |
denominator |
second model |
data |
data for the comparison |
... |
arguments passed to and from related methods |
The compare function will return a model comparison object, typically a Bayes factor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Sample from the posteriors for two models
data(puzzles)
## Main effects model; result is a BFmcmc object, inheriting
## mcmc from the coda package
mod1 = lmBF(RT ~ shape + color + ID, data = puzzles, whichRandom = "ID",
progress = FALSE, posterior = TRUE, iterations = 1000)
plot(mod1)
## Full model
mod2 = lmBF(RT ~ shape*color + ID, data = puzzles, whichRandom = "ID",
progress = FALSE, posterior = TRUE, iterations = 1000)
## Each BFmcmc object contains the model used to generate it, so we
## can compare them (data is not needed, it is contained in the objects):
compare(mod1, mod2)
|
Loading required package: coda
Loading required package: Matrix
************
Welcome to BayesFactor 0.9.12-2. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
Type BFManual() to open the manual.
************
Bayes factor analysis
--------------
[1] shape + color + ID : 2.87461 <U+00B1>4.8%
Against denominator:
RT ~ shape * color + ID
---
Bayes factor type: BFlinearModel, JZS
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.