Analysis of longitudinal data via latent Markov model and its extensions