Statistical Analysis of Behavioural Data: An Approach Based on Time-Structured Models