I have a historical information for delivered packages (send time and receive time). Also I have an information for packages in transit (send time only). For example, all of the packages in transit were sent during the last week. I need to predict the daily count of the received packages for the next days (week or month - doesn't matter). For example, 20 packages - tomorrow, 10 packages - day after tomorrow, etc.
A trivial solution is to calculate a mean delivery time for the historical data. And then add the mean duration to the send time of packages in transit. The problem is as follows. For example, some of the packages were sent 7 days ago, and the mean delivery time is 5 days. So according to the model these packages should be delivered 2 days ago. However I know they was not delivered yet. So I can set a predicted delivery time for such a packages for a tomorrow date.
Is this an adequate model? Maybe instead of a mean delivery time calculation, I should fit a PDF and then use it for prediction?
Maybe I should make an alternative model for the delayed packages? Not just set the delivery time for a tomorrow date. For example, I can calculate a maximum delivery delay for packages in transit, and then add it to send time of these packages. It seems to be better than the "tomorrow date prediction".
I don't need to predict a receive time of each package. I need to predict just a daily package count.
Could you suggest a model for such a problem? Maybe there is an existing model, if it's a well-known problem.
UPDATE:
Here is a test data and several models. Summary statistics:
Model name | RMSE | Actual count | Predicted count
----------------------------------|-----------|--------------|-----------------
Model 1 (mean delivery time) | 15.468863 | 269 | 219
Model 2 (median delivery time) | 19.989283 | 269 | 213
Model 3 (Poisson process) | 24.059450 | 269 | 247
Model 4 (Gamma distribution) | 14.043300 | 269 | 220
Model 5 (Gamma distribution mean) | 13.776274 | 269 | 216
Model 6 (conditional probability) | 13.619838 | 269 | 246
Model 1 is a trivial model from my question. Just calculate a mean delivery time and add it to send time of each mail in transit.
Model 2 is similar to Model 1. Just calculate a median instead of mean.
Model 3 is based on the answer given by @LmnICE. As I see now a mail passes several route points during delivery. I guess that delivery between neighbor points can be modelled as Poisson process. And so the distribution of delivery time is Exponential. But a total delivery time across whole delivery route should be modeled by Gamma distribution (a sum of several Exponential distributions)?
- delta14 is a delivery time in days between points 1 and 4.
- delta24 is a delivery time in days between points 2 and 4.
- delta34 is a delivery time in days between points 3 and 4.
Model 4 is based on Gamma distribution. It gives a better results than Model 3. However the interesting point is that the lower a scale parameter of the distribution the greater the quality of the model. For example the scale of 1 sec or 1 hour is much better than 1 day.
Model 5 - just calculate a mean value of Gamma distribution with scale equals 1 hour. And add the result to mail send time. It is much easier to calculate than to sum Gamma distributions. And also it seems that it gives better results than Models 1 and 4.
Model 6 is based on the answer given by @eithompson. Seems that it gives best results.