Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

recompute-methods

Recompute a Bayes factor computation or MCMC object.


Description

Take an object and redo the computation (useful for sampling). In cases where sampling is used to compute the Bayes factor, the estimate of the precision of new samples will be added to the estimate precision of the old sample will be added to produce a new estimate of the precision.

Usage

recompute(x, progress = getOption("BFprogress", interactive()),
  multicore = FALSE, callback = function(...) as.integer(0), ...)

## S4 method for signature 'BFBayesFactor'
recompute(x, progress = getOption("BFprogress",
  interactive()), multicore = FALSE, callback = function(...) as.integer(0),
  ...)

## S4 method for signature 'BFBayesFactorTop'
recompute(x, progress = getOption("BFprogress",
  interactive()), multicore = FALSE, callback = function(...) as.integer(0),
  ...)

## S4 method for signature 'BFmcmc'
recompute(x, progress = getOption("BFprogress",
  interactive()), multicore = FALSE, callback = function(...) as.integer(0),
  ...)

## S4 method for signature 'BFodds'
recompute(x, progress = getOption("BFprogress",
  interactive()), multicore = FALSE, callback = function(...) as.integer(0),
  ...)

Arguments

x

object to recompute

progress

report progress of the computation?

multicore

Use multicore, if available

callback

callback function for third-party interfaces

...

arguments passed to and from related methods

Value

Returns an object of the same type, after repeating the sampling (perhaps with more iterations)

Examples

## Sample from the posteriors for two models
data(puzzles)

## Main effects model; result is a BFmcmc object, inheriting
## mcmc from the coda package
bf = lmBF(RT ~ shape + color + ID, data = puzzles, whichRandom = "ID",
   progress = FALSE)

## recompute Bayes factor object
recompute(bf, iterations = 1000, progress = FALSE)

## Sample from posterior distribution of model above, and recompute:
chains = posterior(bf, iterations = 1000, progress = FALSE)
newChains = recompute(chains, iterations = 1000, progress=FALSE)

BayesFactor

Computation of Bayes Factors for Common Designs

v0.9.12-4.2
GPL-2
Authors
Richard D. Morey [aut, cre, cph], Jeffrey N. Rouder [aut], Tahira Jamil [ctb, cph], Simon Urbanek [ctb, cph], Karl Forner [ctb, cph], Alexander Ly [ctb, cph]
Initial release
2018-05-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.