Package: choicer 0.1.0.9000

choicer: Discrete Choice Models for Economic Applications

Fast estimation of discrete-choice models for applied economics. Likelihoods, analytical gradients and Hessians are implemented in C++ with 'OpenMP' parallelism, scaling efficiently to specifications with many alternative-specific constants. Post-estimation routines return predicted shares, own- and cross-price elasticities, and diversion ratios. Supports multinomial logit ('MNL'), mixed logit ('MXL'), and nested logit ('NL').

Authors:Fernando Cordeiro [aut, cre, cph]

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

# 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

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

On CRAN:

Conda:

openblascppopenmp

3.78 score 1 stars 8 scripts 332 downloads 49 exports 6 dependencies

Last updated from:c477a8141c. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK181
linux-devel-x86_64OK176
source / vignettesOK205
linux-release-arm64OK192
linux-release-x86_64OK173
macos-release-arm64OK145
macos-release-x86_64OK266
macos-oldrel-arm64OK121
macos-oldrel-x86_64OK371
windows-develOK182
windows-releaseOK177
windows-oldrelOK169
wasm-releaseOK136

Exports:blpblp_contractionbuild_var_matconsumer_surplusdiversion_ratioselasticitiesget_halton_normalsgofjacobian_vech_Sigmalogsummc_asymptoticsmnl_diversion_ratios_parallelmnl_elasticities_parallelmnl_loglik_gradient_parallelmnl_loglik_hessian_parallelmnl_predictmnl_predict_sharesmonte_carlomxl_bhhh_parallelmxl_blp_contractionmxl_diversion_ratios_parallelmxl_elasticities_parallelmxl_hessian_parallelmxl_loglik_gradient_parallelmxl_logsummxl_predictmxl_predict_sharesnew_choicer_simnl_blp_contractionnl_diversion_ratios_parallelnl_elasticities_parallelnl_loglik_gradient_parallelnl_loglik_numeric_hessiannl_predictnl_predict_sharesprepare_mnl_dataprepare_mxl_dataprepare_nl_datarecovery_tablerun_mnlogitrun_mxlogitrun_nestlogitsample_by_choicesimulate_mnl_datasimulate_mxl_datasimulate_nl_datawesml_vcovwesml_weightswtp

Dependencies:data.tablenloptrrandtoolboxRcppRcppArmadillorngWELL

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
Reconstruct variance matrix L from L_paramsbuild_var_mat
Extract coefficients from a choicer_fit objectcoef.choicer_fit
Expected consumer surplusconsumer_surplus consumer_surplus.choicer_mnl consumer_surplus.choicer_mxl consumer_surplus.choicer_nl
Compute aggregate diversion ratiosdiversion_ratios
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 for multinomial logit modelelasticities.choicer_mnl
Elasticities for mixed logit modelelasticities.choicer_mxl
Elasticities for nested logit modelelasticities.choicer_nl
Halton draws for mixed logitget_halton_normals
Goodness of fit for a fitted choice modelgof gof.choicer_fit
Utility to compute analytical Jacobian of random coefficient matrix transformed by vech (dVech(Sigma) / dTheta)jacobian_vech_Sigma
Extract log-likelihood from a choicer_fit objectlogLik.choicer_fit
Expected logsum (inclusive value) per choice situationlogsum logsum.choicer_mnl logsum.choicer_mxl logsum.choicer_nl
Asymptotic diagnostics for a Monte Carlo studymc_asymptotics
Compute MNL diversion ratios (parallelized over individuals)mnl_diversion_ratios_parallel
Compute aggregate elasticities for MNL modelmnl_elasticities_parallel
Log-likelihood and gradient for multinomial logit modelmnl_loglik_gradient_parallel
Hessian matrix for multinomial logit modelmnl_loglik_hessian_parallel
Prediction of choice probabilities and utilities based on fitted modelmnl_predict
Prediction of market shares based on fitted modelmnl_predict_shares
Monte Carlo parameter recoverymonte_carlo
BHHH (outer product of gradients) information matrix for Mixed Logitmxl_bhhh_parallel
BLP contraction mapping for mixed logitmxl_blp_contraction
Diversion ratios for Mixed Logit (simulated, derivative-based)mxl_diversion_ratios_parallel
Compute aggregate elasticities for mixed logit modelmxl_elasticities_parallel
Analytical Hessian of the log-likelihood v2mxl_hessian_parallel
Log-likelihood and gradient for Mixed Logitmxl_loglik_gradient_parallel
Simulated expected logsum (inclusive value) for Mixed Logitmxl_logsum
Per-observation simulated choice probabilities for Mixed Logitmxl_predict
Predicted aggregate market shares for Mixed Logitmxl_predict_shares
Construct a 'choicer_sim' objectnew_choicer_sim
BLP95 contraction mapping for the Nested Logit modelnl_blp_contraction
Compute Nested Logit diversion ratios (parallelized over individuals)nl_diversion_ratios_parallel
Compute aggregate elasticities for the Nested Logit modelnl_elasticities_parallel
Log-likelihood and gradient for Nested Logit modelnl_loglik_gradient_parallel
Numerical Hessian of the log-likelihood via finite differencesnl_loglik_numeric_hessian
Prediction of choice probabilities and utilities for the Nested Logit modelnl_predict
Prediction of market shares for the Nested Logit modelnl_predict_shares
Extract number of observations from a choicer_fit objectnobs.choicer_fit
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 'mnl_loglik_gradient_parallel()'prepare_mnl_data
Prepare inputs for 'mxl_loglik_gradient_parallel()'prepare_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 WTP tableprint.choicer_wtp
Print summary for multinomial logit modelprint.summary.choicer_mnl
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_mc
Runs multinomial logit estimationrun_mnlogit
Runs mixed logit estimationrun_mxlogit
Runs nested logit estimationrun_nestlogit
Draw a choice-based sample stratified by the chosen alternativesample_by_choice
Simulate multinomial logit datasimulate_mnl_data
Simulate mixed logit datasimulate_mxl_data
Simulate nested logit datasimulate_nl_data
Summary for multinomial logit modelsummary.choicer_mnl
Summary for mixed logit modelsummary.choicer_mxl
Summary for nested logit modelsummary.choicer_nl
Extract variance-covariance matrix from a choicer_fit objectvcov.choicer_fit
Robust (sandwich) variance for a weighted / choice-based mixed logit fitwesml_vcov wesml_vcov.choicer_mxl
WESML weights for choice-based (endogenous stratified) sampleswesml_weights
Compute willingness to paywtp wtp.choicer_fit wtp.choicer_mxl