Modelling dynamical systems using manifest and latent variables