Learn R Programming

BayesFactor (version 0.9.8)

BFBayesFactor-class: General S4 class for representing multiple Bayes factor model comparisons, all against the same model

Description

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

Usage

## S3 method for class 'numeric,BFBayesFactor':
/(e1, e2)

## S3 method for class 'BFBayesFactor,BFBayesFactor': /(e1, e2)

## S3 method for class 'BFBayesFactor,index,missing,missing': [(x, i, j, ..., drop)

## S3 method for class 'BFBayesFactor': t(x)

## S3 method for class 'BFBayesFactor': which.max(x)

## S3 method for class 'BFBayesFactor': which.min(x)

## S3 method for class 'BFBayesFactor': is.na(x)

## S3 method for class 'BFBayesFactorTop,index,missing,missing': [(x, i, j, ..., drop)

Arguments

e1
Numerator of the ratio
e2
Denominator of the ratio
j
unused for BFBayesFactor objects
...
further arguments passed to related methods
x
numeric or complex vectors or objects which can be coerced to such, or other objects for which methods have been written.
i
indices specifying elements to extract or replace. Indices are numeric or character vectors or empty (missing) or NULL. Numeric values are coerced to integer as by a
drop
For matrices and arrays. If TRUE the result is coerced to the lowest possible dimension (see the examples). This only works for extracting elements, not for the replacement. See drop for

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:,[object Object],[object Object],[object Object],[object Object],[object Object]

Examples

Run this code
## 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)

Run the code above in your browser using DataLab