# Computational Test for Conditional Independence
## 3 Simulation Setup  
The simulation study aims to evaluate the performance of CCI and compare it against some \"established\" methods. We also aim to assess and compare the two performance metrics: log loss and Kappa scores. The basic simulation setup is that we draw data from seven different multivariate distributions with four variables \(\{Z_{1},Z_{2},X,Y\}\). The dependencies between the variablesare as shown in the directed acyclic graph depicted in Figure 1, which implies the CI statement \(Y\perp\!\!\!\perp X|Z_{1},Z_{2}\Leftrightarrow X\perp\!\!\!\perp Y|Z_{1},Z_{2}\). All multivariate distributions involve non-linear relations between \(Z_{1}\) and \(Z_{2}\), made such that testing CI is not trivial. In all simulations, \(Z_{1}\) and \(Z_{2}\) are continuous variables, either normally or uniformly distributed, while both \(X\) and \(Y\) are categorical. A short non-technical description of the data-generating functions follows, and pseudocodes of the functions are found in Appendix B.  
Interaction: interactions between \(Z_{1}\) and \(Z_{2}\). \(Z_{1}\) and \(Z_{2}\) are standard normal, and \(X\) and \(Y\) are set deterministically by a series of if statements which assign values from 0 to 3, depending on the quadrant in which the coordinate (\(Z_{1}\), \(Z_{2}\)) falls into, creating an interaction between \(Z_{1}\) and \(Z_{2}\). ExpLog: Exponential and logarithmic distributions. \(Z_{1}\) and \(Z_{2}\) are standard normal. \(X\) is influenced by the exponentiation of the sum of \(Z_{1}\) and \(Z_{2}\), where the categories of \(X\) change as the sum exceeds certain thresholds. The categorization of \(Y\) is based on the logarithm of the absolute value of \(Z_{1}\) plus one, added to \(Z_{2}\), passing specific thresholds. The simulation imitates the modeling of exponential and logarithmic growth. PolyData: \(Z_{1}\) and \(Z_{2}\) are standard normal. The categorization of \(X\) is based on different polynomial combinations of \(Z_{1}\) and \(Z_{2}\). The categorization of \(Y\) similarly involves higher-degree polynomials of \(Z_{1}\) and \(Z_{2}\). TrigData: \(Z_{1}\) is uniform(\(-\pi\), \(\pi\)), while \(Z_{2}\) is standard normal. \(X\) is created based on adding \(\sin(Z_{1})\) and \(\cos(Z_{2})\), and the categorization of \(Y\) is based on subtracting \(\sin(Z_{1})\) and \(\cos(Z_{2})\). The simulation imitates the modeling of cyclic phenomena. Non-Linear: A non-linear and trigonometric simulation testing if CI testing methods are robust against complex real-world data patterns involving periods or cycles such as in time-series analysis. ComplexCategorization: A simulation that emulates data scenarios where multiple factors and their interactions influence outcomes. Multinomial: This simulation is based on multinomial regression equations, with non-linear effects from \(Z_{1}\) and \(Z_{2}\). This simulation aims to generate a data set where the influence of \(Z_{1}\) is relatively weak and, therefore, harder to test \(Y\perp\!\!\!\perp X|Z_{2}\). In all testing scenarios, we employ the XGBoost classification model from the R package xgboost [23], using default parameter settings with two exceptions: the learning rate is set to \(\eta=0.1\), and the number of boosting trees is set at \(ntrees=120\). The train-test split ratio in MCCV is set to 0.825, meaning for each iteration, a random portion of 82.5% of the data is utilized as training data. Additionally, we use the createDataPartition function from the caret package [24] to balance the class distributions within the splits. As \"feature\" variables in the XGBoost classification model we include \(Z_{1}\) and \(Z_{2}\) and their transformations: squared and cubed. We also test the conditional independence statements with the GCM test, the KCI test, and multinomial regression. The GCM test, conducted via the R package Generalised-CovarianceMeasure [25], uses default settings. The KCI test, implemented through the R package CondIndTests [26], has its Gaussian Process hyperparameter routine disabled to reduce computation time.