Figure 1.
Histograms of data used in inference. Standardization was computed as z-score. X-axis represents value of the predictor and Y-axis is their count for predefined bins. (top-left) Standardized distance, which is z-score of distance data received from OSRM API. Raw distances were limited to 30 km. (top-right) Standardized meal-preparation time, which is z-score of meal-preparation time. Meal-preparation time was calculated as difference between time the order was received and the time when courier picked up delivery. (center-left) Categories of road traffic, which are raw categorical data describing traffic conditions during each delivery. It can be one of four states: low, medium, high, and jam. (center-right) Distinct deliveries count, which describes number of deliveries that courier had to make during his trip. (botom-left) Standardized delivery-person rating, which is z-score of the delivery-person rating. Original data had rating in range of 2.5 and 5.0 with 0.1 quantization.
Figure 1.
Histograms of data used in inference. Standardization was computed as z-score. X-axis represents value of the predictor and Y-axis is their count for predefined bins. (top-left) Standardized distance, which is z-score of distance data received from OSRM API. Raw distances were limited to 30 km. (top-right) Standardized meal-preparation time, which is z-score of meal-preparation time. Meal-preparation time was calculated as difference between time the order was received and the time when courier picked up delivery. (center-left) Categories of road traffic, which are raw categorical data describing traffic conditions during each delivery. It can be one of four states: low, medium, high, and jam. (center-right) Distinct deliveries count, which describes number of deliveries that courier had to make during his trip. (botom-left) Standardized delivery-person rating, which is z-score of the delivery-person rating. Original data had rating in range of 2.5 and 5.0 with 0.1 quantization.
![Electronics 13 03418 g001]()
Figure 2.
Sampling check for prior distributions of Model 1’s link-function parameters (parameters with _coeff suffix). X-axis represents coefficient values and Y-axis represents sample count. Each of the coefficients follows its distribution, which is necessary for prior check to be successful. (top-left) Prior distribution of distance coefficient, defined as . (top-right) Prior distribution of meal-preparation-time coefficient, defined as . (bottom-left) Prior distribution of parameter, defined as . parameter represents our belief of what mean delivery time should be in case all other parameters are 0. (bottom-right) Joint plot of prior distributions of traffic-level coefficients, all defined as .
Figure 2.
Sampling check for prior distributions of Model 1’s link-function parameters (parameters with _coeff suffix). X-axis represents coefficient values and Y-axis represents sample count. Each of the coefficients follows its distribution, which is necessary for prior check to be successful. (top-left) Prior distribution of distance coefficient, defined as . (top-right) Prior distribution of meal-preparation-time coefficient, defined as . (bottom-left) Prior distribution of parameter, defined as . parameter represents our belief of what mean delivery time should be in case all other parameters are 0. (bottom-right) Joint plot of prior distributions of traffic-level coefficients, all defined as .
Figure 3.
Computation and sample check of Model 1’s likelihood parameters. X-axis is time in min and Y-axis represents sample count. (left) Computed represents mean delivery time for each sample. HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 4.4 to 47 min. Mean of this distribution (at the top of the plot) is 23 min, which is reasonable value. (right) Prior distribution of standard deviation of the model, defined as .
Figure 3.
Computation and sample check of Model 1’s likelihood parameters. X-axis is time in min and Y-axis represents sample count. (left) Computed represents mean delivery time for each sample. HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 4.4 to 47 min. Mean of this distribution (at the top of the plot) is 23 min, which is reasonable value. (right) Prior distribution of standard deviation of the model, defined as .
Figure 4.
Prior predictive checks—Model 1. (left) HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 3.2 to 47 min, which is broad range. Mean of this distribution (at the top of the plot) is 23 min, which is reasonable value. (right) Real and simulated data overlay. Both are normalized so that integral of the graph is 1. It was necessary for comparison. Measured data are included within generated data, which means that all observations are possible within prior model. This means that prior checks are successful.
Figure 4.
Prior predictive checks—Model 1. (left) HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 3.2 to 47 min, which is broad range. Mean of this distribution (at the top of the plot) is 23 min, which is reasonable value. (right) Real and simulated data overlay. Both are normalized so that integral of the graph is 1. It was necessary for comparison. Measured data are included within generated data, which means that all observations are possible within prior model. This means that prior checks are successful.
Figure 5.
Sampling check for prior distributions of Model 2’s link-function parameters (parameters with _coeff suffix). X-axis represents coefficient values and Y-axis represents sample count. Each of the coefficients follows its distribution, which is necessary for prior check to be successful. (top-left) Prior distribution of distance coefficient, defined as . (top-right) Prior distribution of meal-preparation-time coefficient, defined as . (center-left) Prior distribution of parameter, defined as . parameter represents our belief of what mean delivery time should be in case all other parameters are 0. (center-right) Joint plot of prior distributions of traffic-level coefficients, all defined as . (bottom-left) Prior distribution of delivery-person-rating coefficient, defined as . (bottom-right) Joint plot of prior distributions of deliveries-number coefficients, all defined as .
Figure 5.
Sampling check for prior distributions of Model 2’s link-function parameters (parameters with _coeff suffix). X-axis represents coefficient values and Y-axis represents sample count. Each of the coefficients follows its distribution, which is necessary for prior check to be successful. (top-left) Prior distribution of distance coefficient, defined as . (top-right) Prior distribution of meal-preparation-time coefficient, defined as . (center-left) Prior distribution of parameter, defined as . parameter represents our belief of what mean delivery time should be in case all other parameters are 0. (center-right) Joint plot of prior distributions of traffic-level coefficients, all defined as . (bottom-left) Prior distribution of delivery-person-rating coefficient, defined as . (bottom-right) Joint plot of prior distributions of deliveries-number coefficients, all defined as .
![Electronics 13 03418 g005]()
Figure 6.
Computation and sample check of Model 2’s likelihood parameters. X-axis is time in min and Y-axis is sample count. (left) Computed represents mean delivery time for each sample. HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 2.3 to 57 min. Mean of this distribution (at the top of the plot) is 26 min, more than for Model 1, but still within reasonable range. (right) Prior distribution of standard deviation of the model, defined as .
Figure 6.
Computation and sample check of Model 2’s likelihood parameters. X-axis is time in min and Y-axis is sample count. (left) Computed represents mean delivery time for each sample. HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 2.3 to 57 min. Mean of this distribution (at the top of the plot) is 26 min, more than for Model 1, but still within reasonable range. (right) Prior distribution of standard deviation of the model, defined as .
Figure 7.
Prior predictive checks—Model 2. (left) HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 1.3 to 58 min. It is very broad, improbable range, but for prior checks it is sufficient. Mean of this distribution (at the top of the plot) is 26 min, which is reasonable value. (right) Real and simulated data overlay. Both are normalized so that integral of the graph is 1. It was necessary for comparison. Measured data are included within generated data, which means that all observations are possible within prior model. This means that prior checks are successful.
Figure 7.
Prior predictive checks—Model 2. (left) HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 1.3 to 58 min. It is very broad, improbable range, but for prior checks it is sufficient. Mean of this distribution (at the top of the plot) is 26 min, which is reasonable value. (right) Real and simulated data overlay. Both are normalized so that integral of the graph is 1. It was necessary for comparison. Measured data are included within generated data, which means that all observations are possible within prior model. This means that prior checks are successful.
Figure 8.
Posterior predictive checks—Model 1. (left) HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 11 to 46 min. It is broad range, but realistic nevertheless. Mean of this distribution (at the top of the plot) is 27 min, which is reasonable value. It follows inverse gamma distribution as defined. (right) Real and simulated data overlay. Both are normalized so that integral of the graph is 1. It was necessary for comparison. Measured data have high overlap with sampled data from posterior distribution.
Figure 8.
Posterior predictive checks—Model 1. (left) HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 11 to 46 min. It is broad range, but realistic nevertheless. Mean of this distribution (at the top of the plot) is 27 min, which is reasonable value. It follows inverse gamma distribution as defined. (right) Real and simulated data overlay. Both are normalized so that integral of the graph is 1. It was necessary for comparison. Measured data have high overlap with sampled data from posterior distribution.
Figure 9.
Sampling check for posterior distributions of Model 1’s link-function parameters. X-axis represents coefficient values and Y-axis represents sample count. (top-left) Posterior distribution of distance coefficient. It is much narrower than prior distribution, but still follows normal distribution. Positive value indicates that it has impact on the output variable. (top-right) Posterior distribution of meal-preparation-time coefficient. Conclusions are the same as for the distance coefficient. (bottom-left) Posterior distribution of parameter. It has mean closer to 3.1, which more likely represents mean of the dataset. (bottom-right) Joint plot of posterior distributions of traffic-level coefficients. The bigger the traffic level, the more impact it has on the outcome variable. Jams and high levels have the same impact.
Figure 9.
Sampling check for posterior distributions of Model 1’s link-function parameters. X-axis represents coefficient values and Y-axis represents sample count. (top-left) Posterior distribution of distance coefficient. It is much narrower than prior distribution, but still follows normal distribution. Positive value indicates that it has impact on the output variable. (top-right) Posterior distribution of meal-preparation-time coefficient. Conclusions are the same as for the distance coefficient. (bottom-left) Posterior distribution of parameter. It has mean closer to 3.1, which more likely represents mean of the dataset. (bottom-right) Joint plot of posterior distributions of traffic-level coefficients. The bigger the traffic level, the more impact it has on the outcome variable. Jams and high levels have the same impact.
Figure 10.
Computation and sample check of Model 1’s likelihood parameters. X-axis represents coefficient values and Y-axis represents sample count. (left) Computed represents mean delivery time for each sample. HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 21 to 32 min. Those are much more realistic values than the ones from prior distribution. Mean of this distribution (at the top of the plot) is 27 min, a reasonable value. (right) Posterior distribution of standard deviation of the model; it no longer resembles prior, and now it follows normal distribution with mean ≈9.5.
Figure 10.
Computation and sample check of Model 1’s likelihood parameters. X-axis represents coefficient values and Y-axis represents sample count. (left) Computed represents mean delivery time for each sample. HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 21 to 32 min. Those are much more realistic values than the ones from prior distribution. Mean of this distribution (at the top of the plot) is 27 min, a reasonable value. (right) Posterior distribution of standard deviation of the model; it no longer resembles prior, and now it follows normal distribution with mean ≈9.5.
Figure 11.
Computation and sample check of Model 2’s likelihood parameters. X-axis represents coefficient values and Y-axis represents sample count. (left) Computed represents mean delivery time for each sample. HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 19 to 37 min. Those are much more realistic values than the ones from prior distribution. Mean of this distribution (at the top of the plot) is 27 min, a reasonable value. (right) Posterior distribution of standard deviation of the model; it no longer resembles prior, and now it follows normal distribution with mean ≈7.85.
Figure 11.
Computation and sample check of Model 2’s likelihood parameters. X-axis represents coefficient values and Y-axis represents sample count. (left) Computed represents mean delivery time for each sample. HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 19 to 37 min. Those are much more realistic values than the ones from prior distribution. Mean of this distribution (at the top of the plot) is 27 min, a reasonable value. (right) Posterior distribution of standard deviation of the model; it no longer resembles prior, and now it follows normal distribution with mean ≈7.85.
Figure 12.
Sampling check for posterior distributions of Model 2’s link-function parameters. X-axis represents coefficient values and Y-axis represents sample count. (top-left) Posterior distribution of distance coefficient. It is much narrower than prior distribution, but still follows normal distribution. Positive value indicates that it has impact on the output variable. (top-right) Posterior distribution of meal-preparation-time coefficient. Conclusions are the same as for the distance coefficient. (center-left) Posterior distribution of parameter. It has mean closer to 3.1, which more likely represents mean of the dataset. (center-right) Joint plot of posterior distributions of the traffic-level coefficients. The bigger the traffic level, the more impact it has on the outcome variable. Jams and high levels have the same impact. (bottom-left) Posterior distribution of the delivery-person-rating coefficient. It is much narrower than prior distribution, but still follows normal distribution. Negative values indicate inverse relationship between delivery time and rating; the bigger the courier rating, the faster delivery will be made. (bottom-right) Joint plot of posterior distributions of deliveries-number coefficients. The more deliveries, the more impact it has on the outcome variable. This is the same trend as for the traffic level, but greater range translates to greater impact.
Figure 12.
Sampling check for posterior distributions of Model 2’s link-function parameters. X-axis represents coefficient values and Y-axis represents sample count. (top-left) Posterior distribution of distance coefficient. It is much narrower than prior distribution, but still follows normal distribution. Positive value indicates that it has impact on the output variable. (top-right) Posterior distribution of meal-preparation-time coefficient. Conclusions are the same as for the distance coefficient. (center-left) Posterior distribution of parameter. It has mean closer to 3.1, which more likely represents mean of the dataset. (center-right) Joint plot of posterior distributions of the traffic-level coefficients. The bigger the traffic level, the more impact it has on the outcome variable. Jams and high levels have the same impact. (bottom-left) Posterior distribution of the delivery-person-rating coefficient. It is much narrower than prior distribution, but still follows normal distribution. Negative values indicate inverse relationship between delivery time and rating; the bigger the courier rating, the faster delivery will be made. (bottom-right) Joint plot of posterior distributions of deliveries-number coefficients. The more deliveries, the more impact it has on the outcome variable. This is the same trend as for the traffic level, but greater range translates to greater impact.
![Electronics 13 03418 g012]()
Figure 13.
Posterior predictive checks—Model 2. (left) HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 12 to 45 min. It is slightly narrower than Model 1 range, but realistic nevertheless. Mean of this distribution (at the top of the plot) is 27 min, which is reasonable value. It follows inverse gamma distribution as defined. (right) Real and simulated data overlay. Both are normalized so that integral of the graph is 1. It was necessary for comparison. Measured data have high overlap with sampled data from posterior distribution. Generated data have shorter tail than Model 1, which is desirable.
Figure 13.
Posterior predictive checks—Model 2. (left) HDI 94% is represented as black bar at the bottom of the plot and tells us that 94% of shown mean times fall in range of 12 to 45 min. It is slightly narrower than Model 1 range, but realistic nevertheless. Mean of this distribution (at the top of the plot) is 27 min, which is reasonable value. It follows inverse gamma distribution as defined. (right) Real and simulated data overlay. Both are normalized so that integral of the graph is 1. It was necessary for comparison. Measured data have high overlap with sampled data from posterior distribution. Generated data have shorter tail than Model 1, which is desirable.
Figure 14.
Comparison plot for WAIC. Black dots indicate ELPD of each model with their standard error (black lines). Grey triangle represents standard error of difference in ELPD between Model 1 and top-ranked Model 2. Plot indicates that Model 2 performs better with a dashed line.
Figure 14.
Comparison plot for WAIC. Black dots indicate ELPD of each model with their standard error (black lines). Grey triangle represents standard error of difference in ELPD between Model 1 and top-ranked Model 2. Plot indicates that Model 2 performs better with a dashed line.
Figure 15.
Comparison plot for PSIS-LOO criterion. Black dots indicate ELPD of each model with their standard error (black lines). Grey triangle represents standard error of difference in ELPD between Model 1 and top-ranked Model 2. Plot indicates that Model 2 performs better with a dashed line.
Figure 15.
Comparison plot for PSIS-LOO criterion. Black dots indicate ELPD of each model with their standard error (black lines). Grey triangle represents standard error of difference in ELPD between Model 1 and top-ranked Model 2. Plot indicates that Model 2 performs better with a dashed line.
Table 1.
Features computed from dataset.
Table 1.
Features computed from dataset.
Model Variable | Data Type | Description | Obtained From |
---|
distance | Vector of floats | Standardized 1 route distances. | Computed via OSRM API [26]. |
traffic_level | Array of integers | Mapping categorical traffic level to number (1—jam, 2—high, 3—medium, 4—low). | Provided in raw dataset. |
meal_preparation_time | Vector of floats | Standardized 1 meal-preparation times. | Difference between order date and pickup by the courier, both of which were in raw data. |
delivery_person_rating | Vector of floats | Standardized 1 rating of delivery person. | Provided in raw dataset. |
number_of_deliveries | Array of integers | Number of deliveries. | Provided in raw dataset. |
Table 2.
Models’ variables.
Table 2.
Models’ variables.
Model Variable | Explanation |
---|
| Posterior distribution of delivery time, defined by inverse gamma distribution. |
| Shape parameter of inverse gamma function, computed from mean and standard deviation of this distribution. |
| Scale parameter of inverse gamma function, computed from mean and standard deviation of this distribution. |
| Prior distribution of standard deviation of model, defined by exponential distribution. |
| Generalized linear model with logarithmic link function. Represents mean of the delivery times as a function of selected predictors. |
| Prior distribution of the average meal-delivery scenario. Defined by normal distribution. Acts as an intercept to linear model, since after z-score standardization, the most average case of delivery would yield exp(0), which would invalidate model. |
| Prior distribution of the distance’s linear coefficient. Defined by normal distribution. Used to represent influence of this predictor on the model output. |
| Prior distribution of the meal-preparation time’s linear coefficient. Defined by normal distribution. Used to represent influence of this predictor on the model output. |
1 | Prior distributions of the traffic level’s linear coefficient. Defined by normal distributions. Used to represent influence of these predictors on the model output. |
| Prior distribution of the delivery person’s rating’s linear coefficient. Defined by normal distribution. Used to represent influence of this predictor on the model output. |
1 | Prior distributions of the delivery number’s linear coefficient. Defined by normal distributions. Used to represent influence of these predictors on the model output. |
Table 3.
Comparison results with WAIC.
Table 3.
Comparison results with WAIC.
Model | Rank | waic | p_waic | d_waic | Weight | SE | dSE |
---|
2 | 0 | −117,249.732164 | 14.307179 | 0.000000 | 0.997408 | 145.013769 | 0.000000 |
1 | 1 | −122,442.256308 | 9.314501 | 5192.524145 | 0.002592 | 137.412164 | 88.510163 |
Table 4.
Comparison result with PSIS-LOO criterion.
Table 4.
Comparison result with PSIS-LOO criterion.
Model | Rank | loo | p_loo | d_loo | Weight | SE | dSE |
---|
2 | 0 | −117,249.732784 | 14.307799 | 0.000000 | 0.997408 | 145.013813 | 0.000000 |
1 | 1 | −122,442.256329 | 9.314522 | 5192.523545 | 0.002592 | 137.412164 | 88.510227 |