Package: echoice2 0.2.4

Nino Hardt

echoice2: Choice Models with Economic Foundation

Implements choice models based on economic theory, including estimation using Markov chain Monte Carlo (MCMC), prediction, and more. Its usability is inspired by ideas from 'tidyverse'. Models include versions of the Hierarchical Multinomial Logit and Multiple Discrete-Continous (Volumetric) models with and without screening. The foundations of these models are described in Allenby, Hardt and Rossi (2019) <doi:10.1016/bs.hem.2019.04.002>. Models with conjunctive screening are described in Kim, Hardt, Kim and Allenby (2022) <doi:10.1016/j.ijresmar.2022.04.001>. Models with set-size variation are described in Hardt and Kurz (2020) <doi:10.2139/ssrn.3418383>.

Authors:Nino Hardt [aut, cre]

echoice2_0.2.4.tar.gz
echoice2_0.2.4.tar.gz(r-4.5-noble)echoice2_0.2.4.tar.gz(r-4.4-noble)
echoice2_0.2.4.tgz(r-4.4-emscripten)echoice2_0.2.4.tgz(r-4.3-emscripten)
echoice2.pdf |echoice2.html
echoice2/json (API)
NEWS

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

Peer review:

Bug tracker:https://github.com/ninohardt/echoice2/issues

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

2.30 score 7 scripts 215 downloads 60 exports 39 dependencies

Last updated 1 years agofrom:24cacf3f14. Checks:OK: 2. Indexed: no.

TargetResultDate
Doc / VignettesOKNov 15 2024
R-4.5-linux-x86_64OKNov 15 2024

Exports:%.%dd_demdd_dem_srdd_est_hmnldd_est_hmnl_screendd_LLdd_LL_srdummifydummyvarec_boxplot_MUec_boxplot_screenec_dem_aggregateec_dem_evalec_dem_summariseec_dem_summarizeec_demcurveec_demcurve_cond_demec_demcurve_inciec_draws_MUec_draws_screenec_estimates_MUec_estimates_screenec_estimates_SIGMAec_estimates_SIGMA_correc_gen_err_ev1ec_gen_err_normalec_lmd_NRec_lol_tidy1ec_screen_summariseec_screen_summarizeec_screenprob_srec_summarise_attrlvlsec_summarize_attrlvlsec_trace_MUec_trace_screenec_undummyec_undummy_lowhighec_undummy_lowmediumhighec_undummy_yesnoec_util_choice_to_longec_util_dummy_mutualeclusiveget_attr_lvllogMargDenNRuprep_newpredictionvd_add_prodidvd_dem_summarisevd_dem_summarizevd_dem_vdmvd_dem_vdm_screenvd_dem_vdm_ssvd_est_vdmvd_est_vdm_screenvd_est_vdm_ssvd_LL_vdmvd_LL_vdm_screenvd_LL_vdmssvd_long_tidyvd_preparevd_prepare_noxvd_thin_draw

Dependencies:clicolorspacecpp11dplyrfansifarverforcatsgenericsggplot2gluegtableisobandlabelinglatticelifecyclemagrittrMASSMatrixmgcvmunsellnlmepillarpkgconfigpurrrR6RColorBrewerRcppRcppArmadillorlangscalesstringistringrtibbletidyrtidyselectutf8vctrsviridisLitewithr

Importing list-of-lists choice data and discrete choice modeling with echoice2

Rendered fromImporting_lol_data.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2023-03-12
Started: 2023-03-12

Volumetric Demand and Conjunctive Screening with echoice2

Rendered fromModeling_volumetric_demand.Rmdusingknitr::rmarkdownon Nov 15 2024.

Last update: 2023-03-12
Started: 2023-03-12

Readme and manuals

Help Manual

Help pageTopics
Get the attribute of an object%.%
Discrete Choice Predictions (HMNL)dd_dem
Discrete Choice Predictions (HMNL with attribute-based screening)dd_dem_sr
Estimate discrete choice model (HMNL)dd_est_hmnl
Estimate discrete choice model (HMNL, attribute-based screening (not including price))dd_est_hmnl_screen
Log-Likelihood for compensatory hmnl modeldd_LL
Log-Likelihood for screening hmnl modeldd_LL_sr
Create dummy variables within a tibbledummify
Dummy-code a categorical variabledummyvar
Generate MU_theta boxplotec_boxplot_MU
Generate Screening probability boxplotec_boxplot_screen
Aggregate posterior draws of demandec_dem_aggregate
Evaluate (hold-out) demand predictionsec_dem_eval
Summarize posterior draws of demandec_dem_summarise ec_dem_summarize
Create demand curvesec_demcurve
Create demand-incidence curvesec_demcurve_cond_dem
Create demand-incidence curvesec_demcurve_inci
Obtain MU_theta drawsec_draws_MU
Obtain Screening probability drawsec_draws_screen
Obtain upper level model estimatesec_estimates_MU
Summarize attribute-based screening parametersec_estimates_screen
Obtain posterior mean estimates of upper level covarianceec_estimates_SIGMA
Obtain posterior mean estimates of upper level correlationsec_estimates_SIGMA_corr
Simulate error realization from EV1 distributionec_gen_err_ev1
Simulate error realization from Normal distributionec_gen_err_normal
Obtain Log Marginal Density from draw objectsec_lmd_NR
Convert "list of lists" format to long "tidy" formatec_lol_tidy1
Summarize posterior draws of screeningec_screen_summarise ec_screen_summarize
Screening probabilities of choice alternativesec_screenprob_sr
Summarize attributes and levelsec_summarise_attrlvls ec_summarize_attrlvls
Generate MU_theta traceplotec_trace_MU
Generate Screening probability traceplotsec_trace_screen
Converts a set of dummy variables into a single categorical variableec_undummy
Convert dummy-coded variables to low/high factorec_undummy_lowhigh
Convert dummy-coded variables to low/medium/high factorec_undummy_lowmediumhigh
Convert dummy-coded variables to yes/no factorec_undummy_yesno
Convert a vector of choices to long formatec_util_choice_to_long
Find mutually exclusive columnsec_util_dummy_mutualeclusive
Obtain attributes and levels from tidy choice data with dummiesget_attr_lvl
icecreamicecream
icecream_discreteicecream_discrete
Log Marginal Density (Newton-Raftery)logMargDenNRu
pizzapizza
Match factor levels between two datasetsprep_newprediction
Add product id to demand drawsvd_add_prodid
Summarize posterior draws of demand (volumetric models only)vd_dem_summarise vd_dem_summarize
Demand Prediction (Volumetric Demand Model)vd_dem_vdm
Demand Prediction (Volumetric demand, attribute-based screening)vd_dem_vdm_screen
Demand Prediction (Volumetric demand, accounting for set-size variation, EV1 errors)vd_dem_vdm_ss
Estimate volumetric demand modelvd_est_vdm
Estimate volumetric demand model with attribute-based conjunctive screeningvd_est_vdm_screen
Estimate volumetric demand model accounting for set size variation (1st order)vd_est_vdm_ss
Log-Likelihood for compensatory volumetric demand modelvd_LL_vdm
Log-Likelihood for conjunctive-screening volumetric demand modelvd_LL_vdm_screen
Log-Likelihood for volumetric demand model with set-size variationvd_LL_vdmss
Generate tidy choice data with dummies from long-format choice datavd_long_tidy
Prepare choice data for analysisvd_prepare
Prepare choice data for analysis (without x being present)vd_prepare_nox
Thin 'echoice2'-vd draw objectsvd_thin_draw