model_sizes: Graphs of the Prior and Posterior Probabilities of Model...

View source: R/model_sizes.R

model_sizesR Documentation

Graphs of the Prior and Posterior Probabilities of Model Sizes

Description

This function draws two graphs of prior and posterior model probabilities:
a) The results with binomial model prior
b) The results with binomial-beta model prior
c) One graph combining all the aforementioned graphs

Usage

model_sizes(x, type = c("line", "histogram"))

Arguments

x

An object of class badp_bma, typically returned by bma.

type

Character, either "line" (the default) for the prior and posterior drawn as lines against model size, or "histogram" for them drawn as side-by-side bars. Bars read well when there are few model sizes; with many regressors the line form stays legible where the bars become crowded.

Value

A list with three graphs with prior and posterior model probabilities for model sizes:

  1. The results with binomial model prior

  2. The results with binomial-beta model prior

  3. One graph combining all the aforementioned graphs

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
)

size_graphs <- model_sizes(bma_results)

# bars instead of lines
model_sizes(bma_results, type = "histogram")


badp documentation built on Sept. 15, 2026, 1:08 a.m.