Models, priors, and methods of computation are provided
in Rouder et al. (2012). The ANOVA model for a vector of observations $y$ is
$$y = \mu + X_1 \theta_1 + \ldots + X_p\theta_p
+\epsilon,$$ where $\theta_1,\ldots,\theta_p$ are
vectors of main-effect and interaction effects,
$X_1,\ldots,X_p$ are corresponding design matrices,
and $\epsilon$ is a vector of zero-centered noise
terms with variance $\sigma^2$. Zellner and Siow
(1980) inspired g-priors are placed on effects, but with
a separate g-prior parameter for each covariate:
$$\theta_1~N(0,g_1\sigma^2), \ldots, \theta_p~N(0,g_p
\sigma^2).$$ A Jeffries prior is placed on $\mu$ and
$\sigma^2$. Independent scaled inverse-chi-square
priors with one degree of freedom are placed on
$g_1,\ldots,g_p$. The square-root of the scale for
g's corresponding to fixed and random effects is given by
rscaleFixed
and rscaleRandom
, respectively.
When a factor is treated as random, there are as many
main effect terms in the vector $\theta$ as levels.
When a factor is treated as fixed, the sums-to-zero
linear constraint is enforced by centering the
corresponding design matrix, and there is one fewer main
effect terms as levels. The Cornfield-Tukey model of
interactions is assumed. Details are provided in Rouder
et al. (2012)
Bayes factors are computed by integrating the likelihood
with respect to the priors on parameters. The
integration of all parameters except $g_1,\ldots,g_p$
may be expressed in closed-form; the integration of
$g_1,\ldots,g_p$ is performed through Monte Carlo
sampling, and iterations
is the number of
iterations used to estimate the Bayes factor.
anovaBF
computes Bayes factors for either all
submodels or select submodels missing a single main
effect or covariate, depending on the argument
whichModels
. If no random factors are specified,
the null model assumed by anovaBF
is the
grand-mean only model. If random factors are specified,
the null model is the model with an additive model on all
random factors, plus a grand mean. Thus, anovaBF
does not currently test random factors. Testing random
factors is possible with lmBF
.
The argument whichModels
controls which models are
tested. Possible values are 'all', 'withmain', 'top', and
'bottom'. Setting whichModels
to 'all' will test
all models that can be created by including or not
including a main effect or interaction. 'top' will test
all models that can be created by removing or leaving in
a main effect or interaction term from the full model.
'bottom' creates models by adding single factors or
interactions to the null model. 'withmain' will test all
models, with the constraint that if an interaction is
included, the corresponding main effects are also
included.
For the rscaleFixed
argument, several named values
are recongized: "medium" corresponds to
$r=1/2$; "wide" corresponds to
$r=\sqrt{2}/2$.