View source: R/hb_diagnostics.R
| ppc_shares | R Documentation |
Compares each alternative's observed take rate (share of choice
situations in which it was chosen, including the outside option) with its
posterior-predictive share from predict.choicer_hb(). Large systematic
gaps indicate model misfit — e.g. a missing covariate or an
outside-option share the delta level cannot rationalize.
ppc_shares(object, n_draws = 200L)
object |
A |
n_draws |
Posterior draws to integrate over (default 200). |
A data.table with columns alternative, observed,
predicted, lower, upper (95% posterior-predictive interval), and
covered (is the observed share inside the interval).
sim <- simulate_hmnl_data(N = 100, T = 3, J = 4, seed = 42)
fit <- suppressWarnings(run_hmnlogit(sim$data, "task", "alt", "choice", c("x1", "x2"),
person_col = "pid",
mcmc = list(R = 500, burn = 200)))
ppc_shares(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.