# Hierarchical simulation of patient waiting times in order to keep annual average below some threshold

I have a dataset about patient waiting times in a healthcare district. These data have 3 categorical variables:
- healthcare provider;
- healthcare service (eg. cardiology visit, electrocardiogram, etc...);
- urgency class (4 classes);

and for each combination of these 3 variables, I have the number of patients served and the average waiting times. I do not have single observation data, ie. waiting time per patient. I have two replication of this data, for the whole 2018 and for 4 months of 2019.

I need to predict the distribution of the waiting time for the remaining 7 months of 2019 for each provider/service/urgency combination

The aim is to decide, for each service, the maximum or the average waiting time for patient served in each of the combinations in the rest of 2019 so that the average waiting time for certain combinations, for the whole 2019, is below some specified thresholds (with a certain probability of course).

I'm new to Bayesian simulations but I thought of a model of this type (sorry if the notation is wrong).

Step 1

$$N.patients \sim Poisson(exp(\lambda))$$

$$\lambda \sim \beta_0 + \beta_1*Provider + \beta_2*Service + \beta3*U.Class + \beta_4Provider*Service*U.Class + \beta_5*Year + log(Months)$$ (this is a semplification, given that Provider, Service and U.Class are categorical, therefore the model is more complex) $$\beta_0 \sim N(0, 10);\\ \beta_n \sim Cauchy(0, 2)$$

In alternative, $$N.patients$$ can be generated from a non-linear machine learning model with bagging.

Step 2

Then, a distribution of waiting times for each patient has to be generated. I thought about an exponential distribution, or in alternative a log-normal one.

$$W.time_i \sim Exp(\eta)$$

with $$\eta$$ estimated in the same way as for $$\lambda$$ (I don't know whether to include $$N.patients$$ in this model)

A doubt is whether is it enough to generate only one $$W.time$$ per patient or a whole distribution for each...

Step 3

Here is where I'm more confused. As I said before I need to find, for the rest of 2019 the changes in waiting times so that the average waiting time in certain services for the whole 2019 is below certain thresholds.

To do this I need to make predictions for the remaining 8 months of 2019. But then I need to act on the waiting times (and maybe on the number of patients served) for each provider/service/urgency combination. One solution could be to act on $$labda$$ and $$eta$$, given realistic constraints. Another to act on the maximum waiting time per provider/service/urgency combination patients.

So summing up:
- I need help with the model;
- I need help with how to use the model to decide which strategy is more effective in bringing 2019 average waiting time below the thresholds.