Measuring Conditional Independence by Independent Residuals: Theoretical Results and Application in Causal Discovery