bma: Calculation of the bma object

View source: R/bma.R

bmaR Documentation

Calculation of the bma object

Description

This function calculates bma object for the model_space object obtained using optimal_model_space function. It calculates BMA statistics and objects for the use by other functions.

Usage

bma(
  df,
  dep_var_col,
  timestamp_col,
  entity_col,
  model_space,
  run_parallel = FALSE,
  app = 4,
  EMS = NULL,
  dilution = 0,
  dil.Par = 0.5
)

Arguments

df

Data frame with data for the SEM analysis.

dep_var_col

Column with the dependent variable

timestamp_col

The name of the column with timestamps

entity_col

Column with entities (e.g. countries)

model_space

The result of the optimal_model_space function. A matrix (with named rows) with each column corresponding to a model. Each column specifies model parameters. Compare with optimal_model_space

run_parallel

If TRUE the optimization is run in parallel using the parApply function. If FALSE (default value) the base apply function is used. Note that using the parallel computing requires setting the default cluster. See README.

app

Parameter indicating the decimal place to which number in the BMA tables should be rounded (default app = 4)

EMS

Expected model size for model binomial and binomial-beta model prior

dilution

Binary parameter: 0 - NO application of a dilution prior; 1 - application of a dilution prior (George 2010).

dil.Par

Parameter associated with dilution prior - the exponent of the determinant (George 2010). Used only if parameter dilution = 1.

Value

A list with bma objects:

  1. uniform_table - table with the results under binomial model prior

  2. random_table - table with the results under binomial-beta model prior

  3. reg_names - vector with names of the regressors - to be used by the functions

  4. R - total number of regressors

  5. M - size of the mode space

  6. forJointnes - table with model IDs and PMPs for jointness function

  7. forBestModels - table with model IDs, PMPs, coefficients, stds, and, stdRs for best_models function

  8. EMS - expected model size for binomial and binomial-beta model prior specified by the user (default EMS = R/2)

  9. sizePriors - table with uniform and random model priors spread over model sizes for model_sizes function

  10. PMPs - table with posterior model probabilities for model_sizes function

  11. modelPriors - table with priors on models for model_pmp function

  12. dilution - parameter indication if priors were diluted for model_sizes function

  13. alphas - coefficients on lagged dependent variable for coef_hist function

  14. betas_nonzero - nonzero coefficients on the regressors for coef_hist function

  15. d_free - table with degrees of freedom of estimated models for best_models function

  16. PMStable - table with prior and posterior expected model size for binomial and binomial-beta model prior

Examples


library(magrittr)

data_prepared <- economic_growth[,1:7] %>%
   feature_standardization(timestamp_col = year, entity_col = country) %>%
   feature_standardization(timestamp_col = year, entity_col = country,
                           time_effects = TRUE, scale = FALSE)

model_space <- optimal_model_space(df = data_prepared, dep_var_col = gdp,
                                   timestamp_col = year, entity_col = country,
                                   init_value = 0.5)

bma_results <- bma(df = data_prepared, dep_var_col = gdp, timestamp_col = year,
entity_col = country, model_space = model_space, run_parallel = FALSE, dilution = 0)


bdsm documentation built on April 4, 2025, 1:06 a.m.

Related to bma in bdsm...