Package: choicer 0.2.1.9000

choicer: Discrete Choice Models for Economic Applications

Fast estimation of discrete-choice models for applied economics. Frequentist likelihoods, analytical gradients, and Hessians are implemented in C++ with 'OpenMP' parallelism, scaling efficiently to specifications with many alternative-specific constants. Compiled Gibbs samplers provide Bayesian multinomial probit and hierarchical models. Post-estimation routines cover predicted shares, own- and cross-price elasticities, diversion ratios, willingness to pay, and welfare counterfactuals. Supports multinomial logit ('MNL'), mixed logit ('MXL'), nested logit ('NL'), Bayesian multinomial probit ('MNP'), and hierarchical Bayesian multinomial logit and probit ('HMNL', 'HMNP').

Authors:Fernando Cordeiro [aut, cre, cph]

choicer_0.2.1.9000.tar.gz
choicer_0.2.1.9000.zip(r-4.7-x86_64)choicer_0.2.1.9000.zip(r-4.7-arm64)choicer_0.2.1.9000.zip(r-4.6-x86_64)choicer_0.2.1.9000.zip(r-4.6-arm64)choicer_0.2.1.9000.zip(r-4.5-x86_64)
choicer_0.2.1.9000.tgz(r-4.6-x86_64)choicer_0.2.1.9000.tgz(r-4.6-arm64)choicer_0.2.1.9000.tgz(r-4.5-x86_64)choicer_0.2.1.9000.tgz(r-4.5-arm64)
choicer_0.2.1.9000.tar.gz(r-4.7-arm64)choicer_0.2.1.9000.tar.gz(r-4.7-x86_64)choicer_0.2.1.9000.tar.gz(r-4.6-arm64)choicer_0.2.1.9000.tar.gz(r-4.6-x86_64)
choicer_0.2.1.9000.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
choicer/json (API)

