| bma | R Documentation |
This function calculates BMA statistics based on the provided model space. Other objects for further analysis are also returned.
bma(
model_space,
round = 4,
EMS = NULL,
dilution = 0,
omega = 0.5,
weighting = c("mb2016", "mb2012", "nt", "uip"),
eta = NULL
)
model_space |
An object of class |
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 |
weighting |
Character string selecting the approximation to the
marginal likelihood used to weight the models. One of: |
eta |
Optional single positive number giving the learning rate
directly, as in |
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.
An object of class badp_bma, which is a list containing:
A table containing the results based on the binomial model prior.
A table containing the results based on the binomial-beta model prior.
A vector containing the names of the regressors, used by the functions.
The total number of regressors.
The number of models present in the model space.
A table containing model IDs and posterior model probabilities (PMPs) for the jointness function.
A table containing model IDs, PMPs, coefficients, standard deviations, and standardized regression coefficients (stdRs) for the best_models function.
The expected model size for the binomial and binomial-beta model priors, as specified by the user (default is EMS = R/2).
A table of uniform and random model priors distributed over model sizes for the model_sizes function.
A table containing the posterior model probabilities for use in the model_sizes function.
A table containing the model priors, used by the model_pmp function.
A parameter indicating whether the priors were diluted, used in the model_sizes function.
A matrix of coefficients for the lagged dependent variable across all models, used in the coef_hist function.
A matrix of nonzero coefficients for the regressors, used in the coef_hist function.
A table containing the degrees of freedom for the estimated models in the best_models function.
A table containing the prior and posterior expected model sizes for the binomial and binomial-beta model priors.
The dilution parameter used (the exponent of the determinant). Relevant only when dilution = 1.
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.
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
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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.