<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Models by Models]]></title><description><![CDATA[Explore math in the quant space and learn from a pretty face. I'm an experienced data scientist & a model for NYMMG. I've done a lot of math and been on ads, commercials and runways.]]></description><link>https://www.modelsbymodels.com</link><image><url>https://substackcdn.com/image/fetch/$s_!ewqT!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F68bdef14-d5c6-47e5-85ac-aa464ec3b246_430x430.png</url><title>Models by Models</title><link>https://www.modelsbymodels.com</link></image><generator>Substack</generator><lastBuildDate>Wed, 06 May 2026 11:36:31 GMT</lastBuildDate><atom:link href="https://www.modelsbymodels.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Sakibul Alam]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[sakibulalam@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[sakibulalam@substack.com]]></itunes:email><itunes:name><![CDATA[Sakibul Alam]]></itunes:name></itunes:owner><itunes:author><![CDATA[Sakibul Alam]]></itunes:author><googleplay:owner><![CDATA[sakibulalam@substack.com]]></googleplay:owner><googleplay:email><![CDATA[sakibulalam@substack.com]]></googleplay:email><googleplay:author><![CDATA[Sakibul Alam]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[RAG Basics: Querying earnings transcripts]]></title><description><![CDATA[Retrieval-augmented generation on an Apple earnings call]]></description><link>https://www.modelsbymodels.com/p/rag-basics-querying-earnings-transcripts</link><guid isPermaLink="false">https://www.modelsbymodels.com/p/rag-basics-querying-earnings-transcripts</guid><dc:creator><![CDATA[Sakibul Alam]]></dc:creator><pubDate>Mon, 30 Mar 2026 21:43:45 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!GI2B!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p></p><p>Let&#8217;s review a simple example of how RAG works with LLM. Apple just reported earnings, and you want to know information like &#8220;What was iPhone revenue this quarter?&#8221; The transcript is 46,000 characters. You could read the whole thing. Or you could ask an LLM.</p><p>But the LLM has never seen this transcript. It was trained months ago. It has no idea what Apple reported last week. So how do you give it the information it needs without dumping 46,000 characters into the prompt?</p><p>More broadly, how can we ask questions against some text?</p><p>That&#8217;s what RAG does. Retrieval-Augmented Generation. It sounds fancy, but the core idea is simple: find the relevant pieces of a document, hand them to the LLM, and let it answer.</p><p>The whole thing is about 100 lines of Python. No frameworks. No vector databases. No LangChain. Just the raw mechanics, step by step.</p><h2>The Source: An Earnings Call Transcript</h2><p>We&#8217;re working with Apple&#8217;s Q4 FY2025 earnings call transcript.</p><p>&#8220;Good afternoon, and welcome to the Apple Q4 Fiscal Year 2025 Earnings Conference Call. Today, Apple is proud to report $102.5 billion in revenue, up 8% from a year ago and a new September quarter record...&#8221;</p><p>It goes on for about 8,000 words. Tim Cook gives prepared remarks, the CFO walks through financials, then analysts ask questions. Typical earnings call structure. You can read the full thing on Yahoo Finance or Motley Fool.</p><p>If we paste this entire transcript into a prompt, we&#8217;re wasting tokens on irrelevant sections (the legal disclaimer, the operator instructions, the analyst chitchat). We want to find just the parts that answer our question.</p><h2>Chunking: Splitting the Document</h2><p>First, we break the transcript into smaller pieces. Each piece is roughly 500 characters, about the length of a short paragraph. When a paragraph is longer than that, we split it with some overlap so we don&#8217;t lose context at the boundaries.</p><p>For this transcript, that gives us about 100 chunks. Each one is a self-contained snippet: one might be Tim Cook talking about iPhone, another might be the CFO discussing services revenue, another might be an analyst asking about China.</p><p>The tradeoff is straightforward. Chunks too small, and you lose context. &#8220;Revenue was $49 billion&#8221; means nothing without knowing it&#8217;s about iPhone. Chunks too large, and you dilute the signal with irrelevant text. 500 characters is a reasonable middle ground for earnings calls.</p><h2>Embeddings: Turning Text into Numbers</h2><p>Now we need a way to compare our question to each chunk. Computers can&#8217;t compare sentences directly, so we convert them into numbers.</p><p>An embedding model takes a piece of text and produces a list of numbers. &#8220;iPhone set a revenue record at $49 billion&#8221; becomes something like [0.038, -0.021, 0.087, 0.015, -0.044, ...]. The model was trained so that texts about similar topics produce similar lists of numbers.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7wiu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7wiu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png 424w, https://substackcdn.com/image/fetch/$s_!7wiu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png 848w, https://substackcdn.com/image/fetch/$s_!7wiu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png 1272w, https://substackcdn.com/image/fetch/$s_!7wiu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7wiu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png" width="1456" height="404" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:404,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:82691,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/192663679?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7wiu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png 424w, https://substackcdn.com/image/fetch/$s_!7wiu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png 848w, https://substackcdn.com/image/fetch/$s_!7wiu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png 1272w, https://substackcdn.com/image/fetch/$s_!7wiu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F344ce140-79b3-4c2b-b214-e44bb5b65631_1800x500.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HhIt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HhIt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png 424w, https://substackcdn.com/image/fetch/$s_!HhIt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png 848w, https://substackcdn.com/image/fetch/$s_!HhIt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png 1272w, https://substackcdn.com/image/fetch/$s_!HhIt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HhIt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png" width="1456" height="801" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:801,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:135931,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/192663679?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HhIt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png 424w, https://substackcdn.com/image/fetch/$s_!HhIt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png 848w, https://substackcdn.com/image/fetch/$s_!HhIt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png 1272w, https://substackcdn.com/image/fetch/$s_!HhIt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c397d6d-bacb-4d8f-a4c8-72524eb25c9d_2000x1100.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>We run every chunk through the same model. Each chunk becomes a list of numbers. Our question, &#8220;What was iPhone revenue this quarter?&#8221;, also becomes a list of numbers through the same model.</p><p>The key idea: because the model was trained on enormous amounts of text, it learned to place &#8220;iPhone revenue was $49 billion&#8221; and &#8220;What was iPhone revenue?&#8221; near each other in this number space. They&#8217;re about the same topic, so their numbers are similar.</p><h2>Cosine Similarity: Measuring Closeness</h2><p>How do we measure &#8220;similar&#8221;? We use cosine similarity. Think of each list of numbers as an arrow pointing in some direction. Two arrows pointing in nearly the same direction have high cosine similarity (close to 1.0). Two arrows pointing in completely different directions have low cosine similarity (close to 0).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!N7ed!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!N7ed!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png 424w, https://substackcdn.com/image/fetch/$s_!N7ed!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png 848w, https://substackcdn.com/image/fetch/$s_!N7ed!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png 1272w, https://substackcdn.com/image/fetch/$s_!N7ed!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!N7ed!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png" width="1456" height="655" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/be01a101-8b68-449b-9145-16da0378eea9_2000x900.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:655,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:152758,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/192663679?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!N7ed!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png 424w, https://substackcdn.com/image/fetch/$s_!N7ed!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png 848w, https://substackcdn.com/image/fetch/$s_!N7ed!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png 1272w, https://substackcdn.com/image/fetch/$s_!N7ed!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbe01a101-8b68-449b-9145-16da0378eea9_2000x900.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GI2B!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GI2B!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png 424w, https://substackcdn.com/image/fetch/$s_!GI2B!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png 848w, https://substackcdn.com/image/fetch/$s_!GI2B!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png 1272w, https://substackcdn.com/image/fetch/$s_!GI2B!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GI2B!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png" width="1280" height="425" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:425,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30409,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/192663679?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GI2B!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png 424w, https://substackcdn.com/image/fetch/$s_!GI2B!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png 848w, https://substackcdn.com/image/fetch/$s_!GI2B!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png 1272w, https://substackcdn.com/image/fetch/$s_!GI2B!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb65701ea-5318-452a-99b9-fcf7342ec301_1280x425.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The math is a dot product divided by the magnitudes. For our question and the iPhone revenue chunk: multiply each pair of matching numbers, add them up, divide by the lengths. The result: 0.92. Very similar.</p><p>For a chunk about something unrelated, like the legal disclaimer, the score might be 0.15. The numbers point in different directions because the topics have nothing in common.</p><p>We compute this score between our question and every single chunk. Then we take the top 3.</p><h2>Where Similarity Gets It Wrong</h2><p>This is worth pausing on. The highest-scoring chunk is not always the one with the answer. In our case, the chunk about forward guidance (&#8221;We expect revenue to grow 10-12%&#8221;) scored higher than the chunk that actually contains &#8220;$49 billion.&#8221; Why? Because the guidance chunk mentions &#8220;revenue&#8221; and &#8220;quarter&#8221; repeatedly, the same words as our question.</p><p>Cosine similarity measures word overlap in meaning, not whether the chunk answers the question. This is a real limitation. The system finds related text, not necessarily the right text.</p><p>But it doesn&#8217;t matter too much, because we send the top 3 chunks to the LLM, not just the top 1. As long as the answer is somewhere in those 3, the LLM can find it.</p><h2>Generation: The LLM Reads and Answers</h2><p>We take the top 3 chunks and build a prompt:</p><p>Context (from the earnings call):</p><p>- &#8220;iPhone set a revenue record at $49 billion, up 6% from a year ago, with growth in most markets...&#8221;</p><p>- &#8220;Apple is proud to report $102.5 billion in revenue, up 8%...&#8221;</p><p>- &#8220;We expect December quarter revenue to grow 10-12%...&#8221;</p><p>Question: What was iPhone revenue this quarter?</p><p>Answer using only the context above.</p><p>We send this to Claude. The LLM reads all three chunks, identifies the specific fact, and produces:</p><p>&#8220;iPhone revenue was $49 billion this quarter, up 6% year over year.&#8221;</p><p>Grounded in the transcript. Not hallucinated. The LLM didn&#8217;t need to know this from training. We gave it the information at query time.</p><h2>The Full Pipeline (Animated)</h2><p>The animation below walks through every step: starting from the raw transcript, splitting into chunks, converting to numbers, computing similarity, ranking, and generating the final answer.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Up1J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Up1J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif 424w, https://substackcdn.com/image/fetch/$s_!Up1J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif 848w, https://substackcdn.com/image/fetch/$s_!Up1J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif 1272w, https://substackcdn.com/image/fetch/$s_!Up1J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Up1J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif" width="800" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4806399,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/gif&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/192663679?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Up1J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif 424w, https://substackcdn.com/image/fetch/$s_!Up1J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif 848w, https://substackcdn.com/image/fetch/$s_!Up1J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif 1272w, https://substackcdn.com/image/fetch/$s_!Up1J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11801fbe-1730-4179-932a-dde10a87a09e_800x450.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h2>Where RAG Breaks Down</h2><p>RAG is not magic. It breaks in predictable ways.</p><p>Bad chunking is the most common failure. If a chunk splits a sentence in half, the embedding model sees a fragment without context. &#8220;Revenue was&#8221; in one chunk and &#8220;$49 billion from iPhone&#8221; in another. Neither chunk alone answers the question well.</p><p>Ambiguous questions cause problems too. &#8220;How did Apple do?&#8221; could match almost everything in the transcript. The retrieval returns generic chunks about overall performance, missing the specific detail you wanted.</p><p>And sometimes the LLM ignores the context anyway. You hand it three relevant chunks and it hallucinates a number that appears nowhere in the transcript. This happens less with explicit instructions (&#8221;answer using only the context above&#8221;) but it still happens.</p><p>Production systems address these issues with re-ranking, hybrid search, and better chunking strategies. But the core loop is exactly what we built: chunk, embed, retrieve, generate.</p><p>#AI #NLP #RAG</p>]]></content:encoded></item><item><title><![CDATA[Detecting When Things Change: Bayesian Change Point Analysis ]]></title><description><![CDATA[Suppose you&#8217;re looking at count data over time: disasters per year, trades per hour, defaults per month.]]></description><link>https://www.modelsbymodels.com/p/detecting-when-things-change-bayesian</link><guid isPermaLink="false">https://www.modelsbymodels.com/p/detecting-when-things-change-bayesian</guid><dc:creator><![CDATA[Sakibul Alam]]></dc:creator><pubDate>Wed, 11 Feb 2026 02:14:42 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!GpC3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p></p><div><hr></div><p>Suppose you&#8217;re looking at count data over time: disasters per year, trades per hour, defaults per month. You suspect the rate changed at some point, but you don&#8217;t know when. How do you find the change point and quantify your uncertainty?</p><p>This is a classic problem in Bayesian statistics. We&#8217;ll walk through it using the UK Coal Mining Disasters dataset (1851-1962), which records the number of major mining disasters per year. The data shows a clear drop in disaster frequency, but when exactly did it happen?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GpC3!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GpC3!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png 424w, https://substackcdn.com/image/fetch/$s_!GpC3!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png 848w, https://substackcdn.com/image/fetch/$s_!GpC3!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png 1272w, https://substackcdn.com/image/fetch/$s_!GpC3!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GpC3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png" width="1456" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62201,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/187585741?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GpC3!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png 424w, https://substackcdn.com/image/fetch/$s_!GpC3!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png 848w, https://substackcdn.com/image/fetch/$s_!GpC3!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png 1272w, https://substackcdn.com/image/fetch/$s_!GpC3!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2e513404-5779-48aa-a6bd-38f6961ba955_1776x878.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The early years average around 3 disasters per year. The later years average closer to 1. Somewhere in between, something changed. We want to find that transition point. Naruraly in the data above we can see that but how can we be more scientific about it?</p><h1><strong>The Historical Context</strong></h1><p>Coal mining in 19th century Britain was brutal. Before regulation, mines were death traps. Children as young as five worked underground. Explosions, collapses, and gas poisonings were routine.</p><p>Reform came in waves. The Mines and Collieries Act of 1842 banned women and children under 10 from underground work. The Coal Mines Regulation Act of 1860 raised the minimum age to 12 and introduced basic safety rules. But the real turning point came with the Coal Mines Regulation Act of 1872, which required certified mine managers, mandated proper ventilation, and assigned clear legal responsibility for safety to mine owners.</p><p>Further amendments in 1887 tightened enforcement. By the 1890s, the cumulative effect of decades of legislation, union pressure, and government inspection had fundamentally changed how mines operated.</p><p>Our model should find this. If the data reflects reality, we&#8217;d expect the change point to land somewhere in the 1880s or 1890s, after the major reforms had time to take effect.</p><h1><strong>The Poisson Distribution (For Counting Events)</strong></h1><p>When you&#8217;re counting events in a fixed period, the Poisson distribution is the standard model. It has one parameter: &#955; (lambda), the average rate.</p><p>P(k events) = &#955;&#7503; &#215; e&#8315;&#955; / k!</p><p>Where:</p><ul><li><p>&#955; = average rate of events</p></li><li><p>k = number of events (0, 1, 2, ...)</p></li></ul><p>If &#955; = 3, you expect about 3 events per period. The distribution tells you the probability of seeing 0, 1, 2, 3, ... events.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZuHP!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZuHP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png 424w, https://substackcdn.com/image/fetch/$s_!ZuHP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png 848w, https://substackcdn.com/image/fetch/$s_!ZuHP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png 1272w, https://substackcdn.com/image/fetch/$s_!ZuHP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZuHP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png" width="1456" height="865" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:865,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:53055,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/187585741?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZuHP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png 424w, https://substackcdn.com/image/fetch/$s_!ZuHP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png 848w, https://substackcdn.com/image/fetch/$s_!ZuHP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png 1272w, https://substackcdn.com/image/fetch/$s_!ZuHP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9bb4c061-7950-4289-9312-d51b2f7fa207_1476x877.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p></p><p>Higher &#955; shifts probability toward larger counts. With &#955; = 1, seeing 5 events is rare. With &#955; = 5, seeing 5 events is common.</p><h1><strong>The Change Point Model</strong></h1><p>We believe the disaster rate changed at some unknown year &#964; (tau). Before &#964;, disasters follow Poisson(&#955;&#8321;). After &#964;, they follow Poisson(&#955;&#8322;).</p><p>Three unknowns:</p><ul><li><p>&#955;&#8321; = disaster rate in the early period</p></li><li><p>&#955;&#8322; = disaster rate in the late period</p></li><li><p>&#964; = the year when the rate changed</p></li></ul><p>Our goal is to estimate all three.</p><h1><strong>What Are Priors?</strong></h1><p>In Bayesian statistics, we specify what we believe about each parameter before seeing the data. This is called a prior distribution.</p><p>Think of it as answering: &#8220;If I hadn&#8217;t looked at the data yet, what values would I consider plausible?&#8221;</p><p>For &#964; (the change point): We have no idea which year the change occurred. Any year is equally likely. So we use a Uniform prior.</p><p>&#964; ~ Uniform(1851, 1962)</p><p>Every year gets equal probability: 1/112.</p><p>For &#955;&#8321; and &#955;&#8322; (the rates): We know they must be positive (can&#8217;t have negative disasters). We think smaller rates are more plausible than huge ones, but we&#8217;re not very opinionated. So we use an Exponential prior.</p><p>&#955;&#8321; ~ Exponential(mean &#8776; 1.7) &#955;&#8322; ~ Exponential(mean &#8776; 1.7)</p><h1><strong>Poisson vs Exponential: Two Different Roles</strong></h1><p>This is where things get confusing. Both distributions involve &#955;. But they serve completely different purposes.</p><p>The Poisson distribution models the actual disaster counts. Given a rate &#955;, it tells you the probability of observing 0, 1, 2, ... disasters.</p><p>The Exponential distribution is our prior belief about &#955; itself. Before seeing data, we think &#955; is probably somewhere between 0 and 5, with smaller values more likely than larger ones.</p><p>Poisson = &#8220;How many disasters happen given rate &#955;?&#8221; Exponential = &#8220;What rates &#955; do we think are plausible before seeing data?&#8221;</p><p>The Exponential is not claiming disasters follow an exponential process. It&#8217;s just a way to express uncertainty about the rate parameter.</p><h1><strong>How the Model Finds the Answer</strong></h1><p>The model tests thousands of (&#964;, &#955;&#8321;, &#955;&#8322;) combinations. Combinations with high likelihood get kept more often. Combinations with low likelihood get rejected.</p><p>After sampling:</p><ul><li><p>&#964; clusters around 1890</p></li><li><p>&#955;&#8321; clusters around 3.1 disasters/year</p></li><li><p>&#955;&#8322; clusters around 0.9 disasters/year</p></li></ul><p>The prior for &#964; was Uniform (all years equally likely). The posterior for &#964; is concentrated around 1890. The data transformed our belief.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HoYD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HoYD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png 424w, https://substackcdn.com/image/fetch/$s_!HoYD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png 848w, https://substackcdn.com/image/fetch/$s_!HoYD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png 1272w, https://substackcdn.com/image/fetch/$s_!HoYD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HoYD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png" width="1456" height="866" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:866,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54642,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/187585741?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HoYD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png 424w, https://substackcdn.com/image/fetch/$s_!HoYD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png 848w, https://substackcdn.com/image/fetch/$s_!HoYD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png 1272w, https://substackcdn.com/image/fetch/$s_!HoYD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe515bf16-1c8e-41d4-aee5-4e02a5142cb9_1476x878.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The posterior shows high probability mass around 1889-1891. This is our best estimate for when the change occurred, with uncertainty quantified.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cY6Z!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cY6Z!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png 424w, https://substackcdn.com/image/fetch/$s_!cY6Z!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png 848w, https://substackcdn.com/image/fetch/$s_!cY6Z!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png 1272w, https://substackcdn.com/image/fetch/$s_!cY6Z!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cY6Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png" width="1456" height="596" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:596,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:72399,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/187585741?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cY6Z!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png 424w, https://substackcdn.com/image/fetch/$s_!cY6Z!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png 848w, https://substackcdn.com/image/fetch/$s_!cY6Z!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png 1272w, https://substackcdn.com/image/fetch/$s_!cY6Z!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19b558c0-ff0f-4060-9a2f-272927886953_1776x727.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The two rate distributions are well separated. The early period had about 3 disasters per year. The late period had about 1. Strong evidence that a real change occurred.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Nbdv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Nbdv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png 424w, https://substackcdn.com/image/fetch/$s_!Nbdv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png 848w, https://substackcdn.com/image/fetch/$s_!Nbdv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png 1272w, https://substackcdn.com/image/fetch/$s_!Nbdv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Nbdv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png" width="1456" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:78471,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/187585741?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Nbdv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png 424w, https://substackcdn.com/image/fetch/$s_!Nbdv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png 848w, https://substackcdn.com/image/fetch/$s_!Nbdv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png 1272w, https://substackcdn.com/image/fetch/$s_!Nbdv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F82f15c25-1b57-4e41-aaa8-46469b250d6a_1776x878.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The expected rate shows a clear transition. The uncertainty band captures when the switch happened.</p><h1><strong>Limitations</strong></h1><p>This model assumes exactly one change point. The data might actually have:</p><ul><li><p>No change point (constant rate)</p></li><li><p>Two or more change points</p></li><li><p>A gradual transition rather than an abrupt switch</p></li></ul><p>You could extend the model to handle multiple change points, or use model comparison techniques to decide which structure fits best. For this dataset, one change point seems reasonable based on visual inspection and historical context.</p><h1><strong>Summary</strong></h1><p>The Bayesian change point model lets you:</p><ul><li><p>Estimate when a rate changed (&#964;)</p></li><li><p>Estimate the rates before and after (&#955;&#8321;, &#955;&#8322;)</p></li><li><p>Quantify uncertainty in all estimates</p></li></ul><p>The Poisson distribution models count data. The Exponential distribution expresses prior uncertainty about the rate. Bayes&#8217; theorem combines prior beliefs with observed data to produce the posterior.</p><p>For the coal mining data, the model finds a change around 1890, with the disaster rate dropping from about 3 per year to about 1. This aligns with the historical record: the Coal Mines Regulation Acts of 1872 and 1887 had fundamentally transformed the industry by this point. The model, knowing nothing about Victorian politics, independently arrives at the same conclusion historians would.</p><div><hr></div><p></p>]]></content:encoded></item><item><title><![CDATA[Intro to Pairs Trading]]></title><description><![CDATA[Some stocks move together.]]></description><link>https://www.modelsbymodels.com/p/intro-to-pairs-trading</link><guid isPermaLink="false">https://www.modelsbymodels.com/p/intro-to-pairs-trading</guid><dc:creator><![CDATA[Sakibul Alam]]></dc:creator><pubDate>Fri, 30 Jan 2026 01:11:11 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!b3pY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p></p><p>Some stocks move together. Coca-Cola and Pepsi. Visa and Mastercard. ExxonMobil and Chevron. They&#8217;re in the same industry, face the same market conditions, and tend to rise and fall in tandem.</p><p>But sometimes they diverge. One gets ahead of the other. And when that happens, they usually snap back together.</p><p>Pairs trading exploits this. When two related stocks drift apart, you bet they&#8217;ll converge again. You short the one that got too expensive and buy the one that got too cheap. When they meet in the middle, you profit from both sides.</p><p>The strategy has been around since the 1980s, pioneered by quants at Morgan Stanley. It still works today, though the easy pairs have been arbitraged away. Finding good pairs requires some statistical machinery. That&#8217;s what this post is about.</p><h1><strong>Stationarity: The Foundation</strong></h1><p>Before we can trade pairs, we need to understand stationarity.</p><p>A stationary time series has a constant mean. It doesn&#8217;t drift up or down over time. When it deviates from the mean, it reverts back.</p><p>Stock prices are not stationary. Apple went from $1 to $200 over the decades. It doesn&#8217;t revert to any fixed level.</p><p>Stock returns are roughly stationary. They bounce around zero. Big up days are followed by normal days. Big down days are followed by normal days. Returns don&#8217;t trend forever in one direction.</p><p>If something is stationary, we can predict it will return to its mean. That&#8217;s a tradeable pattern. If something is not stationary, it can drift forever. No edge there.</p><p>We test for stationarity using the Augmented Dickey-Fuller (ADF) test. It gives us a p-value:</p><p>- p-value &lt; 0.05: The series IS stationary</p><p>- p-value &gt; 0.05: The series is NOT stationary</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!b3pY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!b3pY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png 424w, https://substackcdn.com/image/fetch/$s_!b3pY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png 848w, https://substackcdn.com/image/fetch/$s_!b3pY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png 1272w, https://substackcdn.com/image/fetch/$s_!b3pY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!b3pY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png" width="1456" height="508" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:508,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:176453,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/186258962?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!b3pY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png 424w, https://substackcdn.com/image/fetch/$s_!b3pY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png 848w, https://substackcdn.com/image/fetch/$s_!b3pY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png 1272w, https://substackcdn.com/image/fetch/$s_!b3pY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F33dde391-d388-4f51-a8ed-a46cf81d4660_2076x725.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>The left chart oscillates around zero. It&#8217;s stationary. The right chart trends upward forever. It&#8217;s not stationary.</p><h1><strong>Cointegration: Finding Pairs That Move Together</strong></h1><p>Two stocks can be correlated but not cointegrated. Correlation means they move in the same direction. Cointegration means they stay close together.</p><p>Example: Two stocks both trend upward (correlated). But one grows 20% per year and the other grows 10% per year. The gap between them keeps widening. They&#8217;re correlated, but not cointegrated. You can&#8217;t trade that divergence because it never reverts.</p><p>Two stocks are cointegrated when:</p><p>1. Each stock individually is not stationary (they both trend)</p><p>2. But their difference (the spread) IS stationary</p><p>Think of two drunk friends walking home. Each one staggers randomly. Their individual paths are unpredictable. But they&#8217;re holding onto each other, so they can never get too far apart. The distance between them stays bounded.</p><p>That&#8217;s cointegration. Each series wanders, but the spread between them reverts to a mean.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!htKS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!htKS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png 424w, https://substackcdn.com/image/fetch/$s_!htKS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png 848w, https://substackcdn.com/image/fetch/$s_!htKS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png 1272w, https://substackcdn.com/image/fetch/$s_!htKS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!htKS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png" width="1456" height="966" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1deaee29-efaf-4718-bda9-905873397419_1775x1178.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:966,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:323917,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/186258962?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!htKS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png 424w, https://substackcdn.com/image/fetch/$s_!htKS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png 848w, https://substackcdn.com/image/fetch/$s_!htKS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png 1272w, https://substackcdn.com/image/fetch/$s_!htKS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1deaee29-efaf-4718-bda9-905873397419_1775x1178.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The top chart shows two stocks that both trend upward. Neither is stationary on its own.</p><p>The bottom chart shows their spread. It bounces around a stable mean. The spread IS stationary. This pair is cointegrated.</p><h1><strong>The Trading Logic</strong></h1><p>If the spread is stationary, we can trade its mean reversion.</p><p>We measure how far the spread has deviated using the z-score:</p><p>Z-Score = (Spread - Mean) / Standard Deviation</p><p>A z-score of +2 means the spread is 2 standard deviations above its mean. Stock A is expensive relative to Stock B.</p><p>A z-score of -2 means the spread is 2 standard deviations below its mean. Stock A is cheap relative to Stock B.</p><p>The trading rules:</p><p>When z-score crosses above +1 (spread too high):</p><p>- Short Stock A (sell, expecting it to fall)</p><p>- Long Stock B (buy, expecting it to rise)</p><p>- The spread should compress</p><p>When z-score crosses below -1 (spread too low):</p><p>- Long Stock A (buy, expecting it to rise)</p><p>- Short Stock B (sell, expecting it to fall)</p><p>- The spread should expand back to normal</p><p>When z-score crosses below zero:</p><p>- Close all positions</p><p>- The spread has reverted to its mean</p><p>- Trade complete</p><p>[INSERT IMAGE: images/trading_signals.png]</p><p>The blue line is the z-score of the spread. The red and green zones show when we enter trades. We enter when z crosses the thresholds. We exit when z returns to zero.</p><p><strong># A Concrete Example</strong></p><p>Let&#8217;s trace through exactly how this works with numbers.</p><p>Say we&#8217;re trading two stocks in the same sector. From historical data, we know the spread (Stock A minus Stock B) has a mean of 50 and a standard deviation of 3.</p><p>Day 1: A = $100, B = $50. Spread = 50. Z = 0. No trade.</p><p>Day 2: A = $102, B = $50. Spread = 52. Z = 0.67. No trade.</p><p>Day 3: A = $105, B = $51. Spread = 54. Z = 1.33. Above +1. ENTER.</p><p>- Short A at $105</p><p>- Long B at $51</p><p>Day 4: A = $107, B = $51. Spread = 56. Z = 2.00.</p><p>- Unrealized P&amp;L: -1.9% (A went up, hurting our short)</p><p>Day 5-8: A starts falling back, B holds steady.</p><p>- Unrealized P&amp;L improves as our thesis plays out</p><p>Day 9: A = $100, B = $51. Spread = 49. Z = -0.33. Below zero. EXIT.</p><p>- Close short A at $100: profit = (105-100)/105 = 4.76%</p><p>- Close long B at $51: profit = (51-51)/51 = 0%</p><p>- REALIZED PROFIT = 4.76%</p><p>The key distinction: while holding (Days 4-8), we had unrealized gains and losses. The position value fluctuated. We only locked in the profit when we exited on Day 9.</p><p></p><h1>Simulated Trading:</h1><p>Here&#8217;s a visual of the flow:</p><p></p><p>The blue line tracks the z-score over time. The green shaded region marks where z &gt; +1, our entry zone for     </p><p>  betting the spread will shrink (short A, long B). The red shaded region marks where z &lt; -1, our entry zone for </p><p>  betting the spread will grow (long A, short B). The dashed line at zero is our exit. Once z crosses back to zero, we close both positions and collect our profit.   </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dRCg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dRCg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png 424w, https://substackcdn.com/image/fetch/$s_!dRCg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png 848w, https://substackcdn.com/image/fetch/$s_!dRCg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png 1272w, https://substackcdn.com/image/fetch/$s_!dRCg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dRCg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png" width="1456" height="721" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:721,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:376685,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/186258962?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dRCg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png 424w, https://substackcdn.com/image/fetch/$s_!dRCg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png 848w, https://substackcdn.com/image/fetch/$s_!dRCg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png 1272w, https://substackcdn.com/image/fetch/$s_!dRCg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb7763bd6-3ec8-40c3-a169-9ad0566a6660_2076x1028.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p>]]></content:encoded></item><item><title><![CDATA[Riding the Wave: A Simple Momentum Strategy]]></title><description><![CDATA[Using moving averages and a median threshold to capture market momentum]]></description><link>https://www.modelsbymodels.com/p/riding-the-wave-a-simple-momentum</link><guid isPermaLink="false">https://www.modelsbymodels.com/p/riding-the-wave-a-simple-momentum</guid><dc:creator><![CDATA[Sakibul Alam]]></dc:creator><pubDate>Thu, 29 Jan 2026 01:19:48 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!rVrk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Momentum strategy is a common approach to portfolio management, with loads of books behind its complexity.  </p><p>Today we build a simple momentum strategy using moving averages to gain some intution</p><h1><strong>What is Momentum?</strong></h1><p>Momentum is the tendency for recent performance to persist. Winners keep winning. Losers keep losing. </p><p>Why does this happen? A few theories:</p><p><strong> Slow information diffusion.</strong> When good news hits, not everyone reacts immediately. Some investors learn about it days or weeks later. This creates a gradual price adjustment rather than an instant jump.</p><p><strong>Herding.</strong> When a stock rises, it attracts attention. More buyers pile in. The buying pressure pushes prices higher still. Momentum feeds on itself.</p><p><strong>Underreaction: </strong>Investors anchor to old prices. When fundamentals improve, they update their expectations slowly. Prices drift upward as reality gradually sinks in.</p><p>Whatever the cause, the pattern is real. Our job is to detect it and trade it.</p><h1><strong>Measuring Momentum with Moving Averages</strong></h1><p>A simple moving average (SMA) is the average price over the last N periods:</p><p><strong>SMA&#8345; = (P&#8348;&#8331;&#8321; + P&#8348;&#8331;&#8322; + ... + P&#8348;&#8331;&#8345;) / n</strong></p><p>Where:</p><p>- P&#8348;&#8331;&#7522; = price i periods ago</p><p>- n = number of periods (window size)</p><p>Short-term SMAs react quickly to price changes. Long-term SMAs smooth out the noise and reveal the underlying trend.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rVrk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rVrk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png 424w, https://substackcdn.com/image/fetch/$s_!rVrk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png 848w, https://substackcdn.com/image/fetch/$s_!rVrk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png 1272w, https://substackcdn.com/image/fetch/$s_!rVrk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rVrk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png" width="1456" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:143844,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/186147815?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rVrk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png 424w, https://substackcdn.com/image/fetch/$s_!rVrk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png 848w, https://substackcdn.com/image/fetch/$s_!rVrk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png 1272w, https://substackcdn.com/image/fetch/$s_!rVrk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1bf87bf0-c332-4126-865a-609c0ebc13d3_1776x878.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>The green line (SMA 3) hugs the price closely and captures recent moves. The red line (SMA 12) is smoother and shows where the stock has been over the past year.</p><p>When the short-term average rises above the long-term average, momentum is positive. The stock is trending up. When the short-term average falls below the long-term average, momentum is negative. The stock is trending down.</p><h1><strong>Building the Momentum Factor</strong></h1><p>Our momentum factor is simple:</p><p><strong>Momentum Factor = SMA&#8323; &#8722; SMA&#8321;&#8322;**</strong></p><p>If this number is positive, recent prices are above the long-term trend. Bullish. If negative, recent prices are below the long-term trend. Bearish.</p><p>One critical detail: we shift the moving averages by one period. Why? To avoid look-ahead bias.</p><p>When you sit at your desk on January 31st deciding whether to buy, you do not know January&#8217;s closing price yet. You only know data through December. The shift ensures our signal uses only information that was actually available at decision time.</p><h1><strong>The Median Threshold</strong></h1><p>Now we need to convert our momentum factor into a trading signal. We use the median.</p><p><strong>**Signal Logic:**</strong></p><p>- If Factor &gt; Median &#8594; Go Long (+1)</p><p>- If Factor &lt; Median &#8594; Go Short (&#8722;1)</p><p></p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!K6fI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!K6fI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png 424w, https://substackcdn.com/image/fetch/$s_!K6fI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png 848w, https://substackcdn.com/image/fetch/$s_!K6fI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png 1272w, https://substackcdn.com/image/fetch/$s_!K6fI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!K6fI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png" width="1456" height="431" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:431,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:63602,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/186147815?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!K6fI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png 424w, https://substackcdn.com/image/fetch/$s_!K6fI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png 848w, https://substackcdn.com/image/fetch/$s_!K6fI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png 1272w, https://substackcdn.com/image/fetch/$s_!K6fI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F31de1401-c9e4-4307-9398-1fcc747cba78_2075x614.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The red dashed line marks the median. Everything to the right gets a long signal. Everything to the left gets a short signal.</p><p><strong>No look-ahead bias here either. </strong>We calculate the median using only training data (the first 70% of our sample), then apply that fixed threshold to the test data (the remaining 30%). We never peek at future information.</p><h1><strong>Putting It Together</strong></h1><p>The full strategy works like this:</p><p>1. <strong>Calculate moving averages</strong> (SMA 3 and SMA 12), shifted by one period</p><p>2. <strong>Compute momentum factor</strong> (SMA&#8323; &#8722; SMA&#8321;&#8322;)</p><p>3. <strong>Normalize</strong> using z-scores from training data</p><p>4. <strong>Generate signal</strong> based on median threshold from training data</p><p>5. <strong>Calculate profit </strong>as signal &#215; next month&#8217;s return</p><p>That last step deserves explanation. We see the momentum signal at the end of month T. We trade at the start of month T+1. We earn month T+1&#8217;s return. So profit equals last month&#8217;s signal multiplied by this month&#8217;s return.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4eog!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4eog!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png 424w, https://substackcdn.com/image/fetch/$s_!4eog!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png 848w, https://substackcdn.com/image/fetch/$s_!4eog!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png 1272w, https://substackcdn.com/image/fetch/$s_!4eog!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4eog!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png" width="1456" height="724" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:724,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:100029,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/186147815?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4eog!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png 424w, https://substackcdn.com/image/fetch/$s_!4eog!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png 848w, https://substackcdn.com/image/fetch/$s_!4eog!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png 1272w, https://substackcdn.com/image/fetch/$s_!4eog!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ff193f0-f6bd-447e-b124-6eacdbc4e6bb_1765x878.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The blue line shows our momentum strategy&#8217;s cumulative return on out-of-sample data. The gray dashed line shows a simple buy-and-hold benchmark.</p><h1><strong>What Can Go Wrong</strong></h1><p>This is a toy example, not investment advice. A few caveats:</p><p><strong>Transaction costs.</strong> We trade monthly. Each trade has costs: commissions, bid-ask spreads, market impact. These add up. A strategy that looks great on paper can turn negative after costs.</p><p><strong>Momentum crashes. </strong>Momentum works until it does not. When markets reverse sharply (like March 2009), momentum strategies get crushed. They hold yesterday&#8217;s winners, which become today&#8217;s biggest losers.</p><p><strong>Overfitting.</strong> We picked 3-month and 12-month windows. Why not 2 and 10? Or 4 and 15? With enough parameter combinations, you can find something that worked in the past purely by chance. Out-of-sample testing helps, but is not foolproof.</p><p><strong>Crowding. </strong>Momentum is well known. When everyone runs the same strategy, the edge gets arbitraged away. Signals become self-defeating.</p><h1></h1>]]></content:encoded></item><item><title><![CDATA[Portfolio Optimization Basics]]></title><description><![CDATA[You have $100,000 to invest across six ETFs.]]></description><link>https://www.modelsbymodels.com/p/portfolio-optimization-basics</link><guid isPermaLink="false">https://www.modelsbymodels.com/p/portfolio-optimization-basics</guid><dc:creator><![CDATA[Sakibul Alam]]></dc:creator><pubDate>Tue, 27 Jan 2026 02:22:25 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!cvTn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p></p><div><hr></div><p>You have $100,000 to invest across six ETFs. How do you split it?</p><p>You could go equal weight. Put $16,667 in each and call it a day. But that ignores everything we know about these assets. Some have higher expected returns. Some are less volatile. Some zig when others zag. Why not use that information?</p><p>That&#8217;s what portfolio optimization does. You feed it historical returns, and it spits out weights that balance return against risk. We&#8217;ll look at Mean-Variance optimization which aims to balance the returns and risk of a portfolio, and its sister, MVSK, which accounts for futher moments of skewness and kurtosis. </p><div><hr></div><h2><strong>The Assets</strong></h2><p>We&#8217;re using six sector ETFs:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cvTn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cvTn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png 424w, https://substackcdn.com/image/fetch/$s_!cvTn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png 848w, https://substackcdn.com/image/fetch/$s_!cvTn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png 1272w, https://substackcdn.com/image/fetch/$s_!cvTn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cvTn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png" width="1456" height="497" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:497,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:58008,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/185917639?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cvTn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png 424w, https://substackcdn.com/image/fetch/$s_!cvTn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png 848w, https://substackcdn.com/image/fetch/$s_!cvTn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png 1272w, https://substackcdn.com/image/fetch/$s_!cvTn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F40c0a8b1-e31c-4bd6-8a80-cae71999a252_1490x509.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The data covers 2018 to 2024.</p><div><hr></div><h2><strong>Correlations Matter</strong></h2><p>Before optimizing, look at how these assets move together.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tfs8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tfs8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png 424w, https://substackcdn.com/image/fetch/$s_!tfs8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png 848w, https://substackcdn.com/image/fetch/$s_!tfs8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png 1272w, https://substackcdn.com/image/fetch/$s_!tfs8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tfs8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png" width="1143" height="1028" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1028,&quot;width&quot;:1143,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:61064,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/185917639?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tfs8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png 424w, https://substackcdn.com/image/fetch/$s_!tfs8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png 848w, https://substackcdn.com/image/fetch/$s_!tfs8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png 1272w, https://substackcdn.com/image/fetch/$s_!tfs8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff32c1ed4-06aa-4bb6-b6b9-ce1c5c32965f_1143x1028.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>A correlation of 1.0 means two assets move in lockstep. No diversification benefit there. Correlation near zero means they move independently. Negative correlation means they tend to move opposite directions.</p><p>GLD (Gold) has near-zero correlations with the equity ETFs. When stocks tank, gold often holds steady or goes up. That makes it useful even if its returns are nothing special on their own.</p><p>XLE (Energy) also marches to its own beat. Oil prices respond to supply shocks and geopolitics more than general market sentiment.</p><div><hr></div><h2><strong>Mean-Variance Optimization</strong></h2><p>MV optimization maximizes a utility function that rewards returns and penalizes variance:</p><p><strong>U = &#956; - (&#955;/2)&#963;&#178;</strong></p><p>Where:</p><ul><li><p><strong>&#956;</strong> is the portfolio&#8217;s expected return (annualized)</p></li><li><p><strong>&#963;&#178;</strong> is the portfolio&#8217;s variance (how much returns bounce around)</p></li><li><p><strong>&#955;</strong> is your risk aversion. Higher values mean you hate volatility more.</p></li></ul><p>Think of &#955; as a dial. Set it to 1 and the optimizer goes aggressive, chasing returns. Set it to 10 and it gets conservative, prioritizing stability. A value around 3 is moderate.</p><p>With &#955; = 3, here&#8217;s what comes out:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sIiD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sIiD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png 424w, https://substackcdn.com/image/fetch/$s_!sIiD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png 848w, https://substackcdn.com/image/fetch/$s_!sIiD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png 1272w, https://substackcdn.com/image/fetch/$s_!sIiD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sIiD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png" width="1456" height="865" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:865,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32082,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/185917639?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sIiD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png 424w, https://substackcdn.com/image/fetch/$s_!sIiD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png 848w, https://substackcdn.com/image/fetch/$s_!sIiD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png 1272w, https://substackcdn.com/image/fetch/$s_!sIiD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F61759974-3770-449f-bef3-5ca5c81cd125_1476x877.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Heavy allocation to XLK (Technology) and GLD (Gold). XLK had strong returns in this period. GLD helps because its low correlation with everything else brings down portfolio variance without hurting returns much.</p><div><hr></div><h2><strong>The Problem with Variance</strong></h2><p>MV treats upside and downside volatility the same. A 5% gain and a 5% loss both add to variance equally.</p><p>But that&#8217;s not how people experience risk. Losses sting more than gains feel good. And real returns aren&#8217;t symmetric. Big drops happen more often than big rallies. The distribution has a fat left tail.</p><p>Two statistics capture what variance misses:</p><p><strong>Skewness</strong> measures asymmetry. You take each return&#8217;s deviation from the mean, cube it, average those cubes, and divide by standard deviation cubed.</p><ul><li><p>Positive skewness: longer right tail, occasional big gains</p></li><li><p>Negative skewness: longer left tail, occasional big losses</p></li><li><p>Zero: symmetric</p></li></ul><p>Most stocks have negative skewness. Crashes are more common than melt-ups.</p><p><strong>Kurtosis</strong> measures how fat the tails are. Same idea but raise deviations to the fourth power instead of the third. Subtract 3 so a normal distribution scores zero.</p><ul><li><p>Positive kurtosis: fat tails, extreme events happen more than you&#8217;d expect</p></li><li><p>Negative kurtosis: thin tails, extreme events are rare</p></li><li><p>Zero: normal distribution</p></li></ul><p>Most stocks have positive kurtosis. The 2008 crash and COVID&#8217;s March 2020 drop were supposedly &#8220;six sigma&#8221; events. Once in a million years stuff. Except they happen way more often than that.</p><div><hr></div><h2><strong>MVSK Optimization</strong></h2><p>MVSK extends the utility function:</p><p><strong>U = &#956; - (&#955;/2)&#963;&#178; + (&#955;&#8347;/6)S - (&#955;&#8342;/24)K</strong></p><p>Where:</p><ul><li><p><strong>S</strong> is portfolio skewness. We reward positive values (more upside surprises).</p></li><li><p><strong>K</strong> is portfolio kurtosis. We penalize positive values (fewer extreme events).</p></li><li><p><strong>&#955;&#8347;</strong> and <strong>&#955;&#8342;</strong> control how much we care about each.</p></li></ul><p>The 1/6 and 1/24 coefficients come from Taylor series math. The signs make sense: add skewness (we like it positive), subtract kurtosis (we want it low).</p><p>How do MVSK weights compare to MV?</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!84wC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!84wC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png 424w, https://substackcdn.com/image/fetch/$s_!84wC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png 848w, https://substackcdn.com/image/fetch/$s_!84wC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png 1272w, https://substackcdn.com/image/fetch/$s_!84wC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!84wC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png" width="1456" height="865" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:865,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34466,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/185917639?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!84wC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png 424w, https://substackcdn.com/image/fetch/$s_!84wC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png 848w, https://substackcdn.com/image/fetch/$s_!84wC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png 1272w, https://substackcdn.com/image/fetch/$s_!84wC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5d782dd-87c5-4756-98c6-6a748e8c531b_1476x877.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Often the differences are subtle. MVSK might shift weight toward assets with better skewness even if they&#8217;re slightly more volatile. Trading variance for better tail behavior.</p><div><hr></div><h2><strong>Out-of-Sample Test</strong></h2><p>Optimizing on historical data is easy. Does it work on data the optimizer never saw?</p><p>We trained on 2018-2021 and tested on 2021-2024. Here&#8217;s how $1 grows under each strategy:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5b8C!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5b8C!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png 424w, https://substackcdn.com/image/fetch/$s_!5b8C!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png 848w, https://substackcdn.com/image/fetch/$s_!5b8C!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png 1272w, https://substackcdn.com/image/fetch/$s_!5b8C!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5b8C!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png" width="1456" height="866" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:866,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:160359,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/185917639?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5b8C!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png 424w, https://substackcdn.com/image/fetch/$s_!5b8C!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png 848w, https://substackcdn.com/image/fetch/$s_!5b8C!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png 1272w, https://substackcdn.com/image/fetch/$s_!5b8C!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F331f06c7-efcc-4908-b23c-8a73299ffabd_1476x878.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>During calm markets, they track closely. During rough patches like late 2022, differences emerge. Neither dominates everywhere.</p><p>The return distributions:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_fIk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_fIk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png 424w, https://substackcdn.com/image/fetch/$s_!_fIk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png 848w, https://substackcdn.com/image/fetch/$s_!_fIk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png 1272w, https://substackcdn.com/image/fetch/$s_!_fIk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_fIk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png" width="1456" height="865" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:865,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32804,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/185917639?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_fIk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png 424w, https://substackcdn.com/image/fetch/$s_!_fIk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png 848w, https://substackcdn.com/image/fetch/$s_!_fIk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png 1272w, https://substackcdn.com/image/fetch/$s_!_fIk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a108ef4-acd4-44c3-a0db-ff965a1c3e8b_1476x877.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Similar centers, but different tails. That&#8217;s where MVSK focuses.</p><div><hr></div><h2><strong>How Risk Aversion Changes Everything</strong></h2><p>&#955; matters a lot. Here&#8217;s how weights shift as you crank it up:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lxzX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lxzX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png 424w, https://substackcdn.com/image/fetch/$s_!lxzX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png 848w, https://substackcdn.com/image/fetch/$s_!lxzX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png 1272w, https://substackcdn.com/image/fetch/$s_!lxzX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lxzX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png" width="1456" height="720" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:720,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:60243,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/185917639?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lxzX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png 424w, https://substackcdn.com/image/fetch/$s_!lxzX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png 848w, https://substackcdn.com/image/fetch/$s_!lxzX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png 1272w, https://substackcdn.com/image/fetch/$s_!lxzX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F45bcdfe2-179c-4c35-a5d6-6628096c94da_1776x878.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Low &#955; (aggressive): pile into XLK for returns. High &#955; (conservative): shift toward XLU and GLD for stability.</p><p>The vertical line is &#955; = 3. Balanced, not too hot, not too cold.</p><div><hr></div><h2><strong>Summary</strong></h2><p></p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ta32!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ta32!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png 424w, https://substackcdn.com/image/fetch/$s_!Ta32!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png 848w, https://substackcdn.com/image/fetch/$s_!Ta32!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png 1272w, https://substackcdn.com/image/fetch/$s_!Ta32!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ta32!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png" width="1456" height="326" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:326,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:49754,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/185917639?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ta32!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png 424w, https://substackcdn.com/image/fetch/$s_!Ta32!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png 848w, https://substackcdn.com/image/fetch/$s_!Ta32!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png 1272w, https://substackcdn.com/image/fetch/$s_!Ta32!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b67b24e-e9c6-46af-87df-1686edf521a7_1807x404.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p><strong>What to remember:</strong></p><p><strong>MV is the default for a reason.</strong> Simple, well understood, works fine when returns are roughly normal. Start here.</p><p><strong>MVSK adds tail awareness.</strong> Worried about crashes? MVSK penalizes bad skewness and fat tails. Costs you some complexity.</p><p><strong>Don&#8217;t sleep on equal weight.</strong> Zero estimation error. When your estimates are garbage (often true), equal weight beats fancy optimizers out of sample.</p><p><strong>Always test out of sample.</strong> Any optimizer looks good on its training data. Reserve a holdout period.</p><p><strong>&#955; controls the aggression.</strong> Start around 3, adjust to taste.</p><div><hr></div>]]></content:encoded></item><item><title><![CDATA[The Quant’s Vocabulary: Alpha, Beta, and Friends]]></title><description><![CDATA[Essential metrics every portfolio investor needs to know]]></description><link>https://www.modelsbymodels.com/p/the-quants-vocabulary-alpha-beta</link><guid isPermaLink="false">https://www.modelsbymodels.com/p/the-quants-vocabulary-alpha-beta</guid><dc:creator><![CDATA[Sakibul Alam]]></dc:creator><pubDate>Thu, 15 Jan 2026 21:41:47 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!_EOv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When you&#8217;re evaluating investments, you&#8217;ll hear terms like alpha, beta, and volatility thrown around constantly. Fund managers brag about their alpha. Analysts warn about high-beta stocks. But what do these actually mean? Let&#8217;s break them down.</p><h1>Returns &amp; Noise</h1><p>At its core, a return is just the percentage change in price:</p><ul><li><p>R&#8348; = (P&#8348; &#8722; P&#8348;&#8331;&#8321;) / P&#8348;&#8331;&#8321;**</p></li></ul><p>Where P&#8348; is today&#8217;s price and P&#8348;&#8331;&#8321; is yesterday&#8217;s price. If a stock goes from $100 to $102, that&#8217;s a 2% return. Simple enough.</p><p>The key insight here is that returns have two components: **signal** (the expected return) and **noise** (random fluctuations). When we look at daily stock returns, most of what we see is noise. The signal is buried in there somewhere, but extracting it is the whole game.</p><h1>Volatility</h1><p>Volatility measures how much returns bounce around. It&#8217;s the standard deviation of returns:</p><ul><li><p>&#963; = &#8730;[ &#931;(R&#7522; &#8722; R&#772;)&#178; / n ]**</p></li></ul><p>Where:</p><p>- &#963; = volatility (standard deviation)</p><p>- R&#7522; = return on day i</p><p>- R&#772; = mean return</p><p>- n = number of observations</p><p>A stock with 30% annual volatility will have wilder swings than one with 10% volatility.</p><p>We typically annualize daily volatility:</p><p>**&#963;_annual= &#963;_daily &#215; &#8730;252**</p><p>Why &#8730;252? Because variance scales linearly with time, but standard deviation scales with the square root. There are 252 trading days in a year.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_EOv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_EOv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png 424w, https://substackcdn.com/image/fetch/$s_!_EOv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png 848w, https://substackcdn.com/image/fetch/$s_!_EOv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png 1272w, https://substackcdn.com/image/fetch/$s_!_EOv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_EOv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png" width="1456" height="864" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:864,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:59318,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/184703352?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_EOv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png 424w, https://substackcdn.com/image/fetch/$s_!_EOv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png 848w, https://substackcdn.com/image/fetch/$s_!_EOv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png 1272w, https://substackcdn.com/image/fetch/$s_!_EOv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F83716a0f-f16d-437c-bfda-0d22813d160f_1476x876.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>&#8336;</p><p>Notice how the high-vol stock (red) has returns spread across a much wider range. More uncertainty, more risk. The low-vol fund (green) clusters tightly around zero.</p><p>Higher volatility means more uncertainty. If you&#8217;re saving for a house next year, a high-vol stock might keep you up at night. For a retirement account 30 years out? You can probably stomach the swings.</p><h1>Beta</h1><p>Beta tells you how much a stock moves relative to the market:</p><ul><li><p>&#946; = Cov(R&#7522;, R&#8344;) / Var(R&#8344;)**</p></li></ul><p>Where:</p><p>- &#946; = beta</p><p>- Cov(R&#7522;, R&#8344;) = covariance between stock and market returns</p><p>- Var(R&#8344;) = variance of market returns</p><p>It&#8217;s the slope of the regression line when you plot stock returns against market returns.</p><p>**&#946; = 1** means the stock moves with the market.</p><p>**&#946; &gt; 1** means the stock amplifies market moves (up more on good days, down more on bad days).</p><p>**&#946; &lt; 1** means the stock dampens market moves.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6ifo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6ifo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png 424w, https://substackcdn.com/image/fetch/$s_!6ifo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png 848w, https://substackcdn.com/image/fetch/$s_!6ifo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png 1272w, https://substackcdn.com/image/fetch/$s_!6ifo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6ifo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png" width="1456" height="647" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:647,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:438527,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/184703352?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6ifo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png 424w, https://substackcdn.com/image/fetch/$s_!6ifo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png 848w, https://substackcdn.com/image/fetch/$s_!6ifo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png 1272w, https://substackcdn.com/image/fetch/$s_!6ifo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa948e89f-4011-453d-b3ea-6993586c12b4_2075x922.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>Look at the slopes. The high-beta stock (around 1.5) moves 1.5x the market. When the market is up 1%, this stock tends to be up 1.5%. The lower-beta fund (around 0.8) has a flatter slope&#8212;it doesn&#8217;t swing as hard.</p><p>Tech stocks tend to have high betas. Utilities tend to have low betas. This isn&#8217;t good or bad&#8212;it depends on what you&#8217;re trying to achieve.</p><p>## Alpha</p><p>Alpha is the holy grail. It&#8217;s the excess return beyond what beta would predict.</p><p>The logic comes from CAPM (Capital Asset Pricing Model), which says your expected return should be:</p><p>**E(R&#7522;) = R&#42800; + &#946;&#7522; &#215; (R&#8344; &#8722; R&#42800;)**</p><p>Where:</p><p>- E(R&#7522;) = expected return of asset i</p><p>- R&#42800; = risk-free rate (Treasury bills, ~5%)</p><p>- &#946;&#7522; = beta of asset i</p><p>- R&#8344; = market return</p><p>- (R&#8344; &#8722; R&#42800;) = market risk premium</p><p>Alpha is the difference between actual and expected return:</p><p>**&#945; = R&#7522; &#8722; E(R&#7522;)**</p><p>**&#945; = R&#7522; &#8722; [R&#42800; + &#946; &#215; (R&#8344; &#8722; R&#42800;)]**</p><p>If CAPM says you should earn 10% given your beta, but you earned 12%, that 2% is your alpha. It&#8217;s the &#8220;skill&#8221; component&#8212;the value added beyond just riding the market.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cX2j!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cX2j!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png 424w, https://substackcdn.com/image/fetch/$s_!cX2j!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png 848w, https://substackcdn.com/image/fetch/$s_!cX2j!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png 1272w, https://substackcdn.com/image/fetch/$s_!cX2j!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cX2j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png" width="1456" height="965" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:965,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:89099,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://www.modelsbymodels.com/i/184703352?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cX2j!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png 424w, https://substackcdn.com/image/fetch/$s_!cX2j!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png 848w, https://substackcdn.com/image/fetch/$s_!cX2j!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png 1272w, https://substackcdn.com/image/fetch/$s_!cX2j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc6ce4ac4-6ecd-4709-bfa8-6d3d1babbcc3_1777x1178.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The blue diagonal line shows where you SHOULD be based on your beta. The colored dots show where each fund ACTUALLY landed. The dashed lines show the alpha&#8212;the gap between expected and actual.</p><p>The Good Fund (green) sits above the line with positive alpha&#8212;it&#8217;s beating expectations. The Bad Fund (red) sits below the line with negative alpha&#8212;it&#8217;s destroying value. The High Beta Stock (blue) is roughly on the line&#8212;no skill, just market exposure.</p><h1>Reality check on alpha</h1><p>Most actively managed funds have &#945; &#8776; 0% or negative after fees. Consistent &#945; of +2% annually is exceptional (top 10% of managers). Warren Buffett&#8217;s lifetime &#945; is estimated at 4-6%&#8212;that&#8217;s GOAT territory.</p><p>Index funds are often used as baselines as why pay managers that deliver poor alpha?</p><h1>Correlation</h1><p>Correlation measures how two assets move together, ranging from -1 to +1:</p><ul><li><p>&#961;(X,Y) = Cov(X,Y) / (&#963;&#8339; &#215; &#963;&#7527;)**</p></li></ul><p>Where:</p><p>- &#961; = correlation coefficient</p><p>- Cov(X,Y) = covariance between X and Y</p><p>- &#963;&#8339;, &#963;&#7527; = standard deviations of X and Y</p><p>It&#8217;s covariance normalized to always fall between -1 and +1.</p><p>**&#961; = +1** means perfect positive correlation (move together exactly).</p><p>**&#961; = 0** means no correlation (independent movements).</p><p>**&#961; = &#8722;1** means perfect negative correlation (move exactly opposite).</p><p></p><p>Tech A and Tech B are highly correlated (0.87)&#8212;makes sense, they&#8217;re in the same sector. Bonds are negatively correlated with the market (&#8722;0.80)&#8212;when stocks tank, investors flee to bonds. Gold just does its own thing (near zero correlation with everything).</p><p>This is why diversification works. If all your assets move together, you&#8217;re not actually diversified. Mix in some uncorrelated or negatively correlated assets and your portfolio&#8217;s overall volatility drops.  Summary</p><ul><li><p><strong>Volatility (&#963;)</strong></p><ul><li><p><strong>Formula:</strong> &#963; = std(R)</p></li><li><p><strong>What it tells you:</strong> How risky the asset is (how much returns fluctuate)</p></li></ul></li><li><p><strong>Beta (&#946;)</strong></p><ul><li><p><strong>Formula:</strong> &#946; = Cov(R&#7522;, R&#8344;) / Var(R&#8344;)</p></li><li><p><strong>What it tells you:</strong> How the asset moves relative to the market</p></li></ul></li><li><p><strong>Alpha (&#945;)</strong></p><ul><li><p><strong>Formula:</strong> &#945; = R&#7522; &#8722; [R&#42800; + &#946;(R&#8344; &#8722; R&#42800;)]</p></li><li><p><strong>What it tells you:</strong> Excess return beyond what beta predicts</p></li></ul></li><li><p><strong>Correlation (&#961;)</strong></p><ul><li><p><strong>Formula:</strong> &#961; = Cov(X, Y) / (&#963;&#8339; &#215; &#963;&#7527;)</p></li><li><p><strong>What it tells you:</strong> How two assets move together</p></li></ul></li></ul><p>When evaluating an investment, you want to know: What&#8217;s the expected return? What&#8217;s the risk? And how does this fit with what I already own?</p><p></p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Hey! I'm (randomly) walking here]]></title><description><![CDATA[The quintessential example used to explain random walks is to imagine a drunk person stumbling around.]]></description><link>https://www.modelsbymodels.com/p/hey-im-randomly-walking-here</link><guid isPermaLink="false">https://www.modelsbymodels.com/p/hey-im-randomly-walking-here</guid><dc:creator><![CDATA[Sakibul Alam]]></dc:creator><pubDate>Wed, 24 Apr 2024 17:58:36 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!BTE8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The quintessential example used to explain random walks is to imagine a drunk person stumbling around. To make it simple, they&#8217;ll randomly move either to the left or the right. Let&#8217;s visualize what this might look like. </p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BTE8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BTE8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png 424w, https://substackcdn.com/image/fetch/$s_!BTE8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png 848w, https://substackcdn.com/image/fetch/$s_!BTE8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png 1272w, https://substackcdn.com/image/fetch/$s_!BTE8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BTE8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png" width="633" height="434" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:434,&quot;width&quot;:633,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:44052,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BTE8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png 424w, https://substackcdn.com/image/fetch/$s_!BTE8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png 848w, https://substackcdn.com/image/fetch/$s_!BTE8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png 1272w, https://substackcdn.com/image/fetch/$s_!BTE8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc943b9ef-18ff-40bb-8bb6-1ed19f1a12f4_633x434.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>Since they&#8217;ll take random steps, we can multiple simulations of where  they might end up after 10 steps.  We can extrapolate this further over time to get the following</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!r8i5!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!r8i5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png 424w, https://substackcdn.com/image/fetch/$s_!r8i5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png 848w, https://substackcdn.com/image/fetch/$s_!r8i5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png 1272w, https://substackcdn.com/image/fetch/$s_!r8i5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!r8i5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png" width="869" height="388" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:388,&quot;width&quot;:869,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54950,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!r8i5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png 424w, https://substackcdn.com/image/fetch/$s_!r8i5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png 848w, https://substackcdn.com/image/fetch/$s_!r8i5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png 1272w, https://substackcdn.com/image/fetch/$s_!r8i5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F459466a3-33c2-4991-bd90-9cf895fb0b97_869x388.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This isn&#8217;t telling us much. We just have a person just stumbling around and we&#8217;re just guesttimating their position. However, the key idea is that each step is independent. The step the person at step 100 is irrelevant to any position or step they made prior to to that. Hence the randomness. We can draw a parallel to modeling stock prices, where the stock price of tomorrow is independent of the stock price today. It&#8217;s just randomness that impacts the price. </p><h2>Statistical Properties</h2><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!BNmg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!BNmg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png 424w, https://substackcdn.com/image/fetch/$s_!BNmg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png 848w, https://substackcdn.com/image/fetch/$s_!BNmg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png 1272w, https://substackcdn.com/image/fetch/$s_!BNmg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!BNmg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png" width="160" height="47" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/703d67a8-59d9-4237-bf32-c32067632126_160x47.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:47,&quot;width&quot;:160,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:3670,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!BNmg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png 424w, https://substackcdn.com/image/fetch/$s_!BNmg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png 848w, https://substackcdn.com/image/fetch/$s_!BNmg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png 1272w, https://substackcdn.com/image/fetch/$s_!BNmg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F703d67a8-59d9-4237-bf32-c32067632126_160x47.png 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><p>We can model a random walk with above, where the position at some time t is just the previous step with some white noise. Now since the expectation is a linear operator, the expectation of a random walk is just the initial position. Meaning if we were to ask on average, where do we expect the drunk person to be, it would be their starting point. We can observe this as when we plot over time, the expectation just back to 0. </p><p></p><p>Likewise, if we take the variance, the variance is proportional to the square root of the number of steps.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ms_q!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ms_q!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png 424w, https://substackcdn.com/image/fetch/$s_!ms_q!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png 848w, https://substackcdn.com/image/fetch/$s_!ms_q!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png 1272w, https://substackcdn.com/image/fetch/$s_!ms_q!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ms_q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png" width="766" height="466" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:466,&quot;width&quot;:766,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35955,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ms_q!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png 424w, https://substackcdn.com/image/fetch/$s_!ms_q!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png 848w, https://substackcdn.com/image/fetch/$s_!ms_q!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png 1272w, https://substackcdn.com/image/fetch/$s_!ms_q!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5362b6bc-cba7-4471-93b7-b17cf96ee467_766x466.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Mirroring Stock Prices</h2><p>Now this is simply a rudimentary example to demonstrate how this works. Suppose we have a stock priced at $100 and want to predict how the price is going to be. We&#8217;re not psychic, but using this random walk model, we can simulate the path of the prices it&#8217;s going to be in the future. We can do this a bunch of time which can help us give us a range of where we expect the prices to be . Assuming we have daily returns from a normal distrubtion with mu=0, and sigma=2%, we can get the following simulations.</p><p></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!zcbk!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!zcbk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png 424w, https://substackcdn.com/image/fetch/$s_!zcbk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png 848w, https://substackcdn.com/image/fetch/$s_!zcbk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png 1272w, https://substackcdn.com/image/fetch/$s_!zcbk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!zcbk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png" width="904" height="552" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:552,&quot;width&quot;:904,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:408442,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!zcbk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png 424w, https://substackcdn.com/image/fetch/$s_!zcbk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png 848w, https://substackcdn.com/image/fetch/$s_!zcbk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png 1272w, https://substackcdn.com/image/fetch/$s_!zcbk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4f54f528-1472-47b8-bf09-93ca34ed7b5c_904x552.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p>]]></content:encoded></item><item><title><![CDATA[Risky Business: Beginner's guide to measuring portfolio risk]]></title><description><![CDATA[A simple look at understanding risk metrics]]></description><link>https://www.modelsbymodels.com/p/risky-business-beginners-guide-to</link><guid isPermaLink="false">https://www.modelsbymodels.com/p/risky-business-beginners-guide-to</guid><dc:creator><![CDATA[Sakibul Alam]]></dc:creator><pubDate>Wed, 10 Apr 2024 19:53:20 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!GnxA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When you&#8217;re investing your money, you&#8217;re goal is very simple. Make the most money. Suppose you&#8217;re deciding between two portfolios with the following  5 year returns. Which would you invest in?</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GnxA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GnxA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png 424w, https://substackcdn.com/image/fetch/$s_!GnxA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png 848w, https://substackcdn.com/image/fetch/$s_!GnxA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png 1272w, https://substackcdn.com/image/fetch/$s_!GnxA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GnxA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png" width="1456" height="439" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:439,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:47409,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GnxA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png 424w, https://substackcdn.com/image/fetch/$s_!GnxA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png 848w, https://substackcdn.com/image/fetch/$s_!GnxA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png 1272w, https://substackcdn.com/image/fetch/$s_!GnxA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa639ff68-7f10-40dc-b0fe-308694720cb6_1741x525.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Now they both have the same average return of 6.2% and similar annualized returns of 7.4% and 7.1% respectively. In addition to returns, we also want to factor in risk in our decision making. Notice portfolio 2 is more volatile. Imagine you&#8217;re saving up to buy a house in a couple years, you might have a lower risk tolerance given that you need the money sooner. Versus a retirement account you would be open to more risk. This is where we need a way to quantify the risk</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.modelsbymodels.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Models by Models! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2>Sharpe Ratio</h2><p>The most common way to measure risk in a portfolio is the sharpe ratio. </p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sHdr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sHdr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png 424w, https://substackcdn.com/image/fetch/$s_!sHdr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png 848w, https://substackcdn.com/image/fetch/$s_!sHdr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png 1272w, https://substackcdn.com/image/fetch/$s_!sHdr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sHdr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png" width="574" height="222" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:222,&quot;width&quot;:574,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:18951,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sHdr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png 424w, https://substackcdn.com/image/fetch/$s_!sHdr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png 848w, https://substackcdn.com/image/fetch/$s_!sHdr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png 1272w, https://substackcdn.com/image/fetch/$s_!sHdr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa926ba74-4a61-4ca1-a2ff-e3e2af326fbe_574x222.png 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><p></p><p>Decomposing this, we are simply looking at the ratio of the excess returns vs its risk, where the risk is we measure as the standard deviation of returns. I.E, getting more bang for my buck. For each unit of risk, I want more return.</p><p>Now we use a risk free rate as a baseline to calculate the &#8220;excess return&#8221;. One can invest in treasury bill which are generally risk free to serve as a baseline as if you are going to be taking some risk, you want it have better returns than the baseline.</p><pre><code>def get_sharpe_ratio(returns, annual_risk_free_rate=0.05):
    """
    Determines the Sharpe ratio of a strategy.

    Parameters
    ----------
    returns : pd.Series or np.ndarray
        Daily returns of the strategy, noncumulative.
    adjustment_factor : int, float
        Constant daily benchmark return throughout the period.
    Returns
    -------
    sharpe_ratio : float
    Note
    -----
    See https://en.wikipedia.org/wiki/Sharpe_ratio for more details.
    """
    daily_risk_free_rate = (1 + annual_risk_free_rate) ** (1 / 252) - 1
    returns_risk_adj = returns - daily_risk_free_rate
    excess_returns = returns.mean()-daily_risk_free_rate
    volatility = returns.std()
    return np.sqrt(252)*excess_returns/volatility #annaulize it
</code></pre><h2>Sortino Ratio</h2><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!G_B9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G_B9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png 424w, https://substackcdn.com/image/fetch/$s_!G_B9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png 848w, https://substackcdn.com/image/fetch/$s_!G_B9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png 1272w, https://substackcdn.com/image/fetch/$s_!G_B9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!G_B9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png" width="472" height="203" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:203,&quot;width&quot;:472,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16509,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!G_B9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png 424w, https://substackcdn.com/image/fetch/$s_!G_B9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png 848w, https://substackcdn.com/image/fetch/$s_!G_B9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png 1272w, https://substackcdn.com/image/fetch/$s_!G_B9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f6e44a-0e53-4525-b798-fa8175e5676c_472x203.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>In addition, we can look at the Sortino Ratio. Notice the formula is the exact same, excess this time we only look at the standard deviation of the downside. AKA, we only focus in the negative returns. Since we&#8217;re focusing on the negative returns, this will inform us about worrying about the big losses in the portfolio. Yes we can have positive volatility, but that&#8217;s still positive returns so in this case I am comfortable with that volatility vs swings in the other direction.</p><pre><code>def get_sortino_ratio(returns, annual_risk_free_rate=0.05):
    """
    Determines the Sharpe ratio of a strategy.

    Parameters
    ----------
    returns : pd.Series or np.ndarray
        Daily returns of the strategy, noncumulative.
    adjustment_factor : int, float
        Constant daily benchmark return throughout the period.
    Returns
    -------
    sharpe_ratio : float
    Note
    -----
    See https://en.wikipedia.org/wiki/Sharpe_ratio for more details.
    """
    daily_risk_free_rate = (1 + annual_risk_free_rate) ** (1 / 252) - 1
    returns_risk_adj = returns - daily_risk_free_rate
    excess_returns = returns.mean()-daily_risk_free_rate
    negative_volatility = returns_risk_adj[returns_risk_adj&lt;0].std()
    return np.sqrt(252)*excess_returns/negative_volatility  #Annualize it</code></pre><h2>Putting it all together</h2><p>We usually have to deal with much more nuanced data than a 5 year return. But the beauty of this is all we need is returns data to calculate the ratio. Suppose I&#8217;m deciding in portfolios in just pure Tesla Stock or pure Apple stock. I see that the daily returns for the past 5 years below, which is ugly to look. So let&#8217;s just feed in the daily returns to measure our risk</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tOPA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tOPA!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png 424w, https://substackcdn.com/image/fetch/$s_!tOPA!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png 848w, https://substackcdn.com/image/fetch/$s_!tOPA!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png 1272w, https://substackcdn.com/image/fetch/$s_!tOPA!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!tOPA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png" width="857" height="547" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:547,&quot;width&quot;:857,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tOPA!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png 424w, https://substackcdn.com/image/fetch/$s_!tOPA!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png 848w, https://substackcdn.com/image/fetch/$s_!tOPA!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png 1272w, https://substackcdn.com/image/fetch/$s_!tOPA!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6178b2dd-217e-41e5-b2b0-b537cc0cd8af_857x547.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!erPB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!erPB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png 424w, https://substackcdn.com/image/fetch/$s_!erPB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png 848w, https://substackcdn.com/image/fetch/$s_!erPB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png 1272w, https://substackcdn.com/image/fetch/$s_!erPB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!erPB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png" width="197" height="66" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:66,&quot;width&quot;:197,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:2717,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!erPB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png 424w, https://substackcdn.com/image/fetch/$s_!erPB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png 848w, https://substackcdn.com/image/fetch/$s_!erPB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png 1272w, https://substackcdn.com/image/fetch/$s_!erPB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9695ae44-ce80-4550-920f-d7a6ef375a11_197x66.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>We can observe that TSLA gives us a better Sharpe &amp; Sortino Ratio than apple. In practice, we deal with large portfolios with varying stocks and weights. However it&#8217;s really just plug and play. I just need the returns of the portfolios, I don&#8217;t care about the compositions. </p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.modelsbymodels.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Models by Models! Subscribe for free to receive new posts and support my work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item></channel></rss>