Latent variable models for categorical data