bma: Calculation of the bma object

View source: R/bma.R

bmaR Documentation

Calculation of the bma object

Description

This function calculates BMA statistics based on the provided model space. Other objects for further analysis are also returned.

Usage

bma(
  model_space,
  round = 4,
  EMS = NULL,
  dilution = 0,
  omega = 0.5,
  weighting = c("mb2016", "mb2012", "nt", "uip"),
  eta = NULL
)

Arguments

model_space

An object of class badp_model_space, typically returned by optim_model_space.

round

Integer indicating the decimal place to which numbers in the BMA tables and prior and posterior model sizes should be rounded (default: 4).

EMS

Numeric. Expected model size for binomial and binomial-beta model prior (default: R/2, where R is the number of regressors).

dilution

Integer. Use 0 for no dilution prior (default), or 1 to apply a dilution prior (George 2010).

omega

Numeric. The exponent of the determinant for the dilution prior (George 2010). Only used when dilution = 1. Default: 0.5.

weighting

Character string selecting the approximation to the marginal likelihood used to weight the models. One of:
"mb2016" (default) - the approximation computed by the implementation accompanying Moral-Benito (2016), namely \exp\{(\ell_j - (k_j/2)\log(NT))/N\}, where \ell_j is the maximised log-likelihood of model j, k_j its number of linear parameters, N the number of entities and T the number of periods. This is the Schwarz approximation raised to the power 1/N and is the option that reproduces the results published in Moral-Benito (2016);
"mb2012" - the Schwarz criterion as stated in equations (24)-(30) of Moral-Benito (2012), \exp\{\ell_j - (k_j/2)\log(NT)\}, treating the NT entity-period observations as the sample;
"nt" - as "mb2016" but averaging over entity-periods rather than entities, \exp\{(\ell_j - (k_j/2)\log(NT))/(NT)\}. This is the scaling that would be internally consistent with the \log(NT) penalty, and it tempers T times more strongly than "mb2016";
"uip" - the Schwarz criterion with the entity as the unit of information, \exp\{\ell_j - (k_j/2)\log(N)\}. The unit information prior underlying the approximation (Kass and Wasserman 1995) is defined through the Fisher information for a single observation, and the likelihood factorises over entities, so the entity is the natural unit.

eta

Optional single positive number giving the learning rate directly, as in f(y|M_j) \propto \exp(\eta A_j) with A_j = \ell_j - (k_j/2)\log(NT). Supplying it overrides weighting, which is the intended way to examine how sensitive conclusions are to the rate. eta = 1 reproduces "mb2012" and eta = 1/N reproduces "mb2016". Default NULL, meaning the rate implied by weighting.

Details

Writing A_j = \ell_j - (k_j/2)\log(NT), three of the four options are the same construction with different learning rates \eta: \log w_j = \eta A_j, with \eta = 1 for "mb2012", 1/N for "mb2016" and 1/(NT) for "nt". Only "uip" alters the penalty instead of the rate. The eta argument supplies any other rate.

Any \eta \neq 1 produces a tempered (power) posterior over models, proportional to f(y|M_j)^\eta, which lies outside the approximation that motivates the criterion. What follows from that depends on how the rate is set. A rate held fixed as the sample grows rescales every log weight by the same factor, so differences between models still diverge with N and the posterior continues to concentrate, more slowly when \eta < 1 and faster when \eta > 1.

A rate that shrinks with the sample behaves differently. Under \eta = 1/N, a model at Kullback-Leibler distance c_j per entity has \eta A_j = A_j/N \to -c_j, so the weights converge to the fixed positive constants \exp(-c_j) and the posterior never concentrates, however large N becomes. The complexity penalty (k_j/2)\log(NT)/N vanishes in the same limit, so overfitted models are not eventually rejected. Conversely \eta = 1 concentrates the posterior sharply, which on likelihoods of this kind can place essentially all mass on a single model.

