hypothesis_BF_model() is the engine behind
hypothesis_BF() of a BayesTools_fit, exported for packages that
test hypotheses on the parameters of their own models. It parses the
statements with the parameter catalog of the model, resolves each to one
tested parameter, plans how it can be evaluated (the draws and the prior
density of the tested quantity, the classification of its point values),
checks every plan against the requested density backend, evaluates the
statements in groups that share a tested quantity, and binds the results
into one table in the order of the statements. What the engine needs to
know about the model comes from its provider (hypothesis_provider()); the
methods to evaluate a point hypothesis are the density backends
(hypothesis_density_backend()).
hypothesis_BF_model(
object,
hypothesis,
namespace = NULL,
component = NULL,
transform_scaled = FALSE,
conditional = FALSE,
logBF = FALSE,
BF01 = FALSE,
seed = NULL,
density_method = NULL,
density_control = NULL,
n_samples = 10000,
columns = "default",
parameter = NULL,
conditional_omitted = FALSE
)a model object with a hypothesis_provider() method.
character vector with hypothesis statements (see
hypothesis_BF()). Names of the parameter catalog of the model need no
backticks. The statements of a model are character strings: a parsed
hypothesis (hypothesis_parse()) stops with an error of class
BayesTools_hypothesis_statement.
the component of the model the statements refer to, in
the vocabulary of its provider (for a BayesTools_fit: "auto",
the formula parameters such as "mu", "model", or
"random"); NULL selects the default.
a catalog component (the level token of a factor term)
passed to hypothesis_resolve(): a reference to a factor term without a
level stands for this level, so that "x_fac = 0.1" with
component = "B" is the statement "x_fac[B] = 0.1". It
combines with namespace, which selects the formula parameter (for
example when the factor is shared by several formulas).
whether coefficients of scaled predictors, and
random-effect SDs, variances, and correlations of such predictors, are
tested on the original scale (TRUE) or on the fitted scale
(FALSE, the default), as in JAGS_estimates_table().
whether to test each quantity conditionally on its
inclusion event: spike-and-slab and mixture coefficients through
as_mixed_posteriors() (conditional parameter, rule "AND"),
random-effect quantities through parameter_mixed_posterior(). Without
it a point null on a quantity with a prior point mass at that value stops
with BayesTools_point_mass_at_null; region hypotheses are tested.
see hypothesis_BF().
the name of a registered density backend
(hypothesis_density_backends()); matching ignores case and accepts an
unambiguous partial name. NULL selects the first backend of the
provider (the stored method of a marginal-means provider).
the settings of the density backend (a named list
that the backend validates), or NULL.
the number of prior samples or grid points for the deterministic marginal prior densities and for the prior draws of random-effect quantities.
for a marginal-means provider, the marginal-means parameter that the statements refer to.
whether the caller omitted conditional;
the engine then warns when the full ensemble of a mixture prior is
tested (full_ensemble() of the provider).
A BayesTools_hypothesis_BF table, as returned by
hypothesis_BF(), with the rows labelled as the statements were written.
When an ordinate backend computed ordinates, the table can carry the
density_diagnostics attribute of the backend.
Every statement is planned before any is evaluated: the plan
records the tested target (its weights on the fitted coefficients, its
prior density and declared atoms), the classification of each point value
by prior_ordinate_status(), and what refuses it. A statement that the
requested density backend cannot evaluate stops with its refusal before
anything is computed. The refusals are classed conditions; callers match
the class and never the message:
BayesTools_hypothesis_statementa statement that has to be
restated, or an argument that has to change: point expressions that are
no direct reference (for example "2 * mu = 0"), nonlinear
expressions of factor levels, one quantity named by several names, and
references that BayesTools refuses (BayesTools_parameter_resolution_error,
for example BayesTools_parameter_not_found for an unknown name or
level, which keeps its fields alias and available).
BayesTools_hypothesis_ambiguous (parent
BayesTools_hypothesis_statement) marks a statement whose
references still name several model parameters, and
BayesTools_hypothesis_component_mismatch a statement whose
parameters belong to another component than the requested one;
BayesTools_hypothesis_parameter_mismatch a marginal-means
statement that refers to another parameter than parameter.
BayesTools_hypothesis_unavailablea test that cannot be
computed, with the more specific BayesTools_hypothesis_fixed (the
quantity is fixed by the fitted model), BayesTools_hypothesis_target
(no supported target or prior density), or
BayesTools_hypothesis_method (the density backend is unavailable
for the target). A point hypothesis whose prior ordinate is not exact,
finite, and regular stops with the class of prior_ordinate_status()
(for example BayesTools_point_mass_at_null) and
BayesTools_hypothesis_ordinate.
A density backend owns its own conditions (a failed ordinate, a model it does not support).
Random numbers: the draws of every statement are extracted while it is
planned, without seed; seed only reaches the evaluation of
the Bayes factors of the draws (hypothesis_BF()) and the prior draws of
random-effect quantities that have no prior density.
There are no references for Rd macro \insertAllCites on this help page.