Learn R Programming

BayesFactor (version 0.9.12-4.7)

generalTestBF: Function to compute Bayes factors for general designs

Description

This function computes Bayes factors corresponding to restrictions on a full model.

Usage

generalTestBF(
  formula,
  data,
  whichRandom = NULL,
  whichModels = "withmain",
  neverExclude = NULL,
  iterations = 10000,
  progress = getOption("BFprogress", interactive()),
  rscaleFixed = "medium",
  rscaleRandom = "nuisance",
  rscaleCont = "medium",
  rscaleEffects = NULL,
  multicore = FALSE,
  method = "auto",
  noSample = FALSE,
  callback = function(...) as.integer(0)
)

Value

An object of class BFBayesFactor, containing the computed model comparisons

Arguments

formula

a formula containing the full model for the analysis (see Examples)

data

a data frame containing data for all factors in the formula

whichRandom

a character vector specifying which factors are random

whichModels

which set of models to compare; see Details

neverExclude

a character vector containing a regular expression (see help for regex for details) that indicates which terms to always keep in the analysis

iterations

How many Monte Carlo simulations to generate, if relevant

progress

if TRUE, show progress with a text progress bar

rscaleFixed

prior scale for standardized, reduced fixed effects. A number of preset values can be given as strings; see Details.

rscaleRandom

prior scale for standardized random effects

rscaleCont

prior scale for standardized slopes

rscaleEffects

A named vector of prior settings for individual factors, overriding rscaleFixed and rscaleRandom. Values are scales, names are factor names.

multicore

if TRUE use multiple cores through the doMC package. Unavailable on Windows.

method

approximation method, if needed. See nWayAOV for details.

noSample

if TRUE, do not sample, instead returning NA.

callback

callback function for third-party interfaces

Author

Richard D. Morey (richarddmorey@gmail.com)

Details

See the help for anovaBF and anovaBF or details.

Models, priors, and methods of computation are provided in Rouder et al. (2012) and Liang et al (2008).

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.

Liang, F. and Paulo, R. and Molina, G. and Clyde, M. A. and Berger, J. O. (2008). Mixtures of g-priors for Bayesian Variable Selection. Journal of the American Statistical Association, 103, pp. 410-423

See Also

lmBF, for testing specific models, and regressionBF and anovaBF for other functions for testing multiple models simultaneously.

Examples

Run this code
## Puzzles example: see ?puzzles and ?anovaBF
data(puzzles)
## neverExclude argument makes sure that participant factor ID
## is in all models
result = generalTestBF(RT ~ shape*color + ID, data = puzzles, whichRandom = "ID",
neverExclude="ID", progress=FALSE)
result

Run the code above in your browser using DataLab