Estimating treatment effects from single-arm trials via latent-variable modeling