Selecting and fitting graphical chain models to longitudinal data