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, ...)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.
Methods (by class)
recovery_table(choicer_fit): Returns achoicer_recoveryobject (adata.table) with columnsparameter,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). Theestimatecolumn holds posterior means of the identified draws andseholds their posterior standard deviations, solower_ci/upper_ciare normal-approximation credible intervals. In addition to thebetaandascblocks, asigmablock compares the identified covariance of the utility differences (lower triangle in the estimator's row-majorSigma_ijorder); its first row is thesigma_11 = 1normalization and is exact by construction.truthmust be on the identified scale, as returned bysimulate_mnp_data().recovery_table(choicer_mc): For achoicer_mcobject, delegates tosummary(object, level)and returns achoicer_mc_summary. Inspectobject$replicationsdirectly for per-rep detail.recovery_table(choicer_hb): Method for hierarchical Bayes fits (choicer_hmnl/choicer_hmnp).estimateholds posterior means andseposterior standard deviations, solower_ci/upper_ciare normal-approximation credible intervals. Blocks:beta(population means b vstruth$beta),w(diag(W) vsdiag(truth$W)),theta(delta mean function),sigma_d(the SD, compared through the sqrt of the sigma_d^2 draws), anddelta(per-alternative effects vs the realizedtruth$delta). For an HMNP fit,truthmust be on the identified scale, as returned bysimulate_hmnp_data().
Examples
# \donttest{
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
)
#> Optimization run time 0h:0m:0.16s
recovery_table(fit, sim)
#> <choicer_recovery> model=choicer_mnl level=0.95
#> parameter group true estimate se bias rel_bias_pct z_vs_true
#> <char> <char> <num> <num> <num> <num> <num> <num>
#> 1: x1 beta 0.8 0.7963 0.0561 -0.0037 -0.4612 -0.0657
#> 2: x2 beta -0.6 -0.5433 0.0558 0.0567 -9.4436 1.0160
#> 3: ASC_1 asc 0.5 0.5680 0.0687 0.0680 13.5941 0.9895
#> 4: ASC_2 asc -0.5 -0.2788 0.0821 0.2212 -44.2448 2.6959
#> 5: ASC_3 asc 0.5 0.5590 0.0686 0.0590 11.8065 0.8603
#> 6: ASC_4 asc -0.5 -0.4733 0.0859 0.0267 -5.3362 0.3106
#> lower_ci upper_ci covers
#> <num> <num> <lgcl>
#> 1: 0.6863 0.9064 TRUE
#> 2: -0.6526 -0.4340 TRUE
#> 3: 0.4333 0.7026 TRUE
#> 4: -0.4396 -0.1179 FALSE
#> 5: 0.4245 0.6935 TRUE
#> 6: -0.6417 -0.3049 TRUE
# }