This helper function creates demand curves
ec_demcurve_inci(
ec_long,
focal_product,
rel_pricerange,
dem_fun,
draws,
epsilon_not = NULL
)
choice scenario (discrete or volumetric)
Logical vector picking the focal product for which to create a demand curve
Price range, relative to base case price; this is used to create demand curve
demand function (e.g., dd_prob
for HMNL or vd_dem_vdm
for volumetric demand). For discrete choice, use choice probabilities instead of choice predictions.
ec-draws object (e.g., output from dd_est_hmnl
or vd_est_vd
)
(optional) error realisatins (this helps make curves look smother for voumetric models)
List containing aggregate demand quantities for each scenario defined by rel_pricerange
ec_gen_err_normal()
to generate error realization from Normal distribution,
ec_gen_err_ev1()
to generate error realization from EV1 distribution
# \donttest{
data(icecream)
#run MCMC sampler (use way more than 50 draws for actual use)
icecream_est <- icecream %>% dplyr::filter(id<50) %>%
vd_est_vdm(R=20, keep=1)
#> Using 16 cores
#> MCMC in progress
#> MCMC complete
#> Total Time Elapsed: 0.00 minutes
#demand at different price points
inci_scenarios<-
ec_demcurve_inci(icecream%>% dplyr::filter(id<50),
icecream%>% dplyr::filter(id<50) %>% pull('Brand')=="Store",
c(.75,1,1.25),vd_dem_vdm,icecream_est)
#> Using 16 cores
#> Using 16 cores
#> Using 16 cores
# }