hypothesis_parse() parses the restricted language used by hypothesis_BF() into a validated, serializable syntax tree. An explicit vs comparison requires two nonempty statements. hypothesis_render() renders that tree with token-safe quoting. hypothesis_symbols() returns exact parameter roots or an occurrence table. Quoted reserved names and ordinary identifiers retain their exact identity; numeric labels preserve the parsed values when rendered and parsed again.

hypothesis_rewrite() replaces only exact symbol roots. Function names, literals, level labels, and longer identifiers are never edited. hypothesis_resolve() resolves every occurrence through parameter_catalog_resolve() without accessing posterior draws. A bracketed symbol such as mu_f[b] or (mu) f[b] is first resolved as an exact catalog name or alias; otherwise its bracketed level is used as the catalog component of the parameter before the bracket. The bracket always holds a level label: mu_f[2] selects the level labelled "2", never the second fitted coordinate. A symbol that does not resolve uniquely stops with the classed errors of parameter_catalog_resolve(), a hypothesis without parameter symbols (e.g. "1 > 0") stops with an error of class BayesTools_hypothesis_no_parameters, and a level-qualified symbol whose level differs from component stops with an error of class BayesTools_hypothesis_component_mismatch (fields symbol and component); both are also BayesTools_parameter_resolution_error.

hypothesis_parse(
  hypothesis,
  catalog = NULL,
  namespace = NULL,
  component = NULL,
  simplify_names = FALSE
)

hypothesis_ast_schema()

hypothesis_render(ast)

hypothesis_symbols(ast, occurrences = FALSE)

hypothesis_rewrite(ast, mapping)

hypothesis_resolve(
  ast,
  catalog,
  namespace = NULL,
  component = NULL,
  simplify_names = FALSE
)

Arguments

hypothesis

character vector of hypothesis statements.

catalog

optional BayesTools_parameter_catalog. When supplied to hypothesis_parse(), exact non-syntactic public aliases are recognized without requiring the caller to add backticks, and a contrast-coefficient selector term{j} whose coordinate is a level stops with the error of class BayesTools_selector_unavailable (also BayesTools_hypothesis_target) that names the level form, as in parameter_catalog_resolve(), instead of failing to parse.

namespace

optional exact catalog namespace filter.

component

optional exact catalog component filter for unqualified symbols. A level-qualified symbol such as term[level] supplies its own per-occurrence component and must agree with this value when both are used.

simplify_names

whether to recognize centrally generated simplified random-effect aliases. Defaults to FALSE.

ast

a BayesTools_hypothesis_ast object.

occurrences

whether to return one row per symbol occurrence.

mapping

named character vector from exact old roots to new roots.

Value

hypothesis_parse() and hypothesis_rewrite() return a BayesTools_hypothesis_ast. hypothesis_render() returns character text. hypothesis_symbols() returns unique roots or an occurrence data frame. hypothesis_resolve() returns a versioned BayesTools_hypothesis_resolution containing one row per occurrence.