Data-driven modelling of structured populations