Learn R Programming

⚠️There's a newer version (0.2.4) of this package.Take me there.

echoice2 (version 0.2.3)

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

234

Version

0.2.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Nino Hardt

Last Published

March 12th, 2023

Functions in echoice2 (0.2.3)

ec_draws_MU

Obtain MU_theta draws
ec_dem_aggregate

Aggregate posterior draws of demand
ec_dem_summarise

Summarize posterior draws of demand
ec_draws_screen

Obtain Screening probability draws
ec_dem_eval

Evaluate (hold-out) demand predictions
ec_lmd_NR

Obtain Log Marginal Density from draw objects
ec_estimates_SIGMA_corr

Obtain posterior mean estimates of upper level correlations
ec_estimates_MU

Obtain upper level model estimates
ec_estimates_SIGMA

Obtain posterior mean estimates of upper level covariance
ec_screen_summarise

Summarize posterior draws of screening
ec_screenprob_sr

Screening probabilities of choice alternatives
ec_demcurve_inci

Create demand-incidence curves
ec_demcurve_cond_dem

Create demand-incidence curves
get_attr_lvl

Obtain attributes and levels from tidy choice data with dummies
ec_gen_err_normal

Simulate error realization from Normal distribution
ec_gen_err_ev1

Simulate error realization from EV1 distribution
%.%

Get the attribute of an object
ec_trace_MU

Generate MU_theta traceplot
ec_summarize_attrlvls

Summarize attributes and levels
vd_add_prodid

Add product id to demand draws
ec_lol_tidy1

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

icecream
icecream_discrete

icecream_discrete
ec_util_dummy_mutualeclusive

Find mutually exclusive columns
echoice2

echoice2
vd_prepare_nox

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

Thin 'echoice2'-vd draw objects
vd_long_tidy

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

Summarize posterior draws of demand (volumetric models only)
pizza

pizza
vd_dem_vdm_ss

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

Log Marginal Density (Newton-Raftery)
vd_dem_vdm_screen

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

Demand Prediction (Volumetric Demand Model)
ec_trace_screen

Generate Screening probability traceplots
ec_undummy

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

Convert dummy-coded variables to low/high factor
vd_LL_vdm_screen

Log-Likelihood for conjunctive-screening volumetric demand model
ec_undummy_lowmediumhigh

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

Summarize attribute-based screening parameters
vd_est_vdm

Estimate volumetric demand model
prep_newprediction

Match factor levels between two datasets
vd_LL_vdm

Log-Likelihood for compensatory volumetric demand model
ec_undummy_yesno

Convert dummy-coded variables to yes/no factor
ec_util_choice_to_long

Convert a vector of choices to long format
vd_prepare

Prepare choice data for analysis
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
vd_LL_vdmss

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

Log-Likelihood for screening hmnl model
dd_LL

Log-Likelihood for compensatory hmnl model
dd_est_hmnl

Estimate discrete choice model (HMNL)
dummyvar

Dummy-code a categorical variable
dummify

Create dummy variables within a tibble
dd_dem

Discrete Choice Predictions (HMNL)
dd_est_hmnl_screen

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

Generate MU_theta boxplot
ec_boxplot_screen

Generate Screening probability boxplot
ec_demcurve

Create demand curves
dd_dem_sr

Discrete Choice Predictions (HMNL with attribute-based screening)