Learn R Programming

echoice2 (version 0.2.5)

Choice Models with Economic Foundation

Description

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) . Models with conjunctive screening are described in Kim, Hardt, Kim and Allenby (2022) . Models with set-size variation are described in Hardt and Kurz (2020) .

Copy Link

Version

Install

install.packages('echoice2')

Monthly Downloads

245

Version

0.2.5

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Nino Hardt

Last Published

November 2nd, 2025

Functions in echoice2 (0.2.5)

ec_dem_aggregate

Aggregate posterior draws of demand
ec_trace_screen

Generate Screening probability traceplots
ec_lmd_NR

Obtain Log Marginal Density from draw objects
ec_estimates_SIGMA_corr

Obtain posterior mean estimates of upper level correlations
ec_lol_tidy1

Convert "list of lists" format to long "tidy" format
ec_undummy

Converts a set of dummy variables into a single categorical variable
ec_summarize_attrlvls

Summarize attributes and levels
ec_trace_MU

Generate MU_theta traceplot
ec_demcurve

Create demand curves
get_attr_lvl

Obtain attributes and levels from tidy choice data with dummies
ec_dem_summarise

Summarize posterior draws of demand
%.%

Get the attribute of an object
prep_newprediction

Match factor levels between two datasets
vd_LL_vdm

Log-Likelihood for compensatory volumetric demand model
ec_util_dummy_mutualeclusive

Find mutually exclusive columns
ec_estimates_screen

Summarize attribute-based screening parameters
vd_prepare_nox

Prepare choice data for analysis (without x being present)
icecream

icecream
icecream_discrete

icecream_discrete
echoice2-package

echoice2: Choice Models with Economic Foundation
ec_screen_summarise

Summarize posterior draws of screening
ec_screenprob_sr

Screening probabilities of choice alternatives
ec_undummy_yesno

Convert dummy-coded variables to yes/no factor
vd_dem_vdm

Demand Prediction (Volumetric Demand Model)
vd_thin_draw

Thin 'echoice2'-vd draw objects
ec_demcurve_cond_dem

Create demand-incidence curves
logMargDenNRu

Log Marginal Density (Newton-Raftery)
ec_demcurve_inci

Create demand-incidence curves
ec_gen_err_normal

Simulate error realization from Normal distribution
pizza

pizza
ec_gen_err_ev1

Simulate error realization from EV1 distribution
vd_dem_vdm_ss

Demand Prediction (Volumetric demand, accounting for set-size variation, EV1 errors)
vd_dem_vdm_screen

Demand Prediction (Volumetric demand, attribute-based screening)
ec_undummy_lowhigh

Convert dummy-coded variables to low/high factor
ec_undummy_lowmediumhigh

Convert dummy-coded variables to low/medium/high factor
vd_LL_vdm_screen

Log-Likelihood for conjunctive-screening volumetric demand model
vd_est_vdm

Estimate volumetric demand model
vd_LL_vdmss

Log-Likelihood for volumetric demand model with set-size variation
vd_long_tidy

Generate tidy choice data with dummies from long-format choice data
vd_add_prodid

Add product id to demand draws
vd_prepare

Prepare choice data for analysis
vd_dem_summarise

Summarize posterior draws of demand (volumetric models only)
ec_util_choice_to_long

Convert a vector of choices to long format
vd_est_vdm_ss

Estimate volumetric demand model accounting for set size variation (1st order)
vd_est_vdm_screen

Estimate volumetric demand model with attribute-based conjunctive screening
dd_est_hmnl_screen

Estimate discrete choice model (HMNL, attribute-based screening (not including price))
ec_boxplot_screen

Generate Screening probability boxplot
dummyvar

Dummy-code a categorical variable
dummify

Create dummy variables within a tibble
dd_est_hmnl

Estimate discrete choice model (HMNL)
dd_LL_sr

Log-Likelihood for screening hmnl model
dd_dem_sr

Discrete Choice Predictions (HMNL with attribute-based screening)
ec_dem_eval

Evaluate (hold-out) demand predictions
dd_LL

Log-Likelihood for compensatory hmnl model
ec_boxplot_MU

Generate MU_theta boxplot
dd_dem

Discrete Choice Predictions (HMNL)
ec_draws_screen

Obtain Screening probability draws
ec_draws_MU

Obtain MU_theta draws
ec_estimates_SIGMA

Obtain posterior mean estimates of upper level covariance
ec_estimates_MU

Obtain upper level model estimates