model_pmp: Graphs of the Prior and Posterior Probabilities of Individual...

View source: R/model_pmp.R

model_pmpR Documentation

Graphs of the Prior and Posterior Probabilities of Individual Models

Description

This function draws four graphs of prior and posterior model probabilities for the best individual models:
a) The results with binomial model prior (based on PMP - posterior model probability)
b) The results with binomial-beta model prior (based on PMP - posterior model probability)
Models on the graph are ordered according to their posterior model probability.

Usage

model_pmp(x, top = NULL, type = c("line", "histogram"))

Arguments

x

An object of class badp_bma, typically returned by bma.

top

The number of the best model to be placed on the graphs

type

Character, either "line" (the default) for the prior and posterior drawn as lines against the model ranking, or "histogram" for them drawn as side-by-side bars. The bar form suits a small top, where individual models can still be told apart; with a large top the lines are easier to read.

Value

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

  1. The results with binomial model prior (based on PMP - posterior model probability)

  2. The results with binomial-beta model prior (based on PMP - posterior model probability)

  3. One graph combining 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
)

model_graphs <- model_pmp(bma_results, top = 16)

# bars instead of lines
model_pmp(bma_results, top = 5, type = "histogram")


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