{"id":"kendall_distance","title":"Kendall distance","family":"lock-step","definition":"reference","intro_en":"Kendall tau-b compares the ordering of every pair of aligned observations. Concordant and discordant pairs contribute with opposite signs, while one-sided ties alter the normalization. The animation exposes the pairwise sign matrix and count table. This implementation uses tau-b, so its treatment of ties is not replaced by a no-ties shortcut.","intro_zh":"Kendall tau-b 比较每对对齐观测的顺序关系。同序和逆序配对贡献相反符号，单侧并列值改变归一化。动图展示配对符号矩阵与计数表，使用含并列校正的 tau-b，不用无并列情形的简化公式替代。","steps_en":["Enumerate unordered observation pairs.","Classify each pair as concordant, discordant or tied.","Count one-sided ties separately; joint ties enter neither tie term.","Apply tau-b normalization, then 1-tau if this is the distance variant."],"steps_zh":["枚举无序观测配对。","判断同序、逆序或并列。","分别统计单侧并列；双侧并列不进入单侧并列项。","应用 tau-b 归一化；距离型再取 1−tau。"],"formula":"1 - (C-D)/sqrt((C+D+T_x)*(C+D+T_y))","caveats_en":["Ordering does not preserve the magnitude of differences.","A zero normalization denominator leaves tau undefined; the illustration avoids this case.","The animated pair enumeration is educational; optimized software need not enumerate all pairs explicitly."],"caveats_zh":["顺序关系不保留差异幅度。","归一化分母为零时 tau 未定义，本例避开此情形。","动画显式枚举配对用于教学；优化软件无需逐对枚举。"],"sources":[{"label":"SciPy: kendalltau","url":"https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kendalltau.html"}],"x":[1.0,2.0,2.0,4.0,3.0,5.0,5.0,7.0,8.0,6.0,9.0,10.0],"y":[1.0,1.8,2.2,3.4,2.7,4.1,4.1,6.4,6.1,5.5,8.0,9.2],"input_label":"Deterministic synthetic illustration; sample index is the time axis.","parameters":{"centering":true,"ranking":true,"tie_rule":"average rank or tau-b correction"},"result":{"label":"distance","value":0.0387308069336344,"detail":""},"frames":[{"phase":0,"caption":"Kendall compares ordering across pairs of observations","panel":{"kind":"scatter","title":"Paired observations","a":[1.0,2.0,2.0],"b":[1.0,1.8,2.2],"marker":2}},{"phase":0,"caption":"Kendall compares ordering across pairs of observations","panel":{"kind":"scatter","title":"Paired observations","a":[1.0,2.0,2.0,4.0,3.0,5.0],"b":[1.0,1.8,2.2,3.4,2.7,4.1],"marker":5}},{"phase":0,"caption":"Kendall compares ordering across pairs of observations","panel":{"kind":"scatter","title":"Paired observations","a":[1.0,2.0,2.0,4.0,3.0,5.0,5.0,7.0,8.0],"b":[1.0,1.8,2.2,3.4,2.7,4.1,4.1,6.4,6.1],"marker":8}},{"phase":0,"caption":"Kendall compares ordering across pairs of observations","panel":{"kind":"scatter","title":"Paired observations","a":[1.0,2.0,2.0,4.0,3.0,5.0,5.0,7.0,8.0,6.0,9.0,10.0],"b":[1.0,1.8,2.2,3.4,2.7,4.1,4.1,6.4,6.1,5.5,8.0,9.2],"marker":11}},{"phase":1,"caption":"Pair signs: +1 concordant, -1 discordant, 0 tied","panel":{"kind":"matrix","title":"Pairwise order agreement","z":[[null,1.0,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null]],"row_label":"earlier index","col_label":"later index","cursor":[0,1]}},{"phase":1,"caption":"Pair signs: +1 concordant, -1 discordant, 0 tied","panel":{"kind":"matrix","title":"Pairwise order agreement","z":[[null,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,null,1.0,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null]],"row_label":"earlier index","col_label":"later index","cursor":[2,3]}},{"phase":1,"caption":"Pair signs: +1 concordant, -1 discordant, 0 tied","panel":{"kind":"matrix","title":"Pairwise order agreement","z":[[null,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,null,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,null,null,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,null,null,null,1.0,1.0,1.0,1.0,1.0,1.0,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null],[null,null,null,null,null,null,null,null,null,null,null,null]],"row_label":"earlier index","col_label":"later index","cursor":[4,10]}},{"phase":1,"caption":"Pair signs: +1 concordant, -1 discordant, 0 tied","panel":{"kind":"matrix","title":"Pairwise order agreement","z":[[null,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,0.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,null,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,null,null,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,null,null,null,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[null,null,null,null,null,null,0.0,1.0,1.0,1.0,1.0,1.0],[null,null,null,null,null,null,null,1.0,1.0,1.0,1.0,1.0],[null,null,null,null,null,null,null,null,-1.0,1.0,1.0,1.0],[null,null,null,null,null,null,null,null,null,1.0,1.0,1.0],[null,null,null,null,null,null,null,null,null,null,1.0,1.0],[null,null,null,null,null,null,null,null,null,null,null,1.0],[null,null,null,null,null,null,null,null,null,null,null,null]],"row_label":"earlier index","col_label":"later index","cursor":[10,11]}},{"phase":2,"caption":"Count agreements, disagreements and one-sided ties","panel":{"kind":"bars","title":"Counts over examined pairs","a":[1.0,0.0,0.0,0.0],"a_label":"contribution","labels":["C","D","tie x","tie y"]}},{"phase":2,"caption":"Count agreements, disagreements and one-sided ties","panel":{"kind":"bars","title":"Counts over examined pairs","a":[10.0,0.0,0.0,0.0],"a_label":"contribution","labels":["C","D","tie x","tie y"]}},{"phase":2,"caption":"Count agreements, disagreements and one-sided ties","panel":{"kind":"bars","title":"Counts over examined pairs","a":[18.0,0.0,1.0,0.0],"a_label":"contribution","labels":["C","D","tie x","tie y"]}},{"phase":2,"caption":"Count agreements, disagreements and one-sided ties","panel":{"kind":"bars","title":"Counts over examined pairs","a":[27.0,0.0,1.0,0.0],"a_label":"contribution","labels":["C","D","tie x","tie y"]}},{"phase":2,"caption":"Count agreements, disagreements and one-sided ties","panel":{"kind":"bars","title":"Counts over examined pairs","a":[37.0,0.0,1.0,0.0],"a_label":"contribution","labels":["C","D","tie x","tie y"]}},{"phase":2,"caption":"Count agreements, disagreements and one-sided ties","panel":{"kind":"bars","title":"Counts over examined pairs","a":[45.0,0.0,1.0,0.0],"a_label":"contribution","labels":["C","D","tie x","tie y"]}},{"phase":2,"caption":"Count agreements, disagreements and one-sided ties","panel":{"kind":"bars","title":"Counts over examined pairs","a":[54.0,0.0,1.0,0.0],"a_label":"contribution","labels":["C","D","tie x","tie y"]}},{"phase":2,"caption":"Count agreements, disagreements and one-sided ties","panel":{"kind":"bars","title":"Counts over examined pairs","a":[63.0,1.0,1.0,0.0],"a_label":"contribution","labels":["C","D","tie x","tie y"]}},{"phase":3,"caption":"Return 1 - tie-adjusted tau-b","panel":{"kind":"bars","title":"Final counts used by tau-b","a":[63.0,1.0,1.0,0.0],"a_label":"contribution","marker":0,"labels":["C","D","tie x","tie y"]},"value":0.0387308069336344,"value_label":"1 - tau-b"},{"phase":3,"caption":"Return 1 - tie-adjusted tau-b","panel":{"kind":"bars","title":"Final counts used by tau-b","a":[63.0,1.0,1.0,0.0],"a_label":"contribution","marker":1,"labels":["C","D","tie x","tie y"]},"value":0.0387308069336344,"value_label":"1 - tau-b"},{"phase":3,"caption":"Return 1 - tie-adjusted tau-b","panel":{"kind":"bars","title":"Final counts used by tau-b","a":[63.0,1.0,1.0,0.0],"a_label":"contribution","marker":2,"labels":["C","D","tie x","tie y"]},"value":0.0387308069336344,"value_label":"1 - tau-b"},{"phase":3,"caption":"Return 1 - tie-adjusted tau-b","panel":{"kind":"bars","title":"Final counts used by tau-b","a":[63.0,1.0,1.0,0.0],"a_label":"contribution","marker":3,"labels":["C","D","tie x","tie y"]},"value":0.0387308069336344,"value_label":"1 - tau-b"}],"animation_steps_en":["Enumerate unordered observation pairs.","Classify concordance, discordance and ties.","Count one-sided ties separately.","Apply tau-b normalization and return 1-tau."],"echotime_status":"Conceptually covered","echotime_api":"kendall_tau"}