No option estimates \eta from the data. The magnitude ("omnibus") adjustment for misspecified and composite likelihoods (Chandler and Bate 2007; Ribatet, Cooley and Davison 2012) would set \eta = \mathrm{rank}(J)/\mathrm{tr}(H^{-1}J), matching the mean of the adjusted log-likelihood ratio to its limiting distribution. It is not offered here because J is substantially rank deficient for this likelihood: parameters entering it only through terms common to every entity contribute nothing, and in the model spaces bundled with the package the entity-level scores span between 8\ directions (see score_rank). The adjustment would then be calibrated on a small part of the parameter space, with no way to assess what the remainder contributes. The ingredients are nonetheless stored with every fitted model space, so the rate can be computed and inspected directly if wanted.

The default is retained for compatibility with the published literature; users are encouraged to check the sensitivity of their conclusions to this choice, which is what eta is for. Switching between the options requires no re-estimation, since all are recovered from the same fitted model space.

Value

An object of class badp_bma, which is a list containing:

uniform_table

A table containing the results based on the binomial model prior.

random_table

A table containing the results based on the binomial-beta model prior.

reg_names

A vector containing the names of the regressors, used by the functions.

R

The total number of regressors.

num_of_models

The number of models present in the model space.

jointness_data

A table containing model IDs and posterior model probabilities (PMPs) for the jointness function.

best_models_data

A table containing model IDs, PMPs, coefficients, standard deviations, and standardized regression coefficients (stdRs) for the best_models function.

EMS

The expected model size for the binomial and binomial-beta model priors, as specified by the user (default is EMS = R/2).

size_priors

A table of uniform and random model priors distributed over model sizes for the model_sizes function.

PMPs

A table containing the posterior model probabilities for use in the model_sizes function.

model_priors

A table containing the model priors, used by the model_pmp function.

dilution

A parameter indicating whether the priors were diluted, used in the model_sizes function.

alphas

A matrix of coefficients for the lagged dependent variable across all models, used in the coef_hist function.

betas_nonzero

A matrix of nonzero coefficients for the regressors, used in the coef_hist function.

df_free

A table containing the degrees of freedom for the estimated models in the best_models function.

PMS_table

A table containing the prior and posterior expected model sizes for the binomial and binomial-beta model priors.

omega

The dilution parameter used (the exponent of the determinant). Relevant only when dilution = 1.

Identification of the robust standard deviations

The columns PSDR and PSDRcon are derived from the sandwich covariance H^{-1} J H^{-1}, where J = \sum_{i=1}^{N} s_i s_i' is the outer product of the entity-level score vectors. The per-entity scores share a component that is identical across entities, and at the maximum they sum to zero, so J is unchanged by centring them: only the variation of the scores across entities contributes. Parameters entering the log-likelihood solely through terms common to every entity have no such variation, and J is consequently rank deficient however many entities are observed. See score_rank.

The directions J does span include the lagged dependent variable and the regressors, so the reported PSDR and PSDRcon are well defined: because J vanishes outside that block, the sandwich restricted to it equals the profile sandwich obtained by profiling the remaining parameters out. What the construction does discard is the score covariance involving those remaining directions, which is set to zero rather than estimated.

The deficiency is the normal state of this likelihood rather than a symptom of a poor fit, so it is not warned about; summary() of a model space reports the fraction of parameter directions the scores span. The likelihood, the posterior means (PM, PMcon) and the posterior inclusion probabilities (PIP) do not involve J and are unaffected, as are the Hessian-based standard deviations PSD and PSDcon, which rest on correct specification rather than on J and are the more defensible choice for this likelihood.

Methods

Objects of class badp_bma have the following methods available:

  • print.badp_bma - Display results

  • summary.badp_bma - Detailed statistical summary

  • coef.badp_bma - Extract coefficients

  • plot.badp_bma - Visualize results

Examples


library(magrittr)

data_prepared <- badp::economic_growth[, 1:6] %>%
  badp::feature_standardization(
    excluded_cols = c(country, year, gdp)
  ) %>%
  badp::feature_standardization(
    group_by_col  = year,
    excluded_cols = country,
    scale         = FALSE
  )

bma_results <- bma(
  model_space = badp::small_model_space,
  round       = 3,
  dilution    = 0
)


badp documentation built on Aug. 20, 2026, 9:08 a.m.