get_mod_sel: Get Model Selection Criteria

View source: R/get_mol_sel.R

get_mod_selR Documentation

Get Model Selection Criteria

Description

Calculates model selection criteria such as AIC, BIC, DIC, and WAIC from a Stan model fit.

Usage

get_mod_sel(y, mod_type, distri, stan_fit, M = NULL)

Arguments

y

A numeric vector representing the observed data.

mod_type

Character string indicating the model type ("zi" or "h").

distri

Character string specifying the distribution ("poi", "nb", "gp", or "cmp").

stan_fit

A stanfit object returned by get_stanfit.

M

CMP cutoff used in fitting. Retrieved from the fit returned by get_stanfit, or supplied explicitly for a fit made directly with Stan.

Value

A summary table of model selection criteria, including:

EAIC

Expected Akaike Information Criterion (AIC).

EBIC

Expected Bayesian Information Criterion (BIC).

DIC

Deviance Information Criterion (DIC).

WAIC1

First version of Watanabe-Akaike Information Criterion (WAIC).

WAIC2

Second version of Watanabe-Akaike Information Criterion (WAIC).

The criteria are returned in a one-row data frame.

Examples


  # Generate toy data
  y_data <- data_simu(n = 60, alpha = 0.5, rho = 0.3, lambda = 5,
                      mod_type = "zi", distri = "poi")

  # Fit a small Stan model (may take > 5s on first compile)
  stan_fit <- get_stanfit(mod_type = "zi", distri = "poi", y = y_data)

  # Get model selection criteria
  get_mod_sel(y = y_data, mod_type = "zi", distri = "poi",
              stan_fit = stan_fit)



ZIHINAR1 documentation built on Nov. 10, 2026, 9:07 a.m.