Learn R Programming

BayesFactor (version 0.9.1)

model.matrix,BFBayesFactor-method: Design matrices for Bayes factor linear models analyses.

Description

This function returns the design matrix used for computation of the Bayes factor for the numerator of a BFBayesFactor object. There must not be more than one numerator in the BFBayesFactor object.

Usage

## S3 method for class 'BFBayesFactor':
model.matrix(object, ...)

## S3 method for class 'BFBayesFactorTop': model.matrix(object, ...)

Arguments

object
a BayesFactor object with a single numerator
...
arguments passed to and from related methods

Value

  • Returns the design matrix for the corresponding model. The 'gMap' attribute of the returned matrix contains the mapping from columns of the design matrix to g parameters

References

Rouder, J. N., Morey, R. D., Speckman, P. L., Province, J. M., (2012) Default Bayes Factors for ANOVA Designs. Journal of Mathematical Psychology. 56. p. 356-374.

Examples

Run this code
## Gets the design matrix for a simple analysis
data(sleep)

bf = anovaBF(extra ~ group + ID, data = sleep, whichRandom="ID", progress=FALSE)
X = model.matrix(bf)

## Show dimensions of X (should be 20 by 12)
dim(X)

Run the code above in your browser using DataLab