Bayesian Nested Logit in PyMC Marketing
utility
consumer choice
causal inference
Abstract
Bayesian Estimation of Nested Logit Discrete Choice Model
Discrete Choice Models for Consumer Choice
In this project I sought to add the functionality for bayesian versions to the PyMC Marketing package. I added classes for the estimation of the multinomial logit and nested logit discrete choice models. We demonstrated how these classes can be used to esitmate patterns of consumer preference. We built a formula style interface for specifying the model set up.
= [
utility_formulas "gc ~ ic_gc + oc_gc | income + rooms ",
"ec ~ ic_ec + oc_ec | income + rooms ",
"gr ~ ic_gr + oc_gr | income + rooms ",
"er ~ ic_er + oc_er | income + rooms ",
"hp ~ ic_hp + oc_hp | income + rooms ",
]
= {"central": ["gc", "ec"], "room": ["hp", "gr", "er"]}
nesting_structure
= NestedLogit(
nstL_1
df,
utility_formulas,"depvar",
=["ic", "oc"],
covariates=nesting_structure,
nesting_structure={
model_config"alphas_": Prior("Normal", mu=0, sigma=5, dims="alts"),
"betas": Prior("Normal", mu=0, sigma=1, dims="alt_covariates"),
"betas_fixed_": Prior("Normal", mu=0, sigma=1, dims="fixed_covariates"),
"lambdas_nests": Prior("Beta", alpha=2, beta=2, dims="nests"),
},
)
nstL_1
In particular we highlight the differences between proportional and non-proportional patterns of product substitution using these models. The demonstration of the multinomial logit can be found here and the nested logit here