Latent Variable Modeling and Applications to Causality