A nested expectation-maximization algorithm for latent class models with covariates