ec_demcurve_inci {echoice2} | R Documentation |
Create demand-incidence curves
Description
This helper function creates demand curves
Usage
ec_demcurve_inci(
ec_long,
focal_product,
rel_pricerange,
dem_fun,
draws,
epsilon_not = NULL
)
Arguments
ec_long |
choice scenario (discrete or volumetric) |
focal_product |
Logical vector picking the focal product for which to create a demand curve |
rel_pricerange |
Price range, relative to base case price; this is used to create demand curve |
dem_fun |
demand function (e.g., |
draws |
ec-draws object (e.g., output from |
epsilon_not |
(optional) error realisatins (this helps make curves look smother for voumetric models) |
Value
List containing aggregate demand quantities for each scenario defined by rel_pricerange
See Also
ec_gen_err_normal()
to generate error realization from Normal distribution,
ec_gen_err_ev1()
to generate error realization from EV1 distribution
Examples
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, cores=2)
#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)