Creates model summary based on a model objects or provides estimates table for a runjags fit.

model_summary_table(
  model,
  model_description = NULL,
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  remove_spike_0 = TRUE,
  short_name = FALSE,
  formula_prefix = TRUE,
  remove_parameters = NULL
)

runjags_estimates_table(
  fit,
  transformations = NULL,
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  conditional = FALSE,
  probs = c(0.025, 0.5, 0.975),
  remove_spike_0 = TRUE,
  transform_factors = FALSE,
  formula_prefix = TRUE,
  remove_inclusion = FALSE,
  remove_parameters = NULL,
  remove_formulas = NULL,
  keep_parameters = NULL,
  keep_formulas = NULL,
  return_samples = FALSE,
  transform_scaled = FALSE,
  remove_diagnostics = FALSE,
  diagnostic_columns = getOption("BayesTools.JAGS_estimates_diagnostic_columns", if
    (remove_diagnostics) "none" else "all"),
  random_effects_summary = c("standard", "full", "raw", "none"),
  simplify_names = FALSE,
  random_effects_metadata = FALSE,
  remove_random_effects = NULL,
  keep_random_effects = NULL,
  remove_random_structures = NULL,
  keep_random_structures = NULL
)

runjags_inference_table(
  fit,
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  formula_prefix = TRUE,
  logBF = FALSE,
  BF01 = FALSE,
  BF_diagnostics = FALSE,
  BF_diagnostic_columns = getOption("BayesTools.JAGS_BF_diagnostic_columns", if
    (BF_diagnostics) "all" else "none")
)

JAGS_estimates_table(
  fit,
  transformations = NULL,
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  conditional = FALSE,
  probs = c(0.025, 0.5, 0.975),
  remove_spike_0 = TRUE,
  transform_factors = FALSE,
  formula_prefix = TRUE,
  remove_inclusion = FALSE,
  remove_parameters = NULL,
  remove_formulas = NULL,
  keep_parameters = NULL,
  keep_formulas = NULL,
  return_samples = FALSE,
  transform_scaled = FALSE,
  remove_diagnostics = FALSE,
  diagnostic_columns = getOption("BayesTools.JAGS_estimates_diagnostic_columns", if
    (remove_diagnostics) "none" else "all"),
  random_effects_summary = c("standard", "full", "raw", "none"),
  simplify_names = FALSE,
  random_effects_metadata = FALSE,
  remove_random_effects = NULL,
  keep_random_effects = NULL,
  remove_random_structures = NULL,
  keep_random_structures = NULL
)

JAGS_inference_table(
  fit,
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  formula_prefix = TRUE,
  logBF = FALSE,
  BF01 = FALSE,
  BF_diagnostics = FALSE,
  BF_diagnostic_columns = getOption("BayesTools.JAGS_BF_diagnostic_columns", if
    (BF_diagnostics) "all" else "none")
)

JAGS_summary_table(
  model,
  model_description = NULL,
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  remove_spike_0 = TRUE,
  short_name = FALSE,
  formula_prefix = TRUE,
  remove_parameters = NULL
)

model_summary_empty_table(
  model_description = NULL,
  title = NULL,
  footnotes = NULL,
  warnings = NULL
)

runjags_estimates_empty_table(
  probs = c(0.025, 0.5, 0.975),
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  remove_diagnostics = FALSE,
  diagnostic_columns = getOption("BayesTools.JAGS_estimates_diagnostic_columns", if
    (remove_diagnostics) "none" else "all")
)

runjags_inference_empty_table(
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  logBF = FALSE,
  BF01 = FALSE,
  BF_diagnostics = FALSE,
  BF_diagnostic_columns = getOption("BayesTools.JAGS_BF_diagnostic_columns", if
    (BF_diagnostics) "all" else "none")
)

JAGS_estimates_empty_table(
  probs = c(0.025, 0.5, 0.975),
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  remove_diagnostics = FALSE,
  diagnostic_columns = getOption("BayesTools.JAGS_estimates_diagnostic_columns", if
    (remove_diagnostics) "none" else "all")
)

JAGS_inference_empty_table(
  title = NULL,
  footnotes = NULL,
  warnings = NULL,
  logBF = FALSE,
  BF01 = FALSE,
  BF_diagnostics = FALSE,
  BF_diagnostic_columns = getOption("BayesTools.JAGS_BF_diagnostic_columns", if
    (BF_diagnostics) "all" else "none")
)

stan_estimates_table(
  fit,
  transformations = NULL,
  title = NULL,
  footnotes = NULL,
  warnings = NULL
)

Arguments

model

