Skip to main content
. 2023 Nov 28;25(12):1597. doi: 10.3390/e25121597
Algorithm 1 Search for λ* with subsequent conditional independence test
Require: Samples (X,Y,Z), Range {λl}l=1L, Significance level α, Permutation iterations P, Rejection iterations B
Initalise:  evaluationrejectionrate[λ*]=0
1: for 1lL do                              ▹Start: Search for λ*
2:       for 1bB do
3:             Permute X by cpt, call them Xb
4:             evaluationteststatistic[b]zZHSCIC(Xb,Y,Z,λl)
5:             for 1πP do
6:                   Permute Xb by cpt, call them Xb,π
7:                   evaluationnullstatistics[b,π]zZHSCIC(Xb,π,Y,Z,λl)
8:             evaluationp-value1
9:                              percentile(evaluationteststatistic[b],evaluationnullstatistics[b,:])
10:             if evaluationp-valueα then
11:                   Fail to reject H0:XbY|Z
12:                   rejects[b]=0
13:             else
14:                   Reject H0:Xb Inline graphic Y|Z
15:                   rejects[b]=1
16:       evaluationrejectionrate[λl]mean1bB(rejects)
17:       if |evaluationrejectionrate[λ*]α||evaluationrejectionrate[λl]α| then
18:               λ*λl
19: return λ*                               ▹End: Search for λ*      
   
20: teststatisticzZHSCIC(X,Y,Z,λ*)                ▹Start: Conditional independence test
21: for  1pP  do
22:       Permute X by cpt, call them Xp
23:       nullstatistics[p]zZHSCIC(Xp,Y,Z,λ*)
24: p-value1percentile(teststatistic,nullstatistics)
25: if  p-value  α  then
26:       Fail to reject H0:XY|Z
27: else
28:       Reject H0:X Inline graphic Y|Z
                                    ▹End: Conditional independence test