# Chi-Squared Statistic to test for conditional independence

How can compute the chi-square statistic between the random variables X and Y given an evidence variable Z? I want to test if X & Y are conditionally independent given Z.

Assume all X,Y, Z are binary.

Say X = [1,1,1,0] Y is [0,1,1,0] and Z is [1,0,0,1]

if I compute the Chi-Square test between just X & Y I get χ2 =0.444

How Can I compute the Chi-Square test between X & Y when I have an evidence random variable Z ? ie How does the formula to compute chi-square statistic change ?

• Can you please add more details to your question? As it stands, it is too basic/vague for this site. – Skander H. - Reinstate Monica Apr 20 '18 at 22:03
• @Alex added some details. I want to use the chi-square test to check if two variables ( X and Y) are conditionally independent given an observation variable(Z). – Adi Apr 20 '18 at 23:58
• Look at the graduate admissions Berkeley paper for a famous example. – kjetil b halvorsen Jul 27 '19 at 13:42