# Install 'choicer' in R:
install.packages('choicer', repos = c('https://fpcordeiro.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/fpcordeiro/choicer/issues

Pkgdown/docs site:https://fpcordeiro.github.io

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
  • openmp– GCC OpenMP (GOMP) support library
Datasets:

On CRAN:

Conda:

openblascppopenmp

6.29 score 1 stars 22 scripts 273 downloads 44 exports 6 dependencies

Last updated from:93e8da3d79. Checks:13 OK, 2 ERROR. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK284
linux-devel-x86_64OK351
source / vignettesOK421
linux-release-arm64OK285
linux-release-x86_64OK296
macos-release-arm64OK305
macos-release-x86_64OK574
macos-oldrel-arm64OK247
macos-oldrel-x86_64OK481
windows-devel-arm64ERROR616
windows-devel-x86_64OK491
windows-release-arm64ERROR569
windows-release-x86_64OK476
windows-oldrel-x86_64OK389
wasm-releaseOK165

Exports:blpblp_contractionconditional_tastesconsumer_surplusdiversion_ratioselasticitiesessget_halton_normalsgoflogsummc_asymptoticsmcsemonte_carlomxl_blp_contractionnew_choicer_simnl_blp_contractionppc_sharesprepare_hmnl_dataprepare_hmnp_dataprepare_mnl_dataprepare_mnp_dataprepare_mxl_dataprepare_nl_datarecovery_tablerhatrun_hmnlogitrun_hmnprobitrun_mnlogitrun_mnprobitrun_mxlogitrun_nestlogitsample_by_choiceset_num_threadssimulate_hmnl_datasimulate_hmnp_datasimulate_mnl_datasimulate_mnp_datasimulate_mxl_datasimulate_nl_datathread_infotraceplotwesml_vcovwesml_weightswtp

Dependencies:data.tablenloptrrandtoolboxRcppRcppArmadillorngWELL

Mixed logit and preference heterogeneity
Simulate correlated random coefficients | Fit | Parameter recovery | Substitution through taste heterogeneity | Identification and tails | Panel data: one taste draw per decision maker | A research checklist | References

Last update: 2026-10-08
Started: 2026-06-20

Choice-based sampling and WESML weights
Build a population | Draw a choice-based sample | Weighted estimation and inference | Starting from an existing sample | The shipped mode_choice data | References

Last update: 2026-10-07
Started: 2026-06-21

Which standard errors, and when
Dependence you should expect: panel data | Post hoc, without refitting | Clustering repairs inference, not efficiency | Choice-based sampling | References

Last update: 2026-10-05
Started: 2026-07-12

Discrete choice from data to policy, in a dozen lines
The data | Fit a multinomial logit | Predicted shares | Elasticities and diversion | Willingness to pay | A policy counterfactual | One interface, every model | Choosing among choice models | How choicer compares | References

Last update: 2026-09-28
Started: 2026-06-20

Hierarchical Bayes: panel tastes, product effects, and entry
Simulate a panel | Fit | Convergence is part of the result | Did we recover the truth? | Willingness to pay and predicted shares | A policy counterfactual | An entry counterfactual | Price endogeneity | The probit sibling | Further reading | References

Last update: 2026-09-28
Started: 2026-07-12

Bayesian multinomial probit
Simulate from a probit process | Run the sampler | Compare posterior summaries with the truth | A quick MCMC diagnostic | What this fit does not provide | References

Last update: 2026-07-12
Started: 2026-06-20

Multinomial logit
Simulate a known data-generating process | Fit | Did we recover the truth? | Post-estimation | Substitution restrictions | Empirical checklist | References

Last update: 2026-07-12
Started: 2026-06-20

Nested logit and grouped substitution
Simulate a nested process | Fit | Parameter recovery | What identifies the dissimilarity parameters? | Nest-consistent elasticities | Share inversion with BLP | Empirical checklist | References

Last update: 2026-07-12
Started: 2026-06-20

Readme and manuals

Help Manual

Help pageTopics
BLP contraction mappingblp
BLP95 contraction mapping to find delta given target sharesblp_contraction
BLP contraction mapping for multinomial logit modelblp.choicer_mnl
BLP contraction mapping for mixed logit modelblp.choicer_mxl
BLP contraction mapping for nested logit modelblp.choicer_nl
Extract coefficients from a choicer_fit objectcoef.choicer_fit
Extract posterior means from a hierarchical Bayes fitcoef.choicer_hb
Extract coefficients from a choicer_mnp objectcoef.choicer_mnp
Conditional (individual-level) tastes from a mixed logit fitconditional_tastes conditional_tastes.choicer_mxl conditional_tastes.default
Expected consumer surplusconsumer_surplus consumer_surplus.choicer_hmnl consumer_surplus.choicer_hmnp consumer_surplus.choicer_mnl consumer_surplus.choicer_mxl consumer_surplus.choicer_nl
Compute aggregate diversion ratiosdiversion_ratios diversion_ratios.choicer_hb
Diversion ratios for multinomial logit modeldiversion_ratios.choicer_mnl
Diversion ratios for mixed logit modeldiversion_ratios.choicer_mxl
Diversion ratios for nested logit modeldiversion_ratios.choicer_nl
Compute aggregate elasticitieselasticities elasticities.choicer_hb
Elasticities for multinomial logit modelelasticities.choicer_mnl
Elasticities for mixed logit modelelasticities.choicer_mxl
Elasticities for nested logit modelelasticities.choicer_nl
Rank-normalized effective sample size (bulk and tail)ess
Halton draws for mixed logitget_halton_normals
Goodness of fit for a fitted choice modelgof gof.choicer_fit
Extract log-likelihood from a choicer_fit objectlogLik.choicer_fit
Expected logsum (inclusive value) per choice situationlogsum logsum.choicer_hmnl logsum.choicer_hmnp logsum.choicer_mnl logsum.choicer_mxl logsum.choicer_nl
Asymptotic diagnostics for a Monte Carlo studymc_asymptotics
Monte Carlo standard error of posterior summariesmcse
Intercity travel mode choicemode_choice
Monte Carlo parameter recoverymonte_carlo
BLP contraction mapping for mixed logitmxl_blp_contraction
Construct a 'choicer_sim' objectnew_choicer_sim
BLP95 contraction mapping for the Nested Logit modelnl_blp_contraction
Extract number of observations from a choicer_fit objectnobs.choicer_fit
Number of choice situations behind a hierarchical Bayes fitnobs.choicer_hb
Extract number of observations from a choicer_mnp objectnobs.choicer_mnp
Posterior-predictive share check for hierarchical Bayes fitsppc_shares
Posterior choice probabilities and shares for hierarchical Bayes fitspredict.choicer_hb
Predict from a multinomial logit modelpredict.choicer_mnl
Predict from a mixed logit modelpredict.choicer_mxl
Predict from a nested logit modelpredict.choicer_nl
Prepare inputs for hierarchical multinomial logit estimationprepare_hmnl_data
Prepare inputs for hierarchical multinomial probit estimationprepare_hmnp_data
Prepare inputs for multinomial logit estimationprepare_mnl_data
Prepare inputs for Bayesian multinomial probit estimationprepare_mnp_data
Prepare inputs for mixed logit estimationprepare_mxl_data
Prepare inputs for nested logit estimationprepare_nl_data
Print a consumer surplus summaryprint.choicer_cs
Print a choicer_fit objectprint.choicer_fit
Print goodness-of-fit measuresprint.choicer_gof
Print a hierarchical Bayes fitprint.choicer_hb
Print a choicer_mnp objectprint.choicer_mnp
Print conditional tastesprint.choicer_tastes
Print a WTP tableprint.choicer_wtp
Print the summary of a hierarchical Bayes fitprint.summary.choicer_hb
Print summary for multinomial logit modelprint.summary.choicer_mnl
Print summary for Bayesian multinomial probit modelprint.summary.choicer_mnp
Print summary for mixed logit modelprint.summary.choicer_mxl
Print summary for nested logit modelprint.summary.choicer_nl
Parameter recovery tablerecovery_table recovery_table.choicer_fit recovery_table.choicer_hb recovery_table.choicer_mc recovery_table.choicer_mnp
Split-\widehat{R} convergence diagnosticrhat
Fit a hierarchical Bayesian multinomial logit (HMNL)run_hmnlogit
Fit a hierarchical Bayesian multinomial probit (HMNP)run_hmnprobit
Runs multinomial logit estimationrun_mnlogit
Runs Bayesian multinomial probit estimationrun_mnprobit
Runs mixed logit estimationrun_mxlogit
Runs nested logit estimationrun_nestlogit
Draw a choice-based sample stratified by the chosen alternativesample_by_choice
Set the number of OpenMP threads used by choicerset_num_threads
Simulate hierarchical multinomial logit datasimulate_hmnl_data
Simulate hierarchical multinomial probit datasimulate_hmnp_data
Simulate multinomial logit datasimulate_mnl_data
Simulate multinomial probit datasimulate_mnp_data
Simulate mixed logit datasimulate_mxl_data
Simulate nested logit datasimulate_nl_data
Summarize a hierarchical Bayes fitsummary.choicer_hb
Summary for multinomial logit modelsummary.choicer_mnl
Summary for Bayesian multinomial probit modelsummary.choicer_mnp
Summary for mixed logit modelsummary.choicer_mxl
Summary for nested logit modelsummary.choicer_nl
Query choicer OpenMP thread settingsthread_info
Traceplot for a hierarchical Bayes fittraceplot
Traceplot method for hierarchical Bayes fitstraceplot.choicer_hb
Extract variance-covariance matrix from a choicer_fit objectvcov.choicer_fit
Posterior covariance of the population coefficientsvcov.choicer_hb
Extract variance-covariance matrix from a choicer_mnp objectvcov.choicer_mnp
Robust (sandwich) variance for a weighted / choice-based logit fitwesml_vcov wesml_vcov.choicer_mnl wesml_vcov.choicer_mxl wesml_vcov.choicer_nl
WESML weights for choice-based (endogenous stratified) sampleswesml_weights
Compute willingness to paywtp wtp.choicer_fit wtp.choicer_hb wtp.choicer_mxl