# Modeling complex temporal dependence

I'm trying to model a logistics fulfillment pipeline (eg. UPS). There are two different kinds of workers - loaders and drivers. The loaders get batches ready for the drivers to deliver. As an example, a loader might batch up 10 packages at 9am for the driver to pick up at 1pm.

I have hourly data for the past year on the number of packages ($P_i$) in the warehouse at a given hour $i$, the number of loaders ($L_i$) in that hour and the number of drivers ($D_i$) in that hour. The outcome of interest is the daily load factor ($F$) ie. what fraction of paid time are the workers actually working. Since there are complex interactions between the predictor variables ($P_i$, $L_i$ and $D_i$) over multiple hours, I built a model to predict the daily load factor instead of the hourly load factor. In other words, since a loader at 8am can get a batch ready for a driver at 1pm, it would not be appropriate to build an hourly model.

Thus the model setup is like this:

$P_1$, $P_2$.... $P_{14}$, $L_1$, $L_2$.... $L_{14}$, $D_1$, $D_2$.... $D_{14}$ -> $F_{day}$

My question is what is an appropriate model to fit to this data. In particular due to some system quirks, I would like to take into account that batches are prepared for delivery no more than 4 hours in advance ie. a loader working between 8-9am will only batch up packages for delivery between 9am-1pm. Also, it is quite clear that the ratio of the loaders to drivers at a given time is important to the load factor.

My current strategy has been to just throw the data into a boosted tree and let it figure out the interactions, but I'm wondering if there is a way to give it more intuition about the underlying process, so it does not waste degrees of freedom.

To summarize, I have the following questions:

1) Is my model setup appropriate?

2) How can I provide intuition about the underlying process to the algorithm? In particular, the ratio of loaders to drivers in relation to the number of packages and the fact that loaders will only load up packages upto 4 hours in advance.

Edit: I have the $P$s, $D$s, $L$s and $F$s for a 1 year period

• Your problem sounds like it may be suitable for a hidden markov model (HMM), but the description is not fully clear. One issue is that your time series may not resolve all changes, but the HMM framework could handle this. A more significant issue is that your data is only loosely connected to your variable of interest, and you have no ground-truth training data. A related issue is that you likely need background data to constrain rates: How long does it take to load/deliever a package? (or a truckload.) Dec 7, 2016 at 20:51
• Good points. 1) What does it mean when you say the time series may not resolve all changes? 2) I have training data for the Ps, Ds, Ls and Fs for one year across different warehouses. Almost 100k rows of data. 3) I was hoping that the package delivery time will average out over the course of the entire day (since I'm trying to predict daily load factor). Is there reason to believe that this assumption is incorrect? Dec 8, 2016 at 17:39
• For "not resolve all changes", I was not sure what causes $P$ to change. Presumable the "outflow" of $P$ from the warehouse is either when loaded or when the delivery truck departs. But is there any "inflow", e.g. due to "re-stocking"? If there is, then say at 3:00 there are 5 packages, at 3:20 three of these depart, and at 3:40 three new ones come in. So you could have $P=5$ at 3:00 and also at 4:00, but it would be wrong to infer that there was no "activity" in the hour between. Dec 8, 2016 at 18:36