Description Arguments Details Value Examples
This function samples from the posterior distribution of
a BFmodel
, which can be obtained from a
BFBayesFactor
object. If there is more than one
numerator in the BFBayesFactor
object, the
index
argument can be passed to select one
numerator.
model |
or set of models from which to sample |
index |
the index within the set of models giving the desired model |
data |
the data to be conditioned on |
iterations |
the number of iterations to sample |
... |
arguments passed to and from related methods |
The data argument is used internally, and will typically not be needed by end-users.
Note that if there are fixed effects in the model, the
reduced parameterzation used internally (see help for
anovaBF
) is unreduced. For a factor with
two levels, the chain will contain two effect estimates
that sum to 0.
Two useful arguments that can be passed to related
methods are thin
and columnFilter
,
currently implemented for methods using nWayAOV
(models with more than one categorical covariate, or a
mix of categorical and continuous covariates).
thin
, an integer, will keep only every thin
iterations. The default is thin=1
, which keeps all
iterations. Argument columnFilter
is either
NULL
(for no filtering) or a character vector of
extended regular expressions (see regex help for
details). Any column from an effect that matches one of
the filters will not be saved.
Returns an object containing samples from the posterior distribution of the specified model
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Sample from the posteriors for two models
data(sleep)
bf = lmBF(extra ~ group + ID, data = sleep, whichRandom="ID", progress=FALSE)
## sample from the posterior of the numerator model
## data argument not needed - it is included in the Bayes factor object
chains = posterior(bf, iterations = 1000, progress = FALSE)
plot(chains)
## demonstrate column filtering by filtering out participant effects
data(puzzles)
bf = lmBF(RT ~ shape + color + shape:color + ID, data=puzzles)
chains = posterior(bf, iterations = 1000, progress = FALSE, columnFilter="^ID$")
colnames(chains) # Contains no participant effects
|
Loading required package: coda
Loading required package: Matrix
************
Welcome to BayesFactor 0.9.12-4.2. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
Type BFManual() to open the manual.
************
[1] "mu" "shape-round"
[3] "shape-square" "color-color"
[5] "color-monochromatic" "shape:color-round.&.color"
[7] "shape:color-round.&.monochromatic" "shape:color-square.&.color"
[9] "shape:color-square.&.monochromatic" "sig2"
[11] "g_shape" "g_color"
[13] "g_ID" "g_shape:color"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.