How can I apply bayesian statistics and pymc3 on the following problem

I drafted a potential approach in this notebook. I modelled the number of visit per day with a Poisson distribution (whose sole parameter is \lambda, the average number of events [1]). Instead of modelling each day individually, we use a rolling regression. That is, we assume that the average count across days are correlated as in \lambda_t=\lambda_{t-1}+\mathcal{N}(0, \sigma). We can do that using the GaussianRandomWalk (see here and here). What you obtain is the estimated \lambda for each day (but you could tweak the model and estimate a \lambda for each meaningful period of the month). I started off with modelling only one timeseries. Then you could move on and incorporate the other one, and compare the parameters across models.

This is an idea. What I would do, however, is to integrate more predictors in your data. For example, you could define which days are workdays/weekends etc (e.g., maybe on weekends you get more visits?). Another approach is to model the timeseries in its structural components, like trend, seasonality, etc (there are many techniques for that, for example stuff like ARIMA).

1 Like