Compartmental models have had great success applied to epidemiology. In the recent context of the SARS-Cov-2 (Covid 19) pandemic, interest in these models has skyrocketed. It is very attractive to be able to model the dynamics of the spread of a disease in a deterministic fashion through a few parameters and a system of Ordinary Differential Equations (ODEs). However, some of the assumptions required in the popular Susceptible-Infected-Removed (SIR) and Susceptible-Exposed-Infectious-Removed (SEIR) models are very restrictive. Additionally, in the spread of a disease there are many random factors to be considered and data tends to be extremely noisy. Hence, in dealing with SIR and SEIR models  a probabilistic approach may be advisable.

In this work we consider SIR, SEIR and extensions with time-dependent transmission rates in a Bayesian setting. Our aim is to estimate the parameters that govern the dynamics of the spread of the disease.  Time-dependent transmission rates allow to capture changes in the dynamics of a disease produced by external factors, for example confinement measures. Bayesian techniques allow us to incorporate a priori knowledge which may be available through medical studies and help us account for some of the randomness in the data. Our approach is data driven and is based on a B-spline basis representation of the time dependent transmission rate and on Hamiltonian Monte Carlo. We provide synthetic and real data examples (on SARS-Cov-2 daily incidence) and discuss advantages and limitations of our methods.