{"id":"best_lag_pearson_r","title":"EchoTime reference: best-lag Pearson","family":"native","definition":"echotime","intro_en":"The native best-lag reference scans a bounded set of shifts on the report's resampled grid. Pearson correlation is recomputed on each actual overlap, including a separate overlap mean and norm. The animation uses a delayed illustrative series to show the improvement from lag zero to the selected lag while keeping the finite search window explicit.","intro_zh":"原生最佳滞后参照在报告重采样网格上扫描有限平移。每个实际重叠片段重新计算 Pearson 相关，使用各自均值和范数。动画以延迟序列展示零滞后到最佳滞后的变化，并明确有限搜索窗口。","steps_en":["Resample both inputs; derive the native maximum lag from n_points.","At every admitted lag, take the actual overlap.","Recompute centered Pearson correlation on each overlap.","Return the maximum signed coefficient and interpret its lag in resampled points."],"steps_zh":["重采样两侧输入，按 n_points 得到原生最大滞后。","对每个允许滞后取实际重叠。","在各重叠片段重新计算中心化 Pearson 相关。","返回最大带符号系数，滞后单位为重采样点。"],"formula":"max_{|lag|<=max(1,min(24,n//10))} corr(x_overlap,y_overlap)","caveats_en":["The selected lag is measured on the normalized/resampled axis, not automatically in physical time.","Searching several lags changes the interpretation from a prespecified single correlation.","Overlap-specific centering differs from full-norm normalized cross-correlation."],"caveats_zh":["所选滞后以归一化重采样轴为单位，不能自动解释为实际时间。","搜索多个滞后与事先指定单个相关的统计解释不同。","逐重叠去均值与全范数归一化互相关不同。"],"sources":[{"label":"EchoTime comparison implementation","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/similarity.py"}],"x":[0.0,0.3,0.9,1.8,2.7,2.1,1.5,1.1,1.3,2.0,2.8,3.4,3.0,2.4,2.1,2.5,3.4,4.2,4.4,4.0,3.7,3.9,4.8,5.2],"y":[0.0,0.40097651817694757,0.1091156912190818,0.31693440096718406,0.8091837005630487,1.6849290870404234,2.6664701402161293,2.178838391846255,1.6187229895948059,1.1494542182290108,1.2347174666932756,1.8800011752139156,2.7356112498399474,3.450420044419197,3.1188728826833843,2.4780345408188538,2.0654516020001923,2.3846323009744532,3.3098815303873987,4.217985265159554,4.5095534300873155,4.1003986766243266,3.698937842885152,3.7984535514989792],"input_label":"Deterministic synthetic illustration; sample index is the time axis.","parameters":{"n_points":24,"default_n_points":256,"channels":1,"preprocessing":"compare_series linear resampling followed by per-channel population z-score","demonstration_note":"24 points expose the computation; production default is 256","max_lag":2,"selected_lag":-2},"result":{"label":"similarity","value":0.9976351549045986,"detail":""},"frames":[{"phase":0,"caption":"The native lag bound is 2 at this 24-point resolution","panel":{"kind":"lines","title":"Resampled and standardized shifted inputs","a":[-1.9249938311141905,-1.7067268140429754,-1.2701927799005448,-0.6153917286868987],"a_label":"x","b":[-1.6840424457257361,-1.383467449126471,-1.6022485076013377,-1.4464660486688317],"b_label":"y"}},{"phase":0,"caption":"The native lag bound is 2 at this 24-point resolution","panel":{"kind":"lines","title":"Resampled and standardized shifted inputs","a":[-1.9249938311141905,-1.7067268140429754,-1.2701927799005448,-0.6153917286868987,0.039409322526747226,-0.3971247116156834,-0.833658745758114,-1.1246814351864012,-0.9791700904722576,-0.4698803839727553],"a_label":"x","b":[-1.6840424457257361,-1.383467449126471,-1.6022485076013377,-1.4464660486688317,-1.0774722925638294,-0.4210070018804005,0.31476351171893724,-0.05076889345619239,-0.4706355876266249,-0.8224029679178837],"b_label":"y"}},{"phase":0,"caption":"The native lag bound is 2 at this 24-point resolution","panel":{"kind":"lines","title":"Resampled and standardized shifted inputs","a":[-1.9249938311141905,-1.7067268140429754,-1.2701927799005448,-0.6153917286868987,0.039409322526747226,-0.3971247116156834,-0.833658745758114,-1.1246814351864012,-0.9791700904722576,-0.4698803839727553,0.11216499488381873,0.5486990290262495,0.2576763395979624,-0.17885769454446826,-0.3971247116156834,-0.10610202218739644,0.5486990290262495],"a_label":"x","b":[-1.6840424457257361,-1.383467449126471,-1.6022485076013377,-1.4464660486688317,-1.0774722925638294,-0.4210070018804005,0.31476351171893724,-0.05076889345619239,-0.4706355876266249,-0.8224029679178837,-0.7584889992553117,-0.274779505801729,0.3665922045424846,0.9024182224265784,0.6538879906206821,0.17351077725576292,-0.1357644790514119],"b_label":"y"}},{"phase":0,"caption":"The native lag bound is 2 at this 24-point resolution","panel":{"kind":"lines","title":"Resampled and standardized shifted inputs","a":[-1.9249938311141905,-1.7067268140429754,-1.2701927799005448,-0.6153917286868987,0.039409322526747226,-0.3971247116156834,-0.833658745758114,-1.1246814351864012,-0.9791700904722576,-0.4698803839727553,0.11216499488381873,0.5486990290262495,0.2576763395979624,-0.17885769454446826,-0.3971247116156834,-0.10610202218739644,0.5486990290262495,1.1307444078828237,1.2762557525969673,0.9852330631686801,0.7669660460974649,0.9124773908116083,1.5672784420252541,1.8583011314535414],"a_label":"x","b":[-1.6840424457257361,-1.383467449126471,-1.6022485076013377,-1.4464660486688317,-1.0774722925638294,-0.4210070018804005,0.31476351171893724,-0.05076889345619239,-0.4706355876266249,-0.8224029679178837,-0.7584889992553117,-0.274779505801729,0.3665922045424846,0.9024182224265784,0.6538879906206821,0.17351077725576292,-0.1357644790514119,0.1034957597898138,0.7970695013363016,1.4777908518829905,1.6963525287115118,1.38964706578353,1.0887090226170213,1.163306741990141],"b_label":"y"}},{"phase":1,"caption":"Lag -2: center and correlate the overlapping observations","panel":{"kind":"alignment","title":"Native overlap at lag -2","a":[-1.9249938311141905,-1.7067268140429754,-1.2701927799005448,-0.6153917286868987,0.039409322526747226,-0.3971247116156834,-0.833658745758114,-1.1246814351864012,-0.9791700904722576,-0.4698803839727553,0.11216499488381873,0.5486990290262495,0.2576763395979624,-0.17885769454446826,-0.3971247116156834,-0.10610202218739644,0.5486990290262495,1.1307444078828237,1.2762557525969673,0.9852330631686801,0.7669660460974649,0.9124773908116083,1.5672784420252541,1.8583011314535414],"b":[-1.6840424457257361,-1.383467449126471,-1.6022485076013377,-1.4464660486688317,-1.0774722925638294,-0.4210070018804005,0.31476351171893724,-0.05076889345619239,-0.4706355876266249,-0.8224029679178837,-0.7584889992553117,-0.274779505801729,0.3665922045424846,0.9024182224265784,0.6538879906206821,0.17351077725576292,-0.1357644790514119,0.1034957597898138,0.7970695013363016,1.4777908518829905,1.6963525287115118,1.38964706578353,1.0887090226170213,1.163306741990141],"pairs":[[0,2],[1,3],[2,4],[3,5],[4,6],[5,7],[6,8],[7,9],[8,10],[9,11],[10,12],[11,13],[12,14],[13,15],[14,16],[15,17],[16,18],[17,19],[18,20],[19,21],[20,22],[21,23]]},"value":0.9976351549045986,"value_label":"overlap Pearson r"},{"phase":1,"caption":"Lag -1: center and correlate the overlapping observations","panel":{"kind":"alignment","title":"Native overlap at lag -1","a":[-1.9249938311141905,-1.7067268140429754,-1.2701927799005448,-0.6153917286868987,0.039409322526747226,-0.3971247116156834,-0.833658745758114,-1.1246814351864012,-0.9791700904722576,-0.4698803839727553,0.11216499488381873,0.5486990290262495,0.2576763395979624,-0.17885769454446826,-0.3971247116156834,-0.10610202218739644,0.5486990290262495,1.1307444078828237,1.2762557525969673,0.9852330631686801,0.7669660460974649,0.9124773908116083,1.5672784420252541,1.8583011314535414],"b":[-1.6840424457257361,-1.383467449126471,-1.6022485076013377,-1.4464660486688317,-1.0774722925638294,-0.4210070018804005,0.31476351171893724,-0.05076889345619239,-0.4706355876266249,-0.8224029679178837,-0.7584889992553117,-0.274779505801729,0.3665922045424846,0.9024182224265784,0.6538879906206821,0.17351077725576292,-0.1357644790514119,0.1034957597898138,0.7970695013363016,1.4777908518829905,1.6963525287115118,1.38964706578353,1.0887090226170213,1.163306741990141],"pairs":[[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9],[9,10],[10,11],[11,12],[12,13],[13,14],[14,15],[15,16],[16,17],[17,18],[18,19],[19,20],[20,21],[21,22],[22,23]]},"value":0.8812062531279437,"value_label":"overlap Pearson r"},{"phase":1,"caption":"Lag +0: center and correlate the overlapping observations","panel":{"kind":"alignment","title":"Native overlap at lag +0","a":[-1.9249938311141905,-1.7067268140429754,-1.2701927799005448,-0.6153917286868987,0.039409322526747226,-0.3971247116156834,-0.833658745758114,-1.1246814351864012,-0.9791700904722576,-0.4698803839727553,0.11216499488381873,0.5486990290262495,0.2576763395979624,-0.17885769454446826,-0.3971247116156834,-0.10610202218739644,0.5486990290262495,1.1307444078828237,1.2762557525969673,0.9852330631686801,0.7669660460974649,0.9124773908116083,1.5672784420252541,1.8583011314535414],"b":[-1.6840424457257361,-1.383467449126471,-1.6022485076013377,-1.4464660486688317,-1.0774722925638294,-0.4210070018804005,0.31476351171893724,-0.05076889345619239,-0.4706355876266249,-0.8224029679178837,-0.7584889992553117,-0.274779505801729,0.3665922045424846,0.9024182224265784,0.6538879906206821,0.17351077725576292,-0.1357644790514119,0.1034957597898138,0.7970695013363016,1.4777908518829905,1.6963525287115118,1.38964706578353,1.0887090226170213,1.163306741990141],"pairs":[[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10],[11,11],[12,12],[13,13],[14,14],[15,15],[16,16],[17,17],[18,18],[19,19],[20,20],[21,21],[22,22],[23,23]]},"value":0.7361253901240307,"value_label":"overlap Pearson r"},{"phase":1,"caption":"Lag +1: center and correlate the overlapping observations","panel":{"kind":"alignment","title":"Native overlap at lag +1","a":[-1.9249938311141905,-1.7067268140429754,-1.2701927799005448,-0.6153917286868987,0.039409322526747226,-0.3971247116156834,-0.833658745758114,-1.1246814351864012,-0.9791700904722576,-0.4698803839727553,0.11216499488381873,0.5486990290262495,0.2576763395979624,-0.17885769454446826,-0.3971247116156834,-0.10610202218739644,0.5486990290262495,1.1307444078828237,1.2762557525969673,0.9852330631686801,0.7669660460974649,0.9124773908116083,1.5672784420252541,1.8583011314535414],"b":[-1.6840424457257361,-1.383467449126471,-1.6022485076013377,-1.4464660486688317,-1.0774722925638294,-0.4210070018804005,0.31476351171893724,-0.05076889345619239,-0.4706355876266249,-0.8224029679178837,-0.7584889992553117,-0.274779505801729,0.3665922045424846,0.9024182224265784,0.6538879906206821,0.17351077725576292,-0.1357644790514119,0.1034957597898138,0.7970695013363016,1.4777908518829905,1.6963525287115118,1.38964706578353,1.0887090226170213,1.163306741990141],"pairs":[[1,0],[2,1],[3,2],[4,3],[5,4],[6,5],[7,6],[8,7],[9,8],[10,9],[11,10],[12,11],[13,12],[14,13],[15,14],[16,15],[17,16],[18,17],[19,18],[20,19],[21,20],[22,21],[23,22]]},"value":0.610659328641149,"value_label":"overlap Pearson r"},{"phase":1,"caption":"Lag +2: center and correlate the overlapping observations","panel":{"kind":"alignment","title":"Native overlap at lag +2","a":[-1.9249938311141905,-1.7067268140429754,-1.2701927799005448,-0.6153917286868987,0.039409322526747226,-0.3971247116156834,-0.833658745758114,-1.1246814351864012,-0.9791700904722576,-0.4698803839727553,0.11216499488381873,0.5486990290262495,0.2576763395979624,-0.17885769454446826,-0.3971247116156834,-0.10610202218739644,0.5486990290262495,1.1307444078828237,1.2762557525969673,0.9852330631686801,0.7669660460974649,0.9124773908116083,1.5672784420252541,1.8583011314535414],"b":[-1.6840424457257361,-1.383467449126471,-1.6022485076013377,-1.4464660486688317,-1.0774722925638294,-0.4210070018804005,0.31476351171893724,-0.05076889345619239,-0.4706355876266249,-0.8224029679178837,-0.7584889992553117,-0.274779505801729,0.3665922045424846,0.9024182224265784,0.6538879906206821,0.17351077725576292,-0.1357644790514119,0.1034957597898138,0.7970695013363016,1.4777908518829905,1.6963525287115118,1.38964706578353,1.0887090226170213,1.163306741990141],"pairs":[[2,0],[3,1],[4,2],[5,3],[6,4],[7,5],[8,6],[9,7],[10,8],[11,9],[12,10],[13,11],[14,12],[15,13],[16,14],[17,15],[18,16],[19,17],[20,18],[21,19],[22,20],[23,21]]},"value":0.6226854589003107,"value_label":"overlap Pearson r"},{"phase":2,"caption":"Retain the largest correlation among the admitted lags","panel":{"kind":"lines","title":"Native bounded Pearson lag profile","a":[0.9976351549045986],"a_label":"Pearson r","marker":0,"x":[-2.0]},"value":0.9976351549045986,"value_label":"best correlation so far"},{"phase":2,"caption":"Retain the largest correlation among the admitted lags","panel":{"kind":"lines","title":"Native bounded Pearson lag profile","a":[0.9976351549045986,0.8812062531279437],"a_label":"Pearson r","marker":1,"x":[-2.0,-1.0]},"value":0.9976351549045986,"value_label":"best correlation so far"},{"phase":2,"caption":"Retain the largest correlation among the admitted lags","panel":{"kind":"lines","title":"Native bounded Pearson lag profile","a":[0.9976351549045986,0.8812062531279437,0.7361253901240307],"a_label":"Pearson r","marker":2,"x":[-2.0,-1.0,0.0]},"value":0.9976351549045986,"value_label":"best correlation so far"},{"phase":2,"caption":"Retain the largest correlation among the admitted lags","panel":{"kind":"lines","title":"Native bounded Pearson lag profile","a":[0.9976351549045986,0.8812062531279437,0.7361253901240307,0.610659328641149],"a_label":"Pearson r","marker":3,"x":[-2.0,-1.0,0.0,1.0]},"value":0.9976351549045986,"value_label":"best correlation so far"},{"phase":2,"caption":"Retain the largest correlation among the admitted lags","panel":{"kind":"lines","title":"Native bounded Pearson lag profile","a":[0.9976351549045986,0.8812062531279437,0.7361253901240307,0.610659328641149,0.6226854589003107],"a_label":"Pearson r","marker":4,"x":[-2.0,-1.0,0.0,1.0,2.0]},"value":0.9976351549045986,"value_label":"best correlation so far"},{"phase":3,"caption":"Return the best signed correlation; interpret lag on the resampled axis","panel":{"kind":"lines","title":"Selected native lag","a":[0.9976351549045986,0.8812062531279437,0.7361253901240307,0.610659328641149,0.6226854589003107],"a_label":"Pearson r","marker":0,"x":[-2.0,-1.0,0.0,1.0,2.0]},"value":0.9976351549045986,"value_label":"best-lag Pearson r"},{"phase":3,"caption":"Return the best signed correlation; interpret lag on the resampled axis","panel":{"kind":"lines","title":"Selected native lag","a":[0.9976351549045986,0.8812062531279437,0.7361253901240307,0.610659328641149,0.6226854589003107],"a_label":"Pearson r","marker":0,"x":[-2.0,-1.0,0.0,1.0,2.0]},"value":0.9976351549045986,"value_label":"best-lag Pearson r"},{"phase":3,"caption":"Return the best signed correlation; interpret lag on the resampled axis","panel":{"kind":"lines","title":"Selected native lag","a":[0.9976351549045986,0.8812062531279437,0.7361253901240307,0.610659328641149,0.6226854589003107],"a_label":"Pearson r","marker":0,"x":[-2.0,-1.0,0.0,1.0,2.0]},"value":0.9976351549045986,"value_label":"best-lag Pearson r"},{"phase":3,"caption":"Return the best signed correlation; interpret lag on the resampled axis","panel":{"kind":"lines","title":"Selected native lag","a":[0.9976351549045986,0.8812062531279437,0.7361253901240307,0.610659328641149,0.6226854589003107],"a_label":"Pearson r","marker":0,"x":[-2.0,-1.0,0.0,1.0,2.0]},"value":0.9976351549045986,"value_label":"best-lag Pearson r"}],"checks":{"api":"compare_series(..., n_points=24).reference_metrics['best_lag_pearson_r']","expected":0.9976351549045986,"observed":0.9976351549045986,"tolerance":1e-12},"animation_steps_en":["Fix the native lag bound from the resampled length.","Select the actual overlap at each lag.","Recompute Pearson correlation on each overlap.","Choose the largest signed correlation."],"echotime_status":"EchoTime report component / reference metric","echotime_api":"best_lag_pearson_r"}
