vd_dem_vdm {echoice2} | R Documentation |
Demand Prediction (Volumetric Demand Model)
Description
Generating demand predictions for volumetric demand model.
Reminder: there is no closed-form solution for demand, thus we need to integrate not only over the posterior distribution of parameters and the error distribution.
The function outputs a tibble containing id, task, alt, p, attributes, draws from the posterior of demand.
Error realizations can be pre-supplied to the epsilon_not
. This helps create smooth demand curves or conduct optimization.
Usage
vd_dem_vdm(
vd,
est,
epsilon_not = NULL,
error_dist = NULL,
tidy = TRUE,
cores = NULL
)
Arguments
vd |
data |
est |
ec-model draws |
epsilon_not |
(optional) error realizations |
error_dist |
(optional) A string defining the error term distribution (default: 'EV1') |
tidy |
(optional) apply 'echoice2' tidier (default: TRUE) |
cores |
(optional) cores (default: auto-detect) |
Value
Draws of expected demand
See Also
prep_newprediction()
to match vd
's factor levels,
ec_gen_err_ev1()
for pre-generating error realizations and
vd_est_vdm()
for estimating the corresponding model
Examples
data(icecream)
#run MCMC sampler (use way more than 10 draws for actual use)
icecream_est <- icecream %>% dplyr::filter(id<20) %>% vd_est_vdm(R=10, keep=1, cores=2)
#Generate demand predictions
icecream_predicted_demand=
icecream %>% dplyr::filter(id<20) %>%
vd_dem_vdm(icecream_est, cores=2)
#column .demdraws contains draws from posterior of predicted demand