{"id":40884033,"date":"2021-12-18T11:11:53","date_gmt":"2021-12-18T05:41:53","guid":{"rendered":"https:\/\/stockviz.biz\/index.php\/?p=40884033"},"modified":"2021-12-18T11:11:58","modified_gmt":"2021-12-18T05:41:58","slug":"euclid-vs-hamming-distance","status":"publish","type":"post","link":"https:\/\/stockviz.biz\/index.php\/2021\/12\/18\/euclid-vs-hamming-distance\/","title":{"rendered":"Euclid vs. Hamming Distance"},"content":{"rendered":"\n<p>Our <a rel=\"noreferrer noopener\" href=\"https:\/\/stockviz.biz\/index.php\/2021\/12\/11\/beta-vs-hamming\/\" target=\"_blank\">previous post<\/a> explored the differences between CAPM Beta and Hamming distance. Think of Beta as a linear regression between two time-series and Hamming distance as the number of days when the direction of returns differed. The usefulness of the <a rel=\"noreferrer noopener\" href=\"https:\/\/stockviz.biz\/2020\/11\/17\/euclidean-distance-for-pattern-matching\/\" target=\"_blank\">Euclidian distance<\/a> for non-reverting timeseries is somewhere between the two.<\/p>\n\n\n\n<p>Extending the previous example using HDFC and keeping everything else the same, here&#8217;s what the Euclidian distance measure looks like.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/hamming-euclid\/HDFC-euclid.png\" alt=\"\" \/><\/figure>\n\n\n\n<p>Higher the distance, the farther apart their curves and worse the index hedge. Here&#8217;s the equity curve that can help map returns to distance.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/hamming-euclid\/HDFC-equity.png\" alt=\"\" \/><\/figure>\n\n\n\n<p>Reproducing the Beta and Hamming Distance charts:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/beta-hamming\/HDFC-beta.png\" alt=\"\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/stockviz\/blog\/master\/hamming-euclid\/HDFC-hamming.png\" alt=\"\" \/><\/figure>\n\n\n\n<p>From a linear portfolio point-of-view, which of these series is more &#8220;predictable?&#8221; Is it possible to specify bands beyond which things &#8220;break?&#8221; And does using shorter look-backs help?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Our previous post explored the differences between CAPM Beta and Hamming distance. Think of Beta as a linear regression between two time-series and Hamming distance as the number of days when the direction of returns differed. The usefulness of the Euclidian distance for non-reverting timeseries is somewhere between the two. Extending the previous example using &hellip; <\/p>\n","protected":false},"author":2,"featured_media":2106273,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3471],"tags":[2761],"class_list":["post-40884033","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-investing-insight","tag-quant","entry"],"_links":{"self":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts\/40884033","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/comments?post=40884033"}],"version-history":[{"count":0,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/posts\/40884033\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/media\/2106273"}],"wp:attachment":[{"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/media?parent=40884033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/categories?post=40884033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stockviz.biz\/index.php\/wp-json\/wp\/v2\/tags?post=40884033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}