BFBayesFactor-class: General S4 class for representing multiple Bayes factor model...

Description Usage Arguments Details Examples

Description

The BFBayesFactor class is a general S4 class for representing models model comparison via Bayes factor.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## S4 method for signature 'numeric,BFBayesFactor'
e1 / e2

## S4 method for signature 'BFBayesFactor,BFBayesFactor'
e1 / e2

## S4 method for signature 'BFBayesFactor,index,missing,missing'
x[i, j, ..., drop = TRUE]

## S4 method for signature 'BFBayesFactor'
t(x)

## S4 method for signature 'BFBayesFactor'
which.max(x)

## S4 method for signature 'BFBayesFactor'
which.min(x)

## S4 method for signature 'BFBayesFactor'
is.na(x)

## S4 method for signature 'BFBayesFactor,BFodds'
e1 * e2

## S4 method for signature 'BFBayesFactorTop,index,missing,missing'
x[i, j, ...,
  drop = TRUE]

Arguments

e1

Numerator of the ratio

e2

Denominator of the ratio

x

BFBayesFactor object

i

indices indicating elements to extract

j

unused for BFBayesFactor objects

...

further arguments passed to related methods

drop

unused

Details

BFBayesFactor objects can be inverted by taking the reciprocal and can be divided by one another, provided both objects have the same denominator. In addition, the t (transpose) method can be used to invert Bayes factor objects.

The BFBayesFactor class has the following slots defined:

numerator

a list of models all inheriting BFmodel, each providing a single denominator

denominator

a single BFmodel object serving as the denominator for all model comparisons

bayesFactor

a data frame containing information about the comparison between each numerator and the denominator

data

a data frame containing the data used for the comparison

version

character string giving the version and revision number of the package that the model was created in

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Compute some Bayes factors to demonstrate division and indexing
data(puzzles)
bfs <- anovaBF(RT ~ shape*color + ID, data = puzzles, whichRandom = "ID", progress=FALSE)

## First and second models can be separated; they remain BFBayesFactor objects
b1 = bfs[1]
b2 = bfs[2]
b1

## We can invert them, or divide them to obtain new model comparisons
1/b1
b1 / b2

## Use transpose to create a BFBayesFactorList
t(bfs)

Example output

Loading required package: coda
Loading required package: Matrix
************
Welcome to BayesFactor 0.9.12-4.2. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).

Type BFManual() to open the manual.
************
Bayes factor analysis
--------------
[1] shape + ID : 2.853267 <U+00B1>1.72%

Against denominator:
  RT ~ ID 
---
Bayes factor type: BFlinearModel, JZS

Bayes factor analysis
--------------
[1] ID : 0.3504755 <U+00B1>1.72%

Against denominator:
  RT ~ shape + ID 
---
Bayes factor type: BFlinearModel, JZS

Bayes factor analysis
--------------
[1] shape + ID : 1.012727 <U+00B1>1.99%

Against denominator:
  RT ~ color + ID 
---
Bayes factor type: BFlinearModel, JZS

         denominator
numerator shape + ID color + ID shape + color + ID
       ID  0.3504755  0.3549359         0.08450643
         denominator
numerator shape + color + shape:color + ID
       ID                        0.2342931

BayesFactor documentation built on May 2, 2019, 7 a.m.