| get_mod_sel | R Documentation |
Calculates model selection criteria such as AIC, BIC, DIC, and WAIC from a Stan model fit.
get_mod_sel(y, mod_type, distri, stan_fit, M = NULL)
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 |
M |
CMP cutoff used in fitting. Retrieved from the fit returned by get_stanfit, or supplied explicitly for a fit made directly with Stan. |
A summary table of model selection criteria, including:
Expected Akaike Information Criterion (AIC).
Expected Bayesian Information Criterion (BIC).
Deviance Information Criterion (DIC).
First version of Watanabe-Akaike Information Criterion (WAIC).
Second version of Watanabe-Akaike Information Criterion (WAIC).
The criteria are returned in a one-row data frame.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.