Learn R Programming

BayesFactor (version 0.9.8)

BFBayesFactorList-class: General S4 class for representing a collection of Bayes factor model comprisons, each against a different denominator

Description

The BFBayesFactorList class is a general S4 class for representing models model comparison via Bayes factor. See the examples for demonstrations of BFBayesFactorList methods.

Usage

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

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

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

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

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

Arguments

x
a BFBayesFactorList object
e1
Numerator of the ratio
e2
Denominator of the ratio
j
indices specifying elements to extract
...
further arguments passed to related methods
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

BFBayesFactorList objects inherit from lists, and contain a single slot:,[object Object],Each element of the list contains a single "BFBayesFactor" object. Each element of the list must have the same numerators, in the same order, as all the others. The list object is displayed as a matrix of Bayes factors.

Examples

Run this code
## Compute some Bayes factors to demonstrate Bayes factor lists
data(puzzles)
bfs <- anovaBF(RT ~ shape*color + ID, data = puzzles, whichRandom = "ID", progress=FALSE)

## Create a matrix of Bayes factors
bfList <- bfs / bfs
bfList

## Use indexing to select parts of the 'matrix'
bfList[1,]
bfList[,1]

## We can use the t (transpose) function as well, to get back a BFBayesFactor
t(bfList[2,])

## Or transpose the whole matrix
t(bfList)

Run the code above in your browser using DataLab