Bayesian latent variable models with applications