Aggregate demand draws, e.g. from individual-choice occasion-alternative level to individual level. (using the new demand draw format)

ec_dem_aggregate(de,groupby)

Arguments

de

demand draws

groupby

groupby grouping variables (as (vector of) string(s))

Value

Aggregated demand predictions

Examples

data(icecream)
#run MCMC sampler (use way more than 50 draws for actual use)
icecream_est <- icecream %>% dplyr::filter(id<20) %>% vd_est_vdm(R=10, keep=1)
#> Using 16 cores
#>  MCMC in progress 
#> MCMC complete
#>  Total Time Elapsed: 0.00 minutes
#Generate demand predictions
icecream_predicted_demand=
 icecream %>% dplyr::filter(id<20) %>%   
   vd_dem_vdm(icecream_est)
#> Using 16 cores
#aggregate
brand_lvl_pred_demand <-
 icecream_predicted_demand %>% ec_dem_aggregate("Brand")