Bayesian inference for a class of latent Markov models for categorical longitudinal data