model object containing a list of priors and inference object, The inference must be a named list with information about the model: model number m_number, marginal likelihood marglik, prior and posterior probability prior_prob and post_prob, and model inclusion Bayes factor inclusion_BF

model_description

named list with additional description to be added to the table

title

title to be added to the table

footnotes

footnotes to be added to the table

warnings

warnings to be added to the table

remove_spike_0

whether prior distributions equal to spike at 0 should be removed from the prior_list. In JAGS estimates tables with transform_scaled = TRUE, a coefficient with a spike at 0 is kept when it is non-zero on the original scale.

short_name

whether the prior distribution names should be shortened. Defaults to FALSE.

formula_prefix

whether the parameter prefix from formula should be printed. Defaults to TRUE.

remove_parameters

parameters to be removed from the summary. Can be NULL (default, no removal), a character vector of parameter names to remove, or TRUE to remove all parameters that are not part of any formula. For formula random effects, character filters also accept semantic selectors "random", "random_sd", "random_cor", "random_var_prop", "random_var_mult", "random_allocation", and "random_sd_mult".

fit

runjags model fit or a derived-draw view from JAGS_with_draws(). Estimates and inference describe its supplied draws; chain diagnostics use the actual retained chain geometry.

transformations

named list of transformations to be applied to specific parameters

conditional

summarizes estimates conditional on being included in the model for spike and slab priors. Defaults to FALSE. The standard and full random-effect summaries condition the SD, variance and multiplier rows of a random SD with a spike-and-slab or null/alternative mixture prior on that prior's own inclusion event, as the raw summary does. A mixture with other components has no single inclusion event: its rows are summarized over all draws and a footnote says so.

probs

quantiles for parameter estimates

transform_factors

whether factors with orthonormal/meandif prior distribution should be transformed to differences from the grand mean, and factors with prior_ordered() prior distribution to their level effects (without the reference level of a "cumulative" contrast, which is fixed at zero). Untransformed ordered factors show the sampled parameters: runjags_estimates_table() reports the total effect (<term>{total}) and the allocation shares of the random allocations (<term>[share: <level>], the share of the total added when reaching <level>; fixed allocations have no rows). ensemble_estimates_table() reports retained fitted totals and the union of allocation shares sampled by any declared ordered model. Fixed ordered allocations fill that union with their declared constants. Models without the ordered parameterization have undefined (NA) shares, with their defined fraction reported in a footnote. Shares remain defined on zero-total and excluded spike draws of an ordered model. Legacy mixed objects without retained sources must be recreated from source fits.

remove_inclusion

whether estimates of the inclusion probabilities should be excluded from the summary table. Defaults to FALSE. The indicator rows of spike-and-slab and mixture priors, of spike-and-slab totals of ordered-factor priors (labelled <term>{total} (inclusion)), and the raw variance-allocation gates are removed. The backend _variable and _inclusion rows of an ordered prior with a spike-and-slab total are not recognized as inclusion rows and remain in the table. Retained inclusion rows (spike-and-slab and mixture indicators, random-effect and variance-allocation inclusion gates) report the posterior inclusion probability as Mean together with the MCMC diagnostics; their SD and quantile cells are empty.

remove_formulas

character vector of formula names whose parameters should be removed from the summary. Defaults to NULL.

keep_parameters

character vector of parameter names to keep. All other parameters will be removed unless they belong to formulas specified in keep_formulas. The random-effect aliases listed for remove_parameters can also be used here, for example keep_parameters = c("random_sd", "random_cor").

keep_formulas

character vector of formula names whose parameters should be kept. All other parameters will be removed unless they are specified in keep_parameters. Defaults to NULL.

return_samples

whether to return the transoformed and formated samples instead of the table. Defaults to FALSE.

transform_scaled

whether coefficients from standardized continuous predictors should be transformed back to the original scale. For runjags_estimates_table(), FALSE keeps fixed and random effects on the fitted predictor scale, while TRUE transforms both to the original predictor scale when the fit contains formula_scale metadata: random-effect SDs and correlations are computed from the transformed covariance draws. Subtraction-centering can leave a numerically nonzero predictor mean; its induced effects are retained. Composite original-scale SDs have available draws but may have unavailable prior laws. Fitted-scale coefficients and semantic random-effect summaries remain available without this transformation. A block whose missing-term fallback mixes categorical coding or omits a representable contribution has no available original-scale output, with reason "original_scale_not_representable". Use fitted-scale output or include the needed lower-order terms in the block. Mixed posterior samples are transformed through the fitted design of formula_scale: every column is mapped to its fitted coefficient by its quantities draw metadata (see posterior_metadata()), and columns that are not fitted coefficients are refused (a posterior_transform() result, nonlinear or affine with an offset, stops with reason "transformed_column_not_fitted": unscale first, then transform), as are random-effect SDs that the random-effect structure of formula_scale does not cover (SDs it does not contain, blocks it contains only in part, or blocks it leaves unchanged while the samples' original-scale SDs differ from the fitted ones). The SDs of a block are transformed through the fitted block design that the formula state of the samples carries (as_mixed_posteriors(), and mix_posteriors() when fixed formula coefficients or random-effect SDs are among its parameters); samples without it can pair coefficient names only, and the SDs of a block that this does not map exactly (e.g., a factor in an interaction with a standardized slope whose margin is not in the block, or the indicator columns of a logical predictor in such an interaction) are refused. The SD columns of a block with a standardized random slope are labelled by their fitted coordinates ((mu) g: sd(x)) until they are transformed to the catalog's original-scale SDs. For a standardized slope that interacts with a factor whose level effects are not columns of the block (diag(1 + f:x | g): the level intercepts; diag(1 + z + f:x:z | g): the level slopes of z), the shifts that centering induces by level are not block coefficients. The surviving-coordinate transformation retains the shifted coefficients (here the intercept, or the slope of z) at the predictor mean; the SDs of the columns that no centering shifts are exact. runjags_estimates_table() instead reports the unavailable original-scale quantities of the shifted columns as NA with a row-specific note, and retains the identifiable summaries. Estimated marginal means of marginal_estimates_table() are predictions at the stated predictor values, which do not depend on the standardization, and are not changed. Defaults to FALSE.

remove_diagnostics

whether to exclude MCMC diagnostics (MCMC error, ESS, R-hat) from the output table. Defaults to FALSE. Setting to TRUE will exclude diagnostics columns regardless of the conditional setting.

diagnostic_columns

MCMC diagnostic columns to display in JAGS estimates tables. Can be "all", "none", TRUE, FALSE, or a character vector containing any subset of "MCMC_error", "MCMC_SD_error", "ESS", and "R_hat". Defaults to the BayesTools.JAGS_estimates_diagnostic_columns option, or all diagnostics unless remove_diagnostics = TRUE.

random_effects_summary

random-effect reporting mode for JAGS estimates tables. "standard" replaces raw implementation parameters with the semantic quantities corresponding to the fitted prior parameterization: directly specified block scales, correlations, inclusion probabilities, allocation aggregate SDs, and variance proportions or multipliers. Inclusion indicators do not add allocation-derived component SDs to this standard set. "full" additionally includes deterministic representations such as aggregate variances, allocation-derived component SDs, and alternate SD or variance multipliers. "raw" keeps the historical monitored implementation parameters, and "none" removes random-effect parameters from the table. The "standard" and "full" modes always obtain public semantic quantities from the fitted parameter map, and omit the internal (unnormalized gamma) allocation nodes of ordered-factor priors. In every reporting mode, transform_scaled = FALSE keeps both fixed coefficients and random-effect SDs, variances, and correlations on the fitted predictor scale; transform_scaled = TRUE transforms them to the original predictor scale. Centering changes the definition of a random intercept and can therefore change its SD and its correlations with random slopes. Allocation totals and weights retain their declared parameterization. A scaled random-effect block whose design is linearly dependent has no identified original-scale quantities: transform_scaled = TRUE reports their rows as NA with a note explaining the unavailable transformation. A block whose missing-term fallback mixes categorical coding or omits a representable contribution likewise has NA original-scale rows. An SD shared by several columns, as by the indicator columns of a logical predictor's interaction with a scaled slope or the columns of a meandif or orthonormal factor term, needs its columns to be certified as having one original-scale SD: in a correlated block every column must be its own fitted column rescaled by one common factor, and in a diagonal block the columns need equal variance weights. Such an SD is NA with its variance, while the other rows of the block keep their original-scale values. If centering a factor-by-slope interaction induces level-specific effects absent from the block (the intercepts of f:x, the z slopes of f:x:z without f:z), only the SDs, variances and correlations of the columns that would absorb them (the intercept, or the lower-order slope) are unavailable; the summaries of the other columns remain. These table notes also accompany return_samples = TRUE as a footnotes attribute. Inference accessors retain their own transformation and availability contracts. Use transform_scaled = FALSE for fitted-scale summaries in either "standard" or "full" mode, or include the needed lower-order terms for an uncertified fallback. The "raw" rows of random-effect and allocation implementation coordinates (block SDs, Cholesky factors and correlation matrices, LKJ primitives, standardized group effects, and allocation nodes) are backend coordinates shown for inspection: their labels describe the coordinate, but they are not catalog quantities and do not select one in parameter_catalog_resolve(), hypotheses, or plots (the shares of the ordered-factor allocations, which the table shows as <term>[share: <level>], are catalog quantities). Internal latent and realized group-coefficient coordinates are omitted when transform_scaled = TRUE, including in "raw" mode, because those coordinates remain on the fitted standardized scale.

simplify_names

whether semantic random-effect row names should use simplified display labels. A sole random intercept is shown as sd, while canonical names such as sd(intercept) remain stored in the parameter map. Defaults to FALSE.

random_effects_metadata

whether to add random-effect metadata columns to JAGS estimates tables. When TRUE, the table includes the user-facing random-effect name, grouping label, and covariance structure type for random-effect rows. The rows owned by a variance allocation (its totals, proportions, and inclusion indicators) belong to no single block and leave these columns empty. Defaults to FALSE.

remove_random_effects, keep_random_effects

character vectors of random-effect names/blocks used to remove or keep random-effect rows. These match explicit name = values, generated block names, and grouping labels of blocks; they address blocks only, so they never match the rows owned by a variance allocation (keep_random_effects removes those rows, remove_random_effects keeps them). Non-random parameters are left unaffected; combine with keep_parameters = "random" to return only the selected random-effect rows.

remove_random_structures, keep_random_structures

character vectors of random-effect covariance structures (for example "diag", "us", "ar1", or "hcs") used to remove or keep random-effect rows. Non-random parameters are left unaffected.

logBF

whether the Bayes factor should be on log scale. When model inference objects store log-space inclusion Bayes factors, log-scale values are taken from them, so they remain finite beyond the range of natural-scale Bayes factors.

BF01

whether the Bayes factor should be inverted

BF_diagnostics

whether to add MCMC diagnostics for Bayes factors computed from model indicator frequencies. The Bayes factor error is reported as a relative Monte Carlo standard error percentage. Defaults to FALSE.

BF_diagnostic_columns

MCMC diagnostic columns to display in JAGS inclusion Bayes factor tables. Can be "all", "none", TRUE, FALSE, or a character vector containing any subset of "ESS", "MCMC_error", and "BF_error_percent". Defaults to the BayesTools.JAGS_BF_diagnostic_columns option, or all diagnostics when BF_diagnostics = TRUE and none otherwise.

Value

model_summary_table returns a table with overview of the fitted model, runjags_estimates_table returns a table with MCMC estimates, and runjags_estimates_empty_table returns an empty estimates table. All of the tables are objects of class 'BayesTools_table'. The estimates table carries the per-row quantity table attr(table, "quantities"): a data frame with one row per table row and the columns row (the row label), quantity_id (the parameter_catalog() quantity id of the quantity the row's label names, its canonical name or an exact alias such as a transformed factor level <parameter>[dif: level]; "" for rows that are not catalog quantities, such as inclusion rows, mixture components, backend coordinates, fitted random-effect summaries whose catalog quantity is on the original scale, ordered-factor allocation shares, and rows whose values transformations changed, whose label parts record the transformation as "custom"), and label_parts (the label parts the row label is rendered from; parameter_labels() renders them, also with another formula parameter or random-effect quantity names). With transform_scaled = TRUE, the rows of standardized coefficients (including the exponentiated log intercept, an alias of the intercept) show their catalog quantity on the original predictor scale. Subsetting the table subsets its quantity table.

Details

For product-space JAGS inclusion Bayes factors, posterior inclusion probabilities of exactly 0 or 1 cannot produce a finite point estimate of the model odds ratio. In that case, inclusion BFs marked with "<" or ">" are finite-sample bounds: posterior inclusion probabilities of 0 or 1 were replaced by 1/S or (S - 1)/S, where S is the number of posterior samples. This is a reporting convention, not an unbiased finite Bayes-factor estimate. If the prior inclusion probability is exactly 0 or 1, the inclusion Bayes factor is undefined and reported as NA, because the corresponding inclusion/exclusion comparison was not tested.

The inference table has a row for every spike-and-slab and mixture prior, for the spike-and-slab total of an ordered-factor prior (reported under the term label), and for every random-effect inclusion gate.

An original-scale random-effect correlation is defined in a posterior draw whenever both of its SDs are positive, including draws with a singular covariance (for example, a zero scaled intercept SD with a nonzero scaled slope SD gives an intercept-slope correlation of \(\pm 1\)). It is missing in draws with a zero SD (for example, an excluded spike-and-slab SD of a scaled slope). The affected rows are summarized over the defined draws, and a table footnote reports the share of defined draws for each affected row. Raw Cholesky and LKJ-primitive coordinates (random_effects_summary = "raw") exist only for positive-definite correlation matrices and are also missing in singular draws.