{"id":"shift_pearson_similarity","title":"Shifted Pearson correlation","family":"sliding","definition":"reference","intro_en":"Shifted Pearson correlation evaluates Pearson r on the current overlap after each permitted integer shift, using only samples that overlap. This example admits lags from minus three to plus three samples, leaving at least seven paired observations. The animation shows the actual overlap pairs and candidate scores before selecting their maximum.","intro_zh":"Shifted Pearson correlation 在每个允许的整数平移后，仅对重叠样本计算对应分数。本例滞后范围为 −3 至 +3 个采样点，始终保留至少七对观测。动图展示实际配对和候选分数，再选择最大值。","steps_en":["Fix the permitted lags and minimum acceptable overlap before scoring.","At each lag, compute Pearson r on the current overlap on the actual paired samples.","Record every candidate score together with its lag.","Choose the maximum overlap score."],"steps_zh":["先固定允许滞后与最小可接受重叠长度。","对每个滞后的实际配对样本计算对应分数。","记录所有候选分数及其滞后。","选取最大重叠分数。"],"formula":"max_{lag=-3,...,3} corr(x_overlap,y_overlap)","caveats_en":["Each overlap is independently centered; selecting the best lag also selects among several correlations.","The bounded window is an explicit demonstration choice; allowing every possible lag changes the problem.","Overlap cropping removes unmatched endpoints from this score."],"caveats_zh":["每个重叠片段分别去均值；选取最佳滞后同时也是在多个相关结果中选择。","有界窗口是明确的演示选择；允许所有滞后会改变问题。","重叠裁剪会从分数中排除未匹配的两端。"],"sources":[{"label":"Imported registry: overlap-based shift definitions","url":"https://github.com/ZipengWu365/EchoTime/blob/main/src/echotime/data/ts_similarity_package_v2_registry.csv"},{"label":"SciPy: correlation","url":"https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.correlation.html"}],"x":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"y":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"input_label":"Deterministic synthetic illustration; sample index is the time axis.","parameters":{"lags":[-3,-2,-1,0,1,2,3],"minimum_overlap":7,"normalization":"per overlap","selected_lag":-2},"result":{"label":"similarity","value":0.9998975041135675,"detail":""},"frames":[{"phase":0,"caption":"Use the declared bounded lag window: -3 to +3 samples","panel":{"kind":"lines","title":"Original input; no hidden standardization","a":[1.0,1.1,1.8],"a_label":"x","b":[1.0,1.025244129544237,1.0272789228047705],"b_label":"y"}},{"phase":0,"caption":"Use the declared bounded lag window: -3 to +3 samples","panel":{"kind":"lines","title":"Original input; no hidden standardization","a":[1.0,1.1,1.8,3.1,2.4],"a_label":"x","b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623],"b_label":"y"}},{"phase":0,"caption":"Use the declared bounded lag window: -3 to +3 samples","panel":{"kind":"lines","title":"Original input; no hidden standardization","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8],"a_label":"x","b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323],"b_label":"y"}},{"phase":0,"caption":"Use the declared bounded lag window: -3 to +3 samples","panel":{"kind":"lines","title":"Original input; no hidden standardization","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"a_label":"x","b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"b_label":"y"}},{"phase":1,"caption":"Lag -3: Pearson r on the current overlap","panel":{"kind":"alignment","title":"Overlap correspondence at lag -3","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[0,3],[1,4],[2,5],[3,6],[4,7],[5,8],[6,9]]},"value":0.5289674187231161,"value_label":"current overlap score"},{"phase":1,"caption":"Lag -2: Pearson r on the current overlap","panel":{"kind":"alignment","title":"Overlap correspondence at lag -2","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[0,2],[1,3],[2,4],[3,5],[4,6],[5,7],[6,8],[7,9]]},"value":0.9998975041135675,"value_label":"current overlap score"},{"phase":1,"caption":"Lag -1: Pearson r on the current overlap","panel":{"kind":"alignment","title":"Overlap correspondence at lag -1","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9]]},"value":0.5676125183483129,"value_label":"current overlap score"},{"phase":1,"caption":"Lag +0: Pearson r on the current overlap","panel":{"kind":"alignment","title":"Overlap correspondence at lag +0","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[0,0],[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9]]},"value":-0.07514403479150769,"value_label":"current overlap score"},{"phase":1,"caption":"Lag +1: Pearson r on the current overlap","panel":{"kind":"alignment","title":"Overlap correspondence at lag +1","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[1,0],[2,1],[3,2],[4,3],[5,4],[6,5],[7,6],[8,7],[9,8]]},"value":-0.4873510899253901,"value_label":"current overlap score"},{"phase":1,"caption":"Lag +2: Pearson r on the current overlap","panel":{"kind":"alignment","title":"Overlap correspondence at lag +2","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[2,0],[3,1],[4,2],[5,3],[6,4],[7,5],[8,6],[9,7]]},"value":-0.6066027941092749,"value_label":"current overlap score"},{"phase":1,"caption":"Lag +3: Pearson r on the current overlap","panel":{"kind":"alignment","title":"Overlap correspondence at lag +3","a":[1.0,1.1,1.8,3.1,2.4,1.3,0.8,0.9,1.1,1.0],"b":[1.0,1.025244129544237,1.0272789228047705,1.104233600241796,1.7772959251407623,3.071232271760106,2.3916175350540323,1.3197095979615636,0.8296807473987015,0.9123635545572527],"pairs":[[3,0],[4,1],[5,2],[6,3],[7,4],[8,5],[9,6]]},"value":-0.4832026002270029,"value_label":"current overlap score"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.5289674187231161],"a_label":"overlap score","marker":0,"x":[-3.0]},"value":0.5289674187231161,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.5289674187231161,0.9998975041135675],"a_label":"overlap score","marker":1,"x":[-3.0,-2.0]},"value":0.9998975041135675,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.5289674187231161,0.9998975041135675,0.5676125183483129],"a_label":"overlap score","marker":2,"x":[-3.0,-2.0,-1.0]},"value":0.9998975041135675,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.5289674187231161,0.9998975041135675,0.5676125183483129,-0.07514403479150769],"a_label":"overlap score","marker":3,"x":[-3.0,-2.0,-1.0,0.0]},"value":0.9998975041135675,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.5289674187231161,0.9998975041135675,0.5676125183483129,-0.07514403479150769,-0.4873510899253901],"a_label":"overlap score","marker":4,"x":[-3.0,-2.0,-1.0,0.0,1.0]},"value":0.9998975041135675,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.5289674187231161,0.9998975041135675,0.5676125183483129,-0.07514403479150769,-0.4873510899253901,-0.6066027941092749],"a_label":"overlap score","marker":5,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0]},"value":0.9998975041135675,"value_label":"best candidate so far"},{"phase":2,"caption":"Compare scores only over the admitted lag window","panel":{"kind":"lines","title":"Candidate score versus lag","a":[0.5289674187231161,0.9998975041135675,0.5676125183483129,-0.07514403479150769,-0.4873510899253901,-0.6066027941092749,-0.4832026002270029],"a_label":"overlap score","marker":6,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.9998975041135675,"value_label":"best candidate so far"},{"phase":3,"caption":"Select the largest overlap similarity","panel":{"kind":"lines","title":"Complete bounded lag scan","a":[0.5289674187231161,0.9998975041135675,0.5676125183483129,-0.07514403479150769,-0.4873510899253901,-0.6066027941092749,-0.4832026002270029],"a_label":"candidate score","marker":1,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.9998975041135675,"value_label":"final result"},{"phase":3,"caption":"Select the largest overlap similarity","panel":{"kind":"lines","title":"Complete bounded lag scan","a":[0.5289674187231161,0.9998975041135675,0.5676125183483129,-0.07514403479150769,-0.4873510899253901,-0.6066027941092749,-0.4832026002270029],"a_label":"candidate score","marker":1,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.9998975041135675,"value_label":"final result"},{"phase":3,"caption":"Select the largest overlap similarity","panel":{"kind":"lines","title":"Complete bounded lag scan","a":[0.5289674187231161,0.9998975041135675,0.5676125183483129,-0.07514403479150769,-0.4873510899253901,-0.6066027941092749,-0.4832026002270029],"a_label":"candidate score","marker":1,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.9998975041135675,"value_label":"final result"},{"phase":3,"caption":"Select the largest overlap similarity","panel":{"kind":"lines","title":"Complete bounded lag scan","a":[0.5289674187231161,0.9998975041135675,0.5676125183483129,-0.07514403479150769,-0.4873510899253901,-0.6066027941092749,-0.4832026002270029],"a_label":"candidate score","marker":1,"x":[-3.0,-2.0,-1.0,0.0,1.0,2.0,3.0]},"value":0.9998975041135675,"value_label":"final result"}],"animation_steps_en":["Fix lags from -3 to +3 and retain adequate overlap.","Compute Pearson r on each actual overlap.","Record every candidate score with its lag.","Choose the maximum overlap score."],"echotime_status":"Conceptually covered","echotime_api":"best_lag_pearson_r"}
