A probabilistic latent variable model for detecting structure in binary data