This function is not meant to be called by end-users, although
technically-minded users can call this function for flexibility beyond what
the other functions in this package provide. See lmBF
for a
user-friendly front-end to this function. Details about the priors can be
found in the help for anovaBF
and the references therein.
Argument gMap
provides a way of grouping columns of
the design matrix as a factor; the effects in each group will share a common
\(g\) parameter. gMap
should be a vector of the same length as the number of
nonconstant rows in X
. It will contain all integers from 0 to
\(N_g-1\), where \(N_g\) is the total number of \(g\)
parameters. Each element of gMap
specifies the group to which that
column belongs.
If all columns belonging to a group are adjacent, struc
can instead
be used to compactly represent the groupings. struc
is a vector of
length \(N_g\). Each element specifies the number columns in the
group.
The vector rscale
should be of length \(N_g\), and contain the
prior scales of the standardized effects. See Rouder et al. (2012) for more
details and the help for anovaBF
for some typical values.
The method used to estimate the Bayes factor depends on the method
argument. "simple" is most accurate for small to moderate sample sizes, and
uses the Monte Carlo sampling method described in Rouder et al. (2012).
"importance" uses an importance sampling algorithm with an importance
distribution that is multivariate normal on log(g). "laplace" does not
sample, but uses a Laplace approximation to the integral. It is expected to
be more accurate for large sample sizes, where MC sampling is slow. If
method="auto"
, then an initial run with both samplers is done, and
the sampling method that yields the least-variable samples is chosen. The
number of initial test iterations is determined by
options(BFpretestIterations)
.
If posterior samples are requested, the posterior is sampled with a Gibbs
sampler.