recovery_table: Parameter recovery table

View source: R/recovery.R

recovery_tableR Documentation

Parameter recovery table

Description

Compares fitted coefficients to a set of true parameter values on the same scale as the estimator's internal parameterization. Returns one row per estimated parameter with true value, estimate, standard error, bias, relative bias (%), z-score against the truth, Wald CI, and a coverage indicator.

Usage

recovery_table(object, truth = NULL, level = 0.95, ...)

## S3 method for class 'choicer_fit'
recovery_table(object, truth = NULL, level = 0.95, ...)

## S3 method for class 'choicer_mnp'
recovery_table(object, truth = NULL, level = 0.95, ...)

## S3 method for class 'choicer_mc'
recovery_table(object, truth = NULL, level = 0.95, ...)

## S3 method for class 'choicer_hb'
recovery_table(object, truth = NULL, level = 0.95, ...)

Arguments

object

A choicer_fit object (MNL, MXL, or NL) or a choicer_mc result.

truth

Either a choicer_sim object (whose ⁠$true_params⁠ will be used) or a named list of true parameter values.

level

Confidence level for the Wald CI and coverage indicator. Default 0.95.

...

Unused.

Details

For MXL fits the sigma block compares the raw Cholesky parameters (L_params), not the reconstructed covariance matrix. For log-normal random-coefficient means the raw mu estimate is compared directly; callers who want recovery on the DGP scale (exp(mu)) should transform both sides before calling.

When the estimator has normalized the first inside alternative's ASC to zero (which happens for MNL/MXL with include_outside_option = FALSE and no outside option baked into the fit), the first entry of truth$delta is dropped before the comparison so lengths match.

Value

See class-specific methods.

Methods (by class)

  • recovery_table(choicer_fit): Returns a choicer_recovery object (a data.table) with columns parameter, group, true, estimate, se, bias, rel_bias_pct, z_vs_true, lower_ci, upper_ci, covers.

  • recovery_table(choicer_mnp): Method for Bayesian MNP fits (choicer_mnp). The estimate column holds posterior means of the identified draws and se holds their posterior standard deviations, so lower_ci / upper_ci are normal-approximation credible intervals. In addition to the beta and asc blocks, a sigma block compares the identified covariance of the utility differences (lower triangle in the estimator's row-major Sigma_ij order); its first row is the sigma_11 = 1 normalization and is exact by construction. truth must be on the identified scale, as returned by simulate_mnp_data().

  • recovery_table(choicer_mc): For a choicer_mc object, delegates to summary(object, level) and returns a choicer_mc_summary. Inspect object$replications directly for per-rep detail.

  • recovery_table(choicer_hb): Method for hierarchical Bayes fits (choicer_hmnl / choicer_hmnp). estimate holds posterior means and se posterior standard deviations, so lower_ci / upper_ci are normal-approximation credible intervals. Blocks: beta (population means b vs truth$beta), w (diag(W) vs diag(truth$W)), theta (delta mean function), sigma_d (the SD, compared through the sqrt of the sigma_d^2 draws), and delta (per-alternative effects vs the realized truth$delta). For an HMNP fit, truth must be on the identified scale, as returned by simulate_hmnp_data().

Examples


sim <- simulate_mnl_data(N = 2000, J = 4, seed = 123)
fit <- run_mnlogit(
  data = sim$data, id_col = "id", alt_col = "alt", choice_col = "choice",
  covariate_cols = c("x1", "x2"),
  outside_opt_label = 0L, include_outside_option = FALSE, use_asc = TRUE
)
recovery_table(fit, sim)


choicer documentation built on Sept. 5, 2026, 1:07 a.m.