# Determining Conditional Independence from Marginal Independence?

so if I have a 3 columns of binary variables X, Y and Z with their respective values and I would like to determine whether X,Y are conditionally independent given Z. How can I go about doing this? Also how can I incorporate marginal independence (of two variables) into this equation?

Note: format is as such

X Y Z
1 0 1
0 0 1
1 1 0
etc...


and I want to output true if x,y are conditionally independent given z and false otherwise and I can test for marginal independence if I want to...

I know that P(Y|Z) - P(Y|X,Z) = 0 is one way but how would I calculate those values from the above...

Thank you.

Symbolically, $$X \perp Y|Z \implies P(Y=1|X=1, Z=z) = P(Y=1|X=0, Z=z), \forall Z$$
c.ind = TRUE