<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.2.2">Jekyll</generator><link href="https://bayes.net/feed.xml" rel="self" type="application/atom+xml" /><link href="https://bayes.net/" rel="alternate" type="text/html" /><updated>2026-10-07T06:26:42+00:00</updated><id>https://bayes.net/feed.xml</id><title type="html">bayes.net</title><subtitle>Tom Adamczewski's blog</subtitle><entry><title type="html">Shut up and SWE-bench</title><link href="https://bayes.net/shut-up-and-swe-bench/" rel="alternate" type="text/html" title="Shut up and SWE-bench" /><published>2026-09-24T00:00:00+00:00</published><updated>2026-09-24T00:00:00+00:00</updated><id>https://bayes.net/shut-up-and-swe-bench</id><content type="html" xml:base="https://bayes.net/shut-up-and-swe-bench/"><![CDATA[<p>AIs have such poor judgement for when to write a code comment that I prefer to have them write none at all. My global AGENTS.md (which is quite short: 769 words) includes the instructions:</p>

<blockquote>
  <p>Don’t add any comments or documentation unless I explicitly ask for them.
Don’t edit existing comments unless your change makes them wrong.</p>
</blockquote>

<p>I’ve mostly been using Claude lately, and it does not obey the instructions! It frequently still adds comments. It’s quite surprising that instruction following can still be so poor on such powerful models.</p>

<p>But that’s just my anecdotal impression. I decided to measure the effect systematically. I call this new eval “Shut up and SWE-bench”.</p>

<h2 id="method">Method</h2>

<p>I took <a href="https://openai.com/index/introducing-swe-bench-verified/">SWE-bench Verified</a> and drew 100 tasks at random from the 261 that the annotators rated as taking 15 minutes to 1 hour (I excluded the “under 15 minutes” bucket because a one-line fix leaves little room for a comment).<sup id="fnref:infra" role="doc-noteref"><a href="#fn:infra" class="footnote" rel="footnote">1</a></sup> The system prompt is the one from <a href="https://github.com/UKGovernmentBEIS/inspect_evals/tree/main/src/inspect_evals/swe_bench">inspect_evals</a> with my two rules appended:</p>

<blockquote>
  <p>Don’t add any comments or documentation unless the issue explicitly asks for them.
Don’t edit existing comments unless your change makes them wrong.</p>
</blockquote>

<p>Issues essentially never explicitly ask for comments, so the “unless” clause was only there to keep the prompt more similar to what I have in my AGENTS.md.</p>

<p>To detect comments, the scorer takes every <code class="language-plaintext highlighter-rouge">.py</code> file the agent changed and runs it through Python’s <a href="https://docs.python.org/3/library/tokenize.html"><code class="language-plaintext highlighter-rouge">tokenize</code></a> module before and after the change. It collects the <code class="language-plaintext highlighter-rouge">COMMENT</code> tokens and the <code class="language-plaintext highlighter-rouge">STRING</code> tokens that start a statement (i.e. docstrings), and any comment or docstring text that’s in the new file but wasn’t in the old one counts as added. A comment that merely moved doesn’t count.</p>

<p>A comment the agent reworded does get flagged, so I then go through the diff and discard any flagged comment that has a similar removed comment line in the same hunk, and any flagged docstring where fewer than half the lines are new. Whether such comment edits are legitimate depends on whether an agent’s code change “made an old comment wrong”, but this happens rarely enough that I just give them the benefit of the doubt, and only count newly added comments. This is good enough for a quick experiment.</p>

<h2 id="results">Results</h2>

<table>
  <thead>
    <tr>
      <th>Model</th>
      <th>Resolved</th>
      <th>Added no comments</th>
      <th>Both (Shut up and SWE-bench score)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Claude Fable 5.1</td>
      <td>86%</td>
      <td>67%</td>
      <td>59%</td>
    </tr>
    <tr>
      <td>GPT-6 Astra</td>
      <td>80%</td>
      <td>94%</td>
      <td>76%</td>
    </tr>
    <tr>
      <td>Gemini 3.8 Flash</td>
      <td>76%</td>
      <td>67%</td>
      <td>55%</td>
    </tr>
  </tbody>
</table>

<p>Fable 5.1 added a new comment or docstring in 33 of the 100 tasks, and so did Gemini 3.8 Flash. Standard errors are around 5 percentage points. GPT-6 Astra does well: it beats Claude at Shut up and SWE-bench despite resolving fewer issues, and its 6% of tasks with a new comment is within the noise of my hacky heuristics (all 6 comments seem legitimate to me). The full transcripts are here: <a href="https://epochai-public-eval-logs-manual.s3.amazonaws.com/eval-transcripts/swe-bench-no-comments/swe-bench-no-comments-0guhke3w7syydrj7/index.html">Fable and Astra</a>, <a href="https://epochai-public-eval-logs-manual.s3.amazonaws.com/eval-transcripts/swe-bench-no-comments/swe-bench-no-comments-gem-noxn0d6dp0b1r0r2/index.html">Gemini</a>.</p>

<p>In a further 6 tasks, Fable only reworded existing comments or docstrings. I checked these by hand and 5 of the 6 were legitimate: the fix had made the old text wrong, or added a parameter that the docstring then needed to list.</p>

<p>Here’s an example of a new comment:</p>

<div class="language-diff highlighter-rouge"><div class="highlight"><pre class="highlight"><code>             locs = locs[(vmin &lt;= locs) &amp; (locs &lt;= vmax)]
<span class="gi">+            # Avoid having an offset / scientific notation in a legend
+            # as we don't represent that anywhere so it ends up incorrect.
+            # This could become an option (e.g. Continuous.label(offset=True))
+            # in which case we would need to figure out how to show it.
+            if hasattr(axis.major.formatter, "set_useOffset"):
</span></code></pre></div></div>

<p>Memorization may be an issue for this eval, as it is for SWE-bench. In one Django task, Fable added a seven-line comment block that is word for word the comment from Django’s own <a href="https://github.com/django/django/pull/11087">upstream fix</a>.</p>
<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:infra" role="doc-endnote">
      <p>It was nice to discover that inspect_evals uses the <a href="https://epoch.ai/latest/swebench-docker">optimized SWE-bench image registry</a> I built for Epoch AI in July 2025 as its default. It still works: the images pulled in about 20 seconds each, and 100 agent runs plus test suites took 14 minutes on our cluster. <a href="#fnref:infra" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><summary type="html"><![CDATA[My agent instructions say not to add comments, but Claude does not obey. Introducing 'Shut up and SWE-bench'.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/shut-up-and-swe-bench.png" /><media:content medium="image" url="https://bayes.net/assets/images/shut-up-and-swe-bench.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">MirrorCode and making evals that are hard, but actually fair</title><link href="https://bayes.net/mirrorcode/" rel="alternate" type="text/html" title="MirrorCode and making evals that are hard, but actually fair" /><published>2026-07-30T00:00:00+00:00</published><updated>2026-07-30T00:00:00+00:00</updated><id>https://bayes.net/mirrorcode</id><content type="html" xml:base="https://bayes.net/mirrorcode/"><![CDATA[<p>On June 26 we released <a href="https://epoch.ai/MirrorCode">MirrorCode</a>, a new AI benchmark made up of very long-horizon coding tasks. MirrorCode asks: What’s the largest software project AI can complete on its own?</p>

<p>This was a major project for me. I’m pleased that MirrorCode is out and seems to be gathering some attention, e.g. from <a href="https://jack-clark.net/2026/07/27/import-ai-466-the-bitter-lesson-for-robotics-ais-complete-week-long-programming-tasks-and-openais-accidental-ai-hacker/">Jack Clark in his Import AI newsletter</a>.</p>

<p>The <a href="https://arxiv.org/pdf/2606.30182">paper</a> is very serious and buttoned-down; in this post I want to share some personal reflections and hot takes.</p>

<p>AI is progressing so quickly that the key tension in evals is now: how to make tasks that are difficult for AI, but actually fair? Since developing MirrorCode, my default expectation when I see a coding eval with low scores is that the tasks turn out to be impossible, models were grievously under-elicited, or both.<sup id="fnref:prior" role="doc-noteref"><a href="#fn:prior" class="footnote" rel="footnote">1</a></sup></p>

<p>In MirrorCode, we leverage reimplementation of existing software as the raw material to make tasks hard. But we also manually select each of the 25 target programs, and carefully collect the end-to-end tests, so that the task is actually achievable (if extremely difficult).</p>

<p>If you’re not familiar with it, here’s a quick summary of the MirrorCode setup: AIs must reimplement a target program without access to its source code or the internet. They’re given the target’s docs, and a reference binary to which they can send inputs. The AI’s implementation must match the reference stdout and stderr exactly, for a long list of test inputs.</p>

<h2 id="avoiding-absurd-reverse-engineering">Avoiding absurd reverse-engineering</h2>

<p>It’s very easy for MirrorCode-style tasks to degenerate into absurd reverse-engineering: stuff you’d never do as a human engineer. For example, one of our target programs is the brotli compression library. But we explicitly test the <strong>de</strong>compression path only (and call the task “brotlid”).</p>

<p>Brotli’s <a href="https://www.rfc-editor.org/rfc/rfc7932">RFC 7932</a> only defines decompression: given compressed bytes, there’s one correct output. In the other direction, there’s no unique mapping. Given input text, there are many valid compressions of it, some more efficient than others.</p>

<p>So the output of a compressor is governed by thousands of internal efficiency heuristics (e.g. how far back to look for repeated strings). Replicating those perfectly from a black box is extreme and pointless reverse-engineering.</p>

<p>We put considerable effort into avoiding this by selecting appropriate target programs and curating test inputs. This requires judgement. Occasionally it can be quite subjective where to draw the line for “extreme” reverse-engineering, but in most cases it’s not close (like in the brotli example).</p>

<h2 id="telling-ais-whats-in-scope">Telling AIs what’s in scope</h2>

<p>Another key differentiator of MirrorCode: AIs are clearly told the scope of the task, rather than having to guess what they’ll secretly be tested on. We clarify task scope by showing AIs a list of test inputs (while also keeping some hidden to prevent AIs from cheating with a lookup table). If this sounds too easy or like giving them the answer, I assure you, you’re thinking about it wrong. What we do is completely different from showing the answer in a Q&amp;A benchmark (Q&amp;A is where the wrong intuition comes from, IMO). This is more like defining what question you’re even asking.</p>

<p>For example, perfectly matching <code class="language-plaintext highlighter-rouge">gotree</code>’s behaviour does not become easy because I show you 1,899 inputs (!) that your program will be tested on.</p>

<p>Personally I think it would take me &gt;1 month without AI and using the stdlib only (the setting we test AIs in).</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/gotree-tests-400-40e24eee4.webp 400w, /generated/_posts/../assets/images/mirrorcode/gotree-tests-600-40e24eee4.webp 600w, /generated/_posts/../assets/images/mirrorcode/gotree-tests-727-40e24eee4.webp 727w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/gotree-tests-400-40e24eee4.jpeg 400w, /generated/_posts/../assets/images/mirrorcode/gotree-tests-600-40e24eee4.jpeg 600w, /generated/_posts/../assets/images/mirrorcode/gotree-tests-727-40e24eee4.jpeg 727w" type="image/jpeg" /><img alt="A list of gotree test cases, some marked hidden" src="/generated/_posts/../assets/images/mirrorcode/gotree-tests-727-40e24eee4.jpg" width="727" height="1291" /></picture>

<figcaption class="caption">
  <p>A slice of <code class="language-plaintext highlighter-rouge">gotree</code>’s test cases. Cases marked <code class="language-plaintext highlighter-rouge">hidden</code> are held out from the AI.</p>
</figcaption>
<p><br /></p>

<p>Meanwhile, if you don’t show test cases and just say “reimplement all of <code class="language-plaintext highlighter-rouge">gotree</code>” the task is dominated by an impossible guessing-game: what’s actually in scope?</p>

<p>It’s obviously infeasible to search across literally all of the possible input strings that <code class="language-plaintext highlighter-rouge">gotree</code> could be run on. Documentation helps to narrow this down, but cannot cover all of the complex ways that the software is used in reality.</p>

<p>As just one of many examples of what happens when you look at real-world trees: comments in trees.</p>

<p>The Nexus format was only loosely specified in its original publication (which we give to AIs). Enumerating every real-world use of the Nexus format, from scratch (no looking up online!), is not feasible. Among other omissions, documentation does not mention that Nexus files may contain comments. Nexus comments are in brackets (e.g. <code class="language-plaintext highlighter-rouge">[comment]</code>), so they may appear in the middle of a line of data, unlike code comments. Real-world files produced by standard tools contain comments in various formats (e.g. multiline comments). <code class="language-plaintext highlighter-rouge">gotree</code> <em>generally</em> handles them without complaint, but errors with comments in certain locations (comments inside the TAXLABELS clause if you need to know).</p>

<p>I personally think guessing that comments exist, and all the ways comments must be handled, despite comments not even being mentioned in documentation, is functionally impossible. But everyone should at least agree that guessing this is far harder than actually implementing comment-handling. So the benchmark becomes dominated by the guessing-game, rather than actual implementation.</p>

<p>Human SWEs gradually learn the scope of inputs a program should support thanks to external feedback from users of the program, they don’t just think them all up in a vacuum before publication. Yet that’s what some benchmarks test.</p>

<h2 id="btw-dont-underestimate-these-tasks">btw, don’t underestimate these tasks</h2>

<p>At least if Hacker News commenters are anything to go by, I think it’s easy to underestimate some of our target programs. Take the calendar utility <code class="language-plaintext highlighter-rouge">cal</code>. It seems simple: print a calendar, trivial right?</p>

<p>But then you think about what’s actually involved in a fully accurate calendar with a lot of configurable options, and the need for byte-exact output on 1,365 test cases…</p>

<p>For example, you need to think about September 1752, which is the date the British switched from the Julian to the Gregorian calendar, dropping 11 days. Of course.</p>

<p>We use <code class="language-plaintext highlighter-rouge">cal</code> from util-linux. For example, a user can pass <code class="language-plaintext highlighter-rouge">11 2026</code> to print a calendar for November 2026. By default, the first day of the week is determined by the system’s locale, but it can be explicitly overridden with <code class="language-plaintext highlighter-rouge">--monday</code> or <code class="language-plaintext highlighter-rouge">--sunday</code>.</p>

<p><code class="language-plaintext highlighter-rouge">cal</code> supports numerous features:</p>

<ol>
  <li><strong>Layouts.</strong> By default <code class="language-plaintext highlighter-rouge">cal</code> displays one month. The flag <code class="language-plaintext highlighter-rouge">--months</code> displays an arbitrary number of months in a grid layout, whose width is controlled by <code class="language-plaintext highlighter-rouge">--columns</code>. <code class="language-plaintext highlighter-rouge">--week</code> additionally prints week numbers. The <code class="language-plaintext highlighter-rouge">--vertical</code> flag flips the layout, making each week a column instead of a row, and causes week numbers to appear at the bottom instead of the left. <code class="language-plaintext highlighter-rouge">-j</code> uses day-of-year numbering instead of day-of-month; the layout must then expand to accommodate three-digit numbers. To pass the task, an AI must produce exact output for all these layouts.</li>
  <li><strong>Choice of calendar system.</strong> By default, the Gregorian calendar is used from 3 September 1752, and the Julian before that. 11 days were removed at the time of adoption to bring the calendar in sync with solar events, so September 1752 has a mix of Julian and Gregorian dates by which the 2nd is followed by the 14th (the 3rd through the 13th are absent). The <code class="language-plaintext highlighter-rouge">--reform</code> flag customizes the date of adoption of the Gregorian calendar. Separately, week numbering depends on the choice of first day of the week: <code class="language-plaintext highlighter-rouge">--sunday</code> implies 1 January is in week 1, while <code class="language-plaintext highlighter-rouge">--monday</code> implies the ISO8601 standard, where the first Thursday is in week 1.</li>
  <li><strong>Date input formats.</strong> Numerous input formats are supported, such as <code class="language-plaintext highlighter-rouge">2020</code>, <code class="language-plaintext highlighter-rouge">11 2020</code>, <code class="language-plaintext highlighter-rouge">25-11-2020</code>, <code class="language-plaintext highlighter-rouge">August</code>, <code class="language-plaintext highlighter-rouge">Aug</code>, <code class="language-plaintext highlighter-rouge">yesterday</code>, <code class="language-plaintext highlighter-rouge">tomorrow</code>, <code class="language-plaintext highlighter-rouge">+3months</code>.</li>
</ol>

<p>Would you back yourself to implement all this (without AI), passing 100% of tests, in under a week? I’m not sure I would.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/cal-400-4e222c3bd.webp 400w, /generated/_posts/../assets/images/mirrorcode/cal-600-4e222c3bd.webp 600w, /generated/_posts/../assets/images/mirrorcode/cal-800-4e222c3bd.webp 800w, /generated/_posts/../assets/images/mirrorcode/cal-1000-4e222c3bd.webp 1000w, /generated/_posts/../assets/images/mirrorcode/cal-1019-4e222c3bd.webp 1019w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/cal-400-4e222c3bd.jpeg 400w, /generated/_posts/../assets/images/mirrorcode/cal-600-4e222c3bd.jpeg 600w, /generated/_posts/../assets/images/mirrorcode/cal-800-4e222c3bd.jpeg 800w, /generated/_posts/../assets/images/mirrorcode/cal-1000-4e222c3bd.jpeg 1000w, /generated/_posts/../assets/images/mirrorcode/cal-1019-4e222c3bd.jpeg 1019w" type="image/jpeg" /><img alt="Representative cal invocations and their output" src="/generated/_posts/../assets/images/mirrorcode/cal-800-4e222c3bd.jpg" width="1019" height="422" /></picture>

<figcaption class="caption">
  <p>Representative <code class="language-plaintext highlighter-rouge">cal</code> invocations and their output, illustrating the default, <code class="language-plaintext highlighter-rouge">--monday</code>, <code class="language-plaintext highlighter-rouge">--week</code>, vertical multi-month, and day-of-year (<code class="language-plaintext highlighter-rouge">-j</code>) layouts.</p>
</figcaption>
<p><br /></p>

<h2 id="security-mindset-for-evals">Security mindset for evals</h2>

<p>I’m especially proud of this one. MirrorCode is the first benchmark I know of to implement a serious “security mindset”. This means treating AI cheating not as an afterthought, but as a first-class consideration in every aspect of eval design.</p>

<p>Let’s look at three examples from other benchmarks. With SWE-bench,<sup id="fnref:swebench" role="doc-noteref"><a href="#fn:swebench" class="footnote" rel="footnote">2</a></sup> KernelBench,<sup id="fnref:kernelbench" role="doc-noteref"><a href="#fn:kernelbench" class="footnote" rel="footnote">3</a></sup> and RE-bench,<sup id="fnref:rebench" role="doc-noteref"><a href="#fn:rebench" class="footnote" rel="footnote">4</a></sup> brittle defences were bolted on after someone caught AIs cheating in a specific way. The KernelBench maintainers <a href="https://scalingintelligence.stanford.edu/blogs/kernelbenchv01/">concede</a> that “even when we patch known exploits, new ones emerge, often even harder to detect”, and the RE-bench authors <a href="https://metr.org/blog/2025-06-05-recent-reward-hacking/">lamented</a> having to resort to laborious manual inspection.</p>

<p>I get the sense that the field fatalistically treats AI cheating as an unwinnable game of whack-a-mole. I think this is completely wrong. Most benchmarks <em>can</em> be made secure, by using basic primitives like containers and privilege separation. We just need to take this seriously and actually do the obvious things. Most authors of new evals are behind the curve. They aren’t even trying to make their evals secure against human-level attackers, which AIs are. That’s why cheating comes up all the time, not because it’s inherently that hard to prevent.</p>

<p>See <a href="https://arxiv.org/pdf/2606.30182#nameddest=appendix.D">Appendix D</a> of the paper for the details of how I did it in MirrorCode.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/security-mindset-400-367c358ff.webp 400w, /generated/_posts/../assets/images/mirrorcode/security-mindset-600-367c358ff.webp 600w, /generated/_posts/../assets/images/mirrorcode/security-mindset-800-367c358ff.webp 800w, /generated/_posts/../assets/images/mirrorcode/security-mindset-1000-367c358ff.webp 1000w, /generated/_posts/../assets/images/mirrorcode/security-mindset-1500-367c358ff.webp 1500w, /generated/_posts/../assets/images/mirrorcode/security-mindset-1584-367c358ff.webp 1584w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/security-mindset-400-367c358ff.jpeg 400w, /generated/_posts/../assets/images/mirrorcode/security-mindset-600-367c358ff.jpeg 600w, /generated/_posts/../assets/images/mirrorcode/security-mindset-800-367c358ff.jpeg 800w, /generated/_posts/../assets/images/mirrorcode/security-mindset-1000-367c358ff.jpeg 1000w, /generated/_posts/../assets/images/mirrorcode/security-mindset-1500-367c358ff.jpeg 1500w, /generated/_posts/../assets/images/mirrorcode/security-mindset-1584-367c358ff.jpeg 1584w" type="image/jpeg" /><img alt="MirrorCode's container architecture" src="/generated/_posts/../assets/images/mirrorcode/security-mindset-800-367c358ff.jpg" width="1584" height="578" /></picture>

<figcaption class="caption">
  <p>Figure from Appendix D: MirrorCode’s container architecture (one task instance).</p>
</figcaption>
<p><br /></p>

<h2 id="its-open-source">It’s open source</h2>

<p>MirrorCode is <a href="https://github.com/epoch-research/MirrorCode/">open source</a>, and it already supports lots of variations: e.g. ablate away test case visibility, show agents the source code, disable the mechanisms that force agents to keep working even when they want to stop, etc.</p>

<p>I have about a thousand research ideas for things that would be easy to try on top of this harness. I won’t have time to do most of them. Would love it if people just tried stuff! It’s free real estate. For example, prompting changes would likely help certain models improve their scores; our prompt just describes the task in a matter-of-fact way.<sup id="fnref:prompting" role="doc-noteref"><a href="#fn:prompting" class="footnote" rel="footnote">5</a></sup> Or: can you come up with a target program that the best models profoundly struggle with, getting very few test cases to pass at all? As of Claude Fable 5, none of our tasks meet this bar; I think it’s actually a very difficult challenge and would be impressed if someone solved it.</p>

<h2 id="a-few-inference-scaling-curves">A few inference scaling curves</h2>

<p>MirrorCode lets us measure partial progress (% of test cases passed) during an attempt, which leads to nice inference scaling curves. I hope to study this more systematically in the future, but for now here’s a cherry-picked collection of interesting curves.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/pkl-progress-400-b0437ec9f.webp 400w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-600-b0437ec9f.webp 600w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-800-b0437ec9f.webp 800w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-1000-b0437ec9f.webp 1000w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-1500-b0437ec9f.webp 1500w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-1800-b0437ec9f.webp 1800w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/pkl-progress-400-b0437ec9f.jpeg 400w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-600-b0437ec9f.jpeg 600w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-800-b0437ec9f.jpeg 800w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-1000-b0437ec9f.jpeg 1000w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-1500-b0437ec9f.jpeg 1500w, /generated/_posts/../assets/images/mirrorcode/pkl-progress-1800-b0437ec9f.jpeg 1800w" type="image/jpeg" /><img alt="pkl progress curve" src="/generated/_posts/../assets/images/mirrorcode/pkl-progress-800-b0437ec9f.png" width="1800" height="1050" /></picture>

<figcaption class="caption">
  <p>Slow grind on <code class="language-plaintext highlighter-rouge">pkl</code>.</p>
</figcaption>
<p><br /></p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/texmacros-tokens-400-c5f613bfb.webp 400w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-600-c5f613bfb.webp 600w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-800-c5f613bfb.webp 800w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-1000-c5f613bfb.webp 1000w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-1500-c5f613bfb.webp 1500w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-1800-c5f613bfb.webp 1800w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/texmacros-tokens-400-c5f613bfb.jpeg 400w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-600-c5f613bfb.jpeg 600w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-800-c5f613bfb.jpeg 800w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-1000-c5f613bfb.jpeg 1000w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-1500-c5f613bfb.jpeg 1500w, /generated/_posts/../assets/images/mirrorcode/texmacros-tokens-1800-c5f613bfb.jpeg 1800w" type="image/jpeg" /><img alt="texmacros token usage across languages and epochs" src="/generated/_posts/../assets/images/mirrorcode/texmacros-tokens-800-c5f613bfb.jpg" width="1800" height="1050" /></picture>

<figcaption class="caption">
  <p>High variance of token usage for <code class="language-plaintext highlighter-rouge">texmacros</code>.</p>
</figcaption>
<p><br /></p>

<p>Older models struggling (GPT-5 and Opus 4.1, both from August 2025):</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/older-models-1-400-ac8d9dcc9.webp 400w, /generated/_posts/../assets/images/mirrorcode/older-models-1-600-ac8d9dcc9.webp 600w, /generated/_posts/../assets/images/mirrorcode/older-models-1-800-ac8d9dcc9.webp 800w, /generated/_posts/../assets/images/mirrorcode/older-models-1-1000-ac8d9dcc9.webp 1000w, /generated/_posts/../assets/images/mirrorcode/older-models-1-1500-ac8d9dcc9.webp 1500w, /generated/_posts/../assets/images/mirrorcode/older-models-1-1800-ac8d9dcc9.webp 1800w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/older-models-1-400-ac8d9dcc9.jpeg 400w, /generated/_posts/../assets/images/mirrorcode/older-models-1-600-ac8d9dcc9.jpeg 600w, /generated/_posts/../assets/images/mirrorcode/older-models-1-800-ac8d9dcc9.jpeg 800w, /generated/_posts/../assets/images/mirrorcode/older-models-1-1000-ac8d9dcc9.jpeg 1000w, /generated/_posts/../assets/images/mirrorcode/older-models-1-1500-ac8d9dcc9.jpeg 1500w, /generated/_posts/../assets/images/mirrorcode/older-models-1-1800-ac8d9dcc9.jpeg 1800w" type="image/jpeg" /><img alt="Opus 4.1 on cal" src="/generated/_posts/../assets/images/mirrorcode/older-models-1-800-ac8d9dcc9.png" width="1800" height="1050" /></picture>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/older-models-2-400-5b8236e1d.webp 400w, /generated/_posts/../assets/images/mirrorcode/older-models-2-600-5b8236e1d.webp 600w, /generated/_posts/../assets/images/mirrorcode/older-models-2-800-5b8236e1d.webp 800w, /generated/_posts/../assets/images/mirrorcode/older-models-2-1000-5b8236e1d.webp 1000w, /generated/_posts/../assets/images/mirrorcode/older-models-2-1500-5b8236e1d.webp 1500w, /generated/_posts/../assets/images/mirrorcode/older-models-2-1800-5b8236e1d.webp 1800w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/older-models-2-400-5b8236e1d.jpeg 400w, /generated/_posts/../assets/images/mirrorcode/older-models-2-600-5b8236e1d.jpeg 600w, /generated/_posts/../assets/images/mirrorcode/older-models-2-800-5b8236e1d.jpeg 800w, /generated/_posts/../assets/images/mirrorcode/older-models-2-1000-5b8236e1d.jpeg 1000w, /generated/_posts/../assets/images/mirrorcode/older-models-2-1500-5b8236e1d.jpeg 1500w, /generated/_posts/../assets/images/mirrorcode/older-models-2-1800-5b8236e1d.jpeg 1800w" type="image/jpeg" /><img alt="GPT-5 on cprepro" src="/generated/_posts/../assets/images/mirrorcode/older-models-2-800-5b8236e1d.jpg" width="1800" height="1050" /></picture>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/older-models-3-400-391c461cf.webp 400w, /generated/_posts/../assets/images/mirrorcode/older-models-3-600-391c461cf.webp 600w, /generated/_posts/../assets/images/mirrorcode/older-models-3-800-391c461cf.webp 800w, /generated/_posts/../assets/images/mirrorcode/older-models-3-1000-391c461cf.webp 1000w, /generated/_posts/../assets/images/mirrorcode/older-models-3-1500-391c461cf.webp 1500w, /generated/_posts/../assets/images/mirrorcode/older-models-3-1800-391c461cf.webp 1800w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/mirrorcode/older-models-3-400-391c461cf.jpeg 400w, /generated/_posts/../assets/images/mirrorcode/older-models-3-600-391c461cf.jpeg 600w, /generated/_posts/../assets/images/mirrorcode/older-models-3-800-391c461cf.jpeg 800w, /generated/_posts/../assets/images/mirrorcode/older-models-3-1000-391c461cf.jpeg 1000w, /generated/_posts/../assets/images/mirrorcode/older-models-3-1500-391c461cf.jpeg 1500w, /generated/_posts/../assets/images/mirrorcode/older-models-3-1800-391c461cf.jpeg 1800w" type="image/jpeg" /><img alt="GPT-5 on gotree" src="/generated/_posts/../assets/images/mirrorcode/older-models-3-800-391c461cf.jpg" width="1800" height="1050" /></picture>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:prior" role="doc-endnote">
      <p>This doesn’t mean there are no good evals out there. It’s only my prior, if the only thing I know about a coding benchmark is that scores are low. <a href="#fnref:prior" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:swebench" role="doc-endnote">
      <p>The SWE-bench evaluation environments are built from a clone of each task’s repository, whose git history extends past the task’s base commit — including the commit that fixed the issue in question. When the containerized, agent-facing setup was introduced in June 2024, it removed the <code class="language-plaintext highlighter-rouge">origin</code> remote “so the agent won’t see newer commits”. This proved insufficient: version tags and the reflog still pointed at post-base-commit history, and by mid-2025 agents such as Claude 4 Sonnet were observed running <code class="language-plaintext highlighter-rouge">git log --all</code> to recover the upstream fix commit and copy its patch (<a href="/swebench-hack/">I wrote about this at the time</a>). After the loopholes were <a href="https://github.com/SWE-bench/SWE-bench/issues/465">reported in September 2025</a>, the maintainers <a href="https://github.com/SWE-bench/SWE-bench/pull/471">patched the setup again</a>: deleting tags newer than the base commit, expiring the reflog, garbage-collecting unreachable objects, and asserting that no future commits remain visible. <a href="#fnref:swebench" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:kernelbench" role="doc-endnote">
      <p>A KernelBench task gives the model a reference PyTorch module (e.g. a convolution layer) and asks it to write a custom GPU kernel that computes the same outputs faster; submissions are scored by comparing outputs against the reference on sampled inputs and timing the speedup. After the late-2024 release, models were found scoring well without writing real kernels: calling PyTorch’s own operators or cuBLAS instead of implementing them, writing a kernel but never invoking it, emitting no-ops that passed the correctness check because the evaluation read outputs from the same memory the reference had just written, and hiding computation from the timer on a separate CUDA stream. Countermeasures became a string-matching arms race. When <a href="https://cognition.com/blog/kevin-32b">Cognition</a> used KernelBench tasks for RL training in 2025, they zeroed the reward of any solution containing the string <code class="language-plaintext highlighter-rouge">torch.nn</code>; the model responded by wrapping broken kernels in <code class="language-plaintext highlighter-rouge">try</code>/<code class="language-plaintext highlighter-rouge">except</code> blocks that fell back to PyTorch; they banned those keywords; it then subclassed the reference implementation with <code class="language-plaintext highlighter-rouge">pass</code>, which was banned in turn. The maintainers’ July 2025 v0.1 release rescaled problems and randomized test inputs. <a href="#fnref:kernelbench" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:rebench" role="doc-endnote">
      <p>On METR’s RE-bench, OpenAI’s o3 obtained impossibly high scores by exploiting the scorer rather than solving the task — for instance monkey-patching the timing and synchronisation functions instead of writing a performant kernel — <a href="https://metr.org/blog/2025-06-05-recent-reward-hacking/">reward hacking in roughly 30% of runs</a>, and continuing to do so even when explicitly instructed not to. Detecting these hacks is laborious and unreliable: METR resorts to manually inspecting anomalously high-scoring runs and to LLM-based monitors whose high false-positive rates require a further round of manual review, and they note that the discrepancies between the hacks each method surfaces suggest their counts “may be a significant underestimate”. <a href="#fnref:rebench" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:prompting" role="doc-endnote">
      <p>This is generally my preferred method, because optimizing a prompt is like an infinite rabbit hole and often leads to quite ad-hoc and brittle improvements. <a href="#fnref:prompting" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><summary type="html"><![CDATA[The key tension in evals is now: how to make tasks that are difficult for AI, but actually fair? My default expectation in 2026 when I see a coding eval with low scores is that the tasks turn out to be impossible.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/mirrorcode/prompt-banner.png" /><media:content medium="image" url="https://bayes.net/assets/images/mirrorcode/prompt-banner.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Claude 4 hacked SWE-bench by peeking at future commits</title><link href="https://bayes.net/swebench-hack/" rel="alternate" type="text/html" title="Claude 4 hacked SWE-bench by peeking at future commits" /><published>2025-09-05T00:00:00+00:00</published><updated>2025-09-05T00:00:00+00:00</updated><id>https://bayes.net/swebench-hack</id><content type="html" xml:base="https://bayes.net/swebench-hack/"><![CDATA[<p>In a <a href="/swebench-docker/">previous post</a> about creating a Docker registry of SWE-bench images, I made a brief side note about hypothetical reward hacking:</p>

<blockquote>
  <p>[…] as a side note, it’s worth asking whether the git history should be included at all. It makes sense for the model to have access to the past git history, like a human developer would. However, the model should not have access to <em>future</em> history from after the PR was merged. A sophisticated cheating model could in theory reward hack the evaluation if there is any way to access future history. I believe that is possible in some circumstances even after a <code class="language-plaintext highlighter-rouge">git reset --hard</code> and <code class="language-plaintext highlighter-rouge">git remote remove origin</code>. For example, if version tags are used, the model could <code class="language-plaintext highlighter-rouge">git checkout &lt;tag&gt;</code> a future tag. Or it could access the dangling commits in some way, perhaps with <code class="language-plaintext highlighter-rouge">git fsck --lost-found</code>. I believe this is unlikely to be a problem currently, but could become one with future models.</p>
</blockquote>

<p>Less than two months later, it seems that this behaviour has now been seen in the wild!</p>

<p>A META AI researcher has just posted an <a href="https://github.com/SWE-bench/SWE-bench/issues/465">issue</a> on the SWE-bench repo:</p>

<blockquote>
  <p>We’ve identified multiple loopholes with SWE Bench Verified where agents may look at future repository state (by querying it directly or through a variety of methods), and cases in which future repository state includes either solutions or detailed approaches to solving problems (commit messages and more).</p>

  <p>…
In a trajectory with Claude 4 Sonnet, pytest-dev__pytest-6202, the agent uses <code class="language-plaintext highlighter-rouge">git log --all</code> which leaks future commits that directly fix the issue.</p>
</blockquote>

<p>Claude 4 Sonnet came out in May 2025, and I wrote my post in July. I was quite wrong about how long it would take for models to become sophisticated enough to cheat in this way. They were already doing it. I had never seen a model attempt this loophole, but one man can only read so many SWE-bench traces.</p>

<p>The command <code class="language-plaintext highlighter-rouge">git log --all</code> (which I didn’t know about) shows all commits reachable from any ref. A ref is any <a href="https://git-scm.com/book/ms/v2/Git-Internals-Git-References">reference</a> to the SHA-1 value of a commit, found under <code class="language-plaintext highlighter-rouge">.git/refs</code>, and includes: (1) the heads of branches, (2) tags, (3) remotes, and (4) any manually created refs. As I explained in the previous post, the original SWE-bench authors only removed the default remote, with a code comment: “Remove the remote so the agent won’t see newer commits”. But they didn’t think about other refs, like tags (a fix is <a href="https://github.com/SWE-bench/SWE-bench/issues/465">underway</a>).</p>

<p><code class="language-plaintext highlighter-rouge">git log --all</code> lets a cheating model efficiently find any (non-dangling) commits, without having to look through the refs and figure out which one might point to future history and be usable for cheating. For example, Claude 4 Sonnet cleverly searched for commit messages with keywords relevant to the issue: <code class="language-plaintext highlighter-rouge">git log --oneline --all | grep -i "bracket|parametrize|modpath"</code>.</p>

<p>In the <code class="language-plaintext highlighter-rouge">pytest-6202</code> example, the issue is from November 2019. <code class="language-plaintext highlighter-rouge">git log --all</code> shows commits up to <code class="language-plaintext highlighter-rouge">d0f136f</code> (September 2024), which is tagged as <code class="language-plaintext highlighter-rouge">8.3.3</code>. Indeed <code class="language-plaintext highlighter-rouge">8.3.3</code> seems to be the highest version tag present on the main branch:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ git tag --list
1.0.0
1.0.0b3
1.0.0b6
...many more tags...
8.3.2
8.3.3
8.4.0.dev0
v7.4.3
</code></pre></div></div>

<p>In the example issues I looked at, git tags were the reason the future history was available. This is exactly the vulnerability that had jumped out at me when I looked into how the Docker images are constructed.</p>

<p>In  <code class="language-plaintext highlighter-rouge">pytest-6202</code>, deleting all tags is sufficient to remove the offending commits from <code class="language-plaintext highlighter-rouge">git log --all</code>.  However, a <code class="language-plaintext highlighter-rouge">git fsck --lost-found</code> will uncover the dangling tags and commits (ones not pointed to by any ref).</p>

<p>Here we must get into one subtlety. <code class="language-plaintext highlighter-rouge">git show-ref 8.3.3</code> will show <code class="language-plaintext highlighter-rouge">d430e32</code>, not <code class="language-plaintext highlighter-rouge">d0f136f</code>, the actual September 2024 commit. <code class="language-plaintext highlighter-rouge">d430e32</code> is the SHA-1 of the <a href="https://git-scm.com/book/ms/v2/Git-Internals-Git-References">annotated tag object</a>, which itself points to the actual commit <code class="language-plaintext highlighter-rouge">d0f136f</code>.  <code class="language-plaintext highlighter-rouge">git show-ref --dereference 8.3.3</code> can be used to show <code class="language-plaintext highlighter-rouge">d0f136f</code>.</p>

<p>Even after deleting tags, <code class="language-plaintext highlighter-rouge">git fsck --lost-found</code> will uncover</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>$ git fsck --lost-found
...
dangling tag d430e325c6d8c7161ae2e468ea5045a163e4c517
...
</code></pre></div></div>

<p>A cheater can then directly do <code class="language-plaintext highlighter-rouge">git checkout d430e32</code>, which moves the <code class="language-plaintext highlighter-rouge">HEAD</code> to the September 2024 commit <code class="language-plaintext highlighter-rouge">d0f136f</code>.  Since <code class="language-plaintext highlighter-rouge">HEAD</code> is a ref, <code class="language-plaintext highlighter-rouge">git log --all</code> will at that point show the entire future history, just like before we deleted the tags (in fact you don’t need the <code class="language-plaintext highlighter-rouge">--all</code> now).</p>

<p>My understanding is that <code class="language-plaintext highlighter-rouge">git gc --prune=now</code> (<a href="https://git-scm.com/docs/git-gc">docs</a>) removes any unreachable objects. The documentation says:</p>

<blockquote>
  <p><code class="language-plaintext highlighter-rouge">git gc</code> tries very hard not to delete objects that are referenced anywhere in your repository. In particular, it will keep not only objects referenced by your current set of branches and tags, but also objects referenced by the index, remote-tracking branches, reflogs (which may reference commits in branches that were later amended or rewound), and anything else in the refs/* namespace.</p>
</blockquote>

<p>The reflog and index are strictly local, so there should be nothing in them just after cloning. We’ve covered branches, tags, and remotes. The only exception I can think of are manually created refs (using <code class="language-plaintext highlighter-rouge">git update-ref</code>), which should be extremely unusual. To mitigate this, one could trust only the <code class="language-plaintext highlighter-rouge">HEAD</code> ref and delete all others.</p>

<p>I spent a couple of hours today trying to find other loopholes that work even after <code class="language-plaintext highlighter-rouge">git gc</code>. I scoured various git internals I had never thought about before, like packfiles (in <code class="language-plaintext highlighter-rouge">.git/objects/pack</code>), or <code class="language-plaintext highlighter-rouge">.git/objects/info/commit-graph</code>. None of these worked. But git is a big program with a lot of arcane features, and I only tried a couple of SWE-bench issues. Can you find a more sophisticated hack?</p>]]></content><author><name></name></author><summary type="html"><![CDATA[I predicted future AI models would someday learn to cheat on SWE-bench. They were already doing it.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/claude-hacker.png" /><media:content medium="image" url="https://bayes.net/assets/images/claude-hacker.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">How to run SWE-bench Verified in one hour on one machine</title><link href="https://bayes.net/swebench-docker/" rel="alternate" type="text/html" title="How to run SWE-bench Verified in one hour on one machine" /><published>2025-07-10T00:00:00+00:00</published><updated>2025-07-10T00:00:00+00:00</updated><id>https://bayes.net/swebench-docker</id><content type="html" xml:base="https://bayes.net/swebench-docker/"><![CDATA[<p><em>I wrote this post for Epoch AI, where I work. You can also read it on the <a href="https://epoch.ai/blog/swebench-docker">Epoch AI blog</a></em></p>

<p>We are releasing a <a href="https://github.com/orgs/epoch-research/packages?repo_name=SWE-bench">public registry</a> of Docker images for SWE-bench, to help the community run more efficient and reproducible SWE-bench evaluations. By making better use of layer caching, we reduced the total size of the registry to 67 GiB for all 2290 SWE-bench images (10x reduction), and to 30 GiB for 500 SWE-bench Verified images (6x reduction). This allows us to run SWE-bench Verified in 62 minutes on a single GitHub actions VM with 32 cores and 128GB of RAM.</p>

<h2 id="background">Background</h2>

<p>SWE-bench is a benchmark designed to evaluate large language models on real-world software engineering tasks. It consists of 2,294 GitHub issues from 12 popular Python repositories, paired with the actual pull requests that resolved those issues.</p>

<p>For each task, the AI system is given access to the repo in its state immediately before the pull request was merged, along with the issue description. The AI system must then modify the codebase to fix the problem. Success is measured by whether the AI system’s solution passes the test suite from after the pull request was merged—meaning the AI system must produce changes that satisfy the same tests that validated the human developer’s solution.</p>

<p><a href="https://openai.com/index/introducing-swe-bench-verified/">SWE-bench Verified</a> is a human-validated subset of 500 problems from the original benchmark.</p>

<p>SWE-bench has traditionally been considered a challenging benchmark to run. For example, the All Hands team <a href="https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed">reports</a> that it originally took them “several days” to run SWE-bench lite (300 examples), or over 10 minutes per sample. By using 32 machines in parallel, they reduced this to “several hours”.</p>

<h2 id="swe-bench-and-docker">SWE-bench and Docker</h2>

<p>During SWE-bench evaluation, the AI system directly modifies a codebase in a sandbox with the necessary dependencies. Each question requires its own sandbox environment to capture the exact state of the repo immediately before the PR was merged, and these environments are specified using Docker images. The <a href="https://github.com/SWE-bench/SWE-bench">SWE-bench repo</a> contains scripts that generate Dockerfiles and their context from the SWE-bench dataset, but without an image registry that stores the actual images, these images must be built from source.</p>

<p>There are two problems with building from source:</p>

<p><strong>Speed:</strong> Building the images takes a long time. When operating on a development machine, you only need to build them once, after which they are cached. However, to run rigorously auditable evaluations at scale, like we do for our <a href="https://epoch.ai/data/ai-benchmarking-dashboard">Benchmarking Hub</a>, it’s necessary to use cloud-based VMs that are ephemeral. In this case, every evaluation run would require building all the images again.</p>

<p><strong>Reproducibility:</strong> The build process relies on external resources (like <code class="language-plaintext highlighter-rouge">apt</code> or PyPI packages), so images built at different times may not be identical, even if the Dockerfiles and local context are the same. In particular, if the Dockerfiles do not pin versions for dependencies (which SWE-bench Dockerfiles generally do not, see below), the image will depend on the dependency resolution at build time. In addition, if a version of some dependency becomes unavailable, or moves to another address, etc., the build will fail. This may become an increasing problem over time, as many of the SWE-bench issues are now quite old (e.g. from 2015).</p>

<p>Therefore, our first contribution is a <a href="https://github.com/orgs/epoch-research/packages?repo_name=SWE-bench">public registry</a> of Docker images for SWE-bench, containing 2290 images for the x86_64 architecture (we were unable to build 4 out of 2294 images). This registry is free for anyone to use.</p>

<p>In addition, we optimized the images so that the total size of the registry is reduced by 6-10x. The rest of this post describes these optimizations.</p>

<h2 id="docker-layering">Docker layering</h2>
<p>The 2294 issues are from 12 repos, so many issues share the same repo. In fact, the distribution is heavily skewed, with Django accounting for 850/2294, or 37% of the issues.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/swebench-docker/img-400-ca96d351f.webp 400w, /generated/_posts/../assets/images/swebench-docker/img-493-ca96d351f.webp 493w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/swebench-docker/img-400-ca96d351f.jpeg 400w, /generated/_posts/../assets/images/swebench-docker/img-493-ca96d351f.jpeg 493w" type="image/jpeg" /><img alt="img.png" src="/generated/_posts/../assets/images/swebench-docker/img-493-ca96d351f.png" width="493" height="427" /></picture>

<figcaption class="caption">
  <p>Distribution of SWE-bench issues by repository, showing Django accounts for 850 out of 2294 total issues.</p>
</figcaption>
<p><br /></p>

<p>In addition, many issues will be close to each other in time, so the codebase will likely be similar. Two Django issues a week apart, for example, will have very similar dependencies. The main difference between them will be the change in application code between the two issues (usually a small fraction of the total codebase).</p>

<p>This is a perfect use case for Docker’s layer caching. What follows is a slightly simplified 1-paragraph explanation of layer caching. Each <code class="language-plaintext highlighter-rouge">RUN</code>, <code class="language-plaintext highlighter-rouge">COPY</code>, or <code class="language-plaintext highlighter-rouge">ADD</code> instruction in a Dockerfile creates a layer. A layer represents a specific modification to the container’s file system. Layers are added from bottom to top. Each layer is cached: if I change a layer, only layers above (that depend on it) will be rebuilt. In other words, if I make a change to a Dockerfile instruction and rebuild, this line and subsequent lines in the Dockerfile will have their layers re-built. Previous lines do not need to run again.<sup id="fnref:metaphor" role="doc-noteref"><a href="#fn:metaphor" class="footnote" rel="footnote">1</a></sup></p>

<p>The SWE-bench Dockerfiles, <a href="https://github.com/SWE-bench/SWE-bench/tree/0c0de95298dc502afa94b49bd8384e5f3ef81790/docs/20240627_docker">created</a> by Princeton researchers and OpenAI staff, do not make good use of layer caching and leave much low-hanging fruit for optimisation.</p>

<p>I will highlight just a few of the optimisations I made. To skip directly to overall results on size and runtime, <a href="#impact-size">click here</a>. If you are interested in the full list of optimisations, it’s in the commit history of <a href="https://github.com/epoch-research/SWE-bench">this repo</a>.</p>

<h3 id="anatomy-of-a-swe-bench-dockerfile">Anatomy of a SWE-bench Dockerfile</h3>
<p>Let’s take a closer look at a typical Django instance, <code class="language-plaintext highlighter-rouge">django__django-13371</code>.<sup id="fnref:cherry" role="doc-noteref"><a href="#fn:cherry" class="footnote" rel="footnote">2</a></sup></p>

<p>All SWE-bench images are  built in three stages, <code class="language-plaintext highlighter-rouge">base</code>, <code class="language-plaintext highlighter-rouge">env</code>, and <code class="language-plaintext highlighter-rouge">instance</code>. Many <code class="language-plaintext highlighter-rouge">instance</code> images depend on a single <code class="language-plaintext highlighter-rouge">env</code> image. For example, the 850 Django images rely on 12 <code class="language-plaintext highlighter-rouge">env</code> images.</p>

<p>The Dockerfiles are all virtually identical and outsource the actual work to a <code class="language-plaintext highlighter-rouge">setup_env.sh</code> and <code class="language-plaintext highlighter-rouge">setup_repo.sh</code> script.</p>

<p>Here is the <code class="language-plaintext highlighter-rouge">base</code> Dockerfile:</p>
<div class="language-Dockerfile highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Base (ghcr.io/epoch-research/sweb-c7d4d9d4.base.x86_64)</span>
<span class="k">FROM</span><span class="s"> --platform=linux/x86_64 ubuntu:22.04</span>

<span class="c">## ... long apt install command omitted ...</span>

<span class="c"># Download and install conda</span>
<span class="k">RUN </span>wget <span class="s1">'https://repo.anaconda.com/miniconda/Miniconda3-py311_23.11.0-2-Linux-x86_64.sh'</span> <span class="nt">-O</span> miniconda.sh <span class="se">\
</span>    <span class="o">&amp;&amp;</span> bash miniconda.sh <span class="nt">-b</span> <span class="nt">-p</span> /opt/miniconda3
<span class="c"># Add conda to PATH</span>
<span class="k">ENV</span><span class="s"> PATH=/opt/miniconda3/bin:$PATH</span>
<span class="c"># Add conda to shell startup scripts like .bashrc (DO NOT REMOVE THIS)</span>
<span class="k">RUN </span>conda init <span class="nt">--all</span>
<span class="k">RUN </span>conda config <span class="nt">--append</span> channels conda-forge

<span class="k">RUN </span>adduser <span class="nt">--disabled-password</span> <span class="nt">--gecos</span> <span class="s1">'dog'</span> nonroot
</code></pre></div></div>

<p>And here is the <code class="language-plaintext highlighter-rouge">env</code> Dockerfile:</p>

<div class="language-Dockerfile highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># env (ghcr.io/epoch-research/sweb-c7d4d9d4.env.x86_64.e83e37f52c09532c62acfb)</span>
<span class="k">FROM</span><span class="s"> --platform=linux/x86_64 ghcr.io/epoch-research/sweb-c7d4d9d4.base.x86_64:latest</span>

<span class="k">COPY</span><span class="s"> ./setup_env.sh /root/</span>
<span class="k">RUN </span><span class="nb">chmod</span> +x /root/setup_env.sh
<span class="k">RUN </span>/bin/bash <span class="nt">-c</span> <span class="s2">"source ~/.bashrc &amp;&amp; /root/setup_env.sh"</span>

<span class="k">WORKDIR</span><span class="s"> /testbed/</span>

<span class="c"># Automatically activate the testbed environment</span>
<span class="k">RUN </span><span class="nb">echo</span> <span class="s2">"source /opt/miniconda3/etc/profile.d/conda.sh &amp;&amp; conda activate testbed"</span> <span class="o">&gt;</span> /root/.bashrc
</code></pre></div></div>

<p>Finally, here is the <code class="language-plaintext highlighter-rouge">instance</code> Dockerfile:</p>

<div class="language-Dockerfile highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># instance (ghcr.io/epoch-research/sweb-c7d4d9d4.eval.x86_64.django__django-13371)</span>
<span class="k">FROM</span><span class="s"> --platform=linux/x86_64 ghcr.io/epoch-research/sweb-c7d4d9d4.env.x86_64.e83e37f52c09532c62acfb:latest</span>

<span class="k">COPY</span><span class="s"> ./setup_repo.sh /root/</span>
<span class="k">RUN </span>/bin/bash /root/setup_repo.sh

<span class="k">WORKDIR</span><span class="s"> /testbed/</span>
</code></pre></div></div>

<p>Side note: although we are here calling <code class="language-plaintext highlighter-rouge">env</code> and <code class="language-plaintext highlighter-rouge">instance</code> different ‘stages’, this is different from a genuine <a href="https://docs.docker.com/build/building/multi-stage/">multi-stage build</a>. For more detail, look at this footnote<sup id="fnref:not-multi-stage" role="doc-noteref"><a href="#fn:not-multi-stage" class="footnote" rel="footnote">3</a></sup>.</p>

<p>Let’s look at the <code class="language-plaintext highlighter-rouge">setup_env.sh</code> and <code class="language-plaintext highlighter-rouge">setup_repo.sh</code> scripts for the Django 13371 instance.</p>

<p>This is the <code class="language-plaintext highlighter-rouge">setup_env.sh</code> script:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># setup_env.sh for `env` image e83e37f52c09532c62acfb</span>
<span class="c"># (used by Django 13371)</span>
<span class="nb">set</span> <span class="nt">-euxo</span> pipefail
<span class="nb">source</span> /opt/miniconda3/bin/activate
conda create <span class="nt">-n</span> testbed <span class="nv">python</span><span class="o">=</span>3.6 <span class="nt">-y</span>
<span class="nb">cat</span> <span class="o">&lt;&lt;</span><span class="sh">'</span><span class="no">EOF_59812759871</span><span class="sh">' &gt; </span><span class="nv">$HOME</span><span class="sh">/requirements.txt
asgiref &gt;= 3.3.2
argon2-cffi &gt;= 16.1.0
...long list of dependencies truncated...
colorama; sys.platform == 'win32'
</span><span class="no">EOF_59812759871


</span>conda activate testbed <span class="o">&amp;&amp;</span> python <span class="nt">-m</span> pip <span class="nb">install</span> <span class="nt">-r</span> <span class="nv">$HOME</span>/requirements.txt
<span class="nb">rm</span> <span class="nv">$HOME</span>/requirements.txt
conda activate testbed
</code></pre></div></div>

<p>And this is the <code class="language-plaintext highlighter-rouge">setup_repo.sh</code> script:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># setup_repo.sh for django__django-13371</span>
<span class="nb">set</span> <span class="nt">-euxo</span> pipefail
git clone <span class="nt">-o</span> origin https://github.com/django/django /testbed
<span class="nb">chmod</span> <span class="nt">-R</span> 777 /testbed
<span class="nb">cd</span> /testbed
git reset <span class="nt">--hard</span> 3a9f192b131f7a9b0fe5783c684b23015fa67cc8
git remote remove origin
<span class="nb">source</span> /opt/miniconda3/bin/activate
conda activate testbed
<span class="nb">echo</span> <span class="s2">"Current environment: </span><span class="nv">$CONDA_DEFAULT_ENV</span><span class="s2">"</span>
python <span class="nt">-m</span> pip <span class="nb">install</span> <span class="nt">-e</span> <span class="nb">.</span>
</code></pre></div></div>

<p>There are numerous things to comment on here, but how do we find the most important optimisations to reduce the overall size of the images required to run SWE-bench?</p>

<p>We can use the fantastic tool <code class="language-plaintext highlighter-rouge">dive</code> (<a href="https://github.com/wagoodman/dive">github.com/wagoodman/dive</a>), which lets us see the layers of an image and their size. We can also see what actually changed on the filesystem in each layer with the file tree view on the right-hand side.</p>

<p>For example, here is the <code class="language-plaintext highlighter-rouge">dive</code> output for the Django 13371 image, focusing on the layer created by <code class="language-plaintext highlighter-rouge">setup_env.sh</code>:</p>

<figure>
<img src="../assets/images/swebench-docker/img_1.png" />
<figcaption class="caption">
    <p>The <code class="language-plaintext highlighter-rouge">dive</code> tool output for the Django 13371 image.</p>
  </figcaption>
</figure>

<p>In the next section, I’ll explain how to interpret this output to suggest optimisations.</p>

<h3 id="moving-the-git-clone-operation">Moving the git clone operation</h3>
<p>One salient feature of the output above can be seen from the layer sizes (top-left corner) alone: the topmost layer, corresponding to <code class="language-plaintext highlighter-rouge">setup_repo.sh</code>, is 330MB. Optimizations to this layer are tens of times more impactful than optimizations to the <code class="language-plaintext highlighter-rouge">setup_env.sh</code> layer, because the <code class="language-plaintext highlighter-rouge">setup_repo.sh</code> layer is different for each instance. (The ratio should be roughly 12:850 for the full SWE-bench, which is 70x, and still well over 10x for SWE-bench Verified)</p>

<p><code class="language-plaintext highlighter-rouge">setup_repo.sh</code> does two major things in terms of disk space:</p>
<ul>
  <li>Cloning the Django repo with its full git history (<code class="language-plaintext highlighter-rouge">git clone -o origin https://github.com/django/django /testbed</code>)</li>
  <li>Installing any additional dependencies required by this specific revision, that were not already present in the <code class="language-plaintext highlighter-rouge">env</code> image (<code class="language-plaintext highlighter-rouge">python -m pip install -e .</code>)</li>
</ul>

<p>Which of these is more important? By looking at the layer contents, we can see that, in this case, very few other dependencies were needed, and cloning the repo took up virtually all the 330MB.</p>

<figure>
<img src="../assets/images/swebench-docker/img_3.png" />
<figcaption class="caption">
    <p>The <code class="language-plaintext highlighter-rouge">dive</code> output for the Django 13371 image, focused on the final (topmost) layer.</p>
  </figcaption>
</figure>

<p>This represents an opportunity for optimization. We can move the <code class="language-plaintext highlighter-rouge">git clone</code> operation to the <code class="language-plaintext highlighter-rouge">env</code> image, so that it is shared across many Django instances. <code class="language-plaintext highlighter-rouge">setup_repo.sh</code> will only need to <code class="language-plaintext highlighter-rouge">git reset --hard</code> to the correct commit. This optimization is especially strong because the git history itself, stored in <code class="language-plaintext highlighter-rouge">.git</code>, represents 291MB of the 330MB layer size.</p>

<p>The new final layer is 40MB:</p>

<figure>
<img src="../assets/images/swebench-docker/img_2.png" />
<figcaption class="caption">
    <p>The optimized final layer reduced from 330MB to 40MB after moving the git clone operation to the env stage.</p>
  </figcaption>
</figure>

<p>The diff between the two codebases, which represents the size of this layer, could no doubt be optimized much further. In this example the diff is the same size as the whole codebase (excluding the git history), because we are using a very naive approach: just cloning the latest version at the <code class="language-plaintext highlighter-rouge">env</code> stage. Instead, we could check out the appropriate revision that should be closer to the revision at the instance stage. However, for this project I kept the changes as simple as possible, in order to more easily be confident that the optimized instance images are still identical to the original ones.</p>

<h4 id="should-the-git-history-be-included">Should the git history be included?</h4>
<p>For this project I focused on pure size optimisations, because the images in the public registry should be identical to those that would be generated by the original build scripts from the SWE-bench authors. However, as a side note, it’s worth asking whether the git history should be included at all. It makes sense for the model to have access to the past git history, like a human developer would. However, the model should not have access to <em>future</em> history from after the PR was merged. A sophisticated cheating model could in theory reward hack the evaluation if there is any way to access future history. I believe that is possible in some circumstances even after a <code class="language-plaintext highlighter-rouge">git reset --hard</code> and <code class="language-plaintext highlighter-rouge">git remote remove origin</code>. For example, if version tags are used, the model could <code class="language-plaintext highlighter-rouge">git checkout &lt;tag&gt;</code> a future tag. Or it could access the dangling commits in some way, perhaps with <code class="language-plaintext highlighter-rouge">git fsck --lost-found</code>. I believe this is unlikely to be a problem currently, but could become one with future models.</p>

<h3 id="the-matplotlib-19-gb-top-layer">The matplotlib 1.9 GB top layer</h3>
<p>The next thing I noticed is that many matplotlib images were among the largest, often weighing in at 9GB. If we look at instance <code class="language-plaintext highlighter-rouge">matplotlib__matplotlib-23913</code>, we can see that <code class="language-plaintext highlighter-rouge">setup_repo.sh</code> is as follows:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># setup_repo.sh for matplotlib__matplotlib-23913</span>
<span class="nb">set</span> <span class="nt">-euxo</span> pipefail
git clone <span class="nt">-o</span> origin https://github.com/matplotlib/matplotlib /testbed
<span class="nb">chmod</span> <span class="nt">-R</span> 777 /testbed
<span class="nb">cd</span> /testbed
git reset <span class="nt">--hard</span> 5c4595267ccd3daf78f5fd05693b7ecbcd575c1e
git remote remove origin
<span class="nb">source</span> /opt/miniconda3/bin/activate
conda activate testbed
<span class="nb">echo</span> <span class="s2">"Current environment: </span><span class="nv">$CONDA_DEFAULT_ENV</span><span class="s2">"</span>
apt-get <span class="nt">-y</span> update <span class="o">&amp;&amp;</span> apt-get <span class="nt">-y</span> upgrade <span class="o">&amp;&amp;</span> <span class="nv">DEBIAN_FRONTEND</span><span class="o">=</span>noninteractive apt-get <span class="nb">install</span> <span class="nt">-y</span> imagemagick ffmpeg texlive texlive-latex-extra texlive-fonts-recommended texlive-xetex texlive-luatex cm-super dvipng
python <span class="nt">-m</span> pip <span class="nb">install</span> <span class="nt">-e</span> <span class="nb">.</span>
</code></pre></div></div>

<p>The penultimate line installs a large number of heavy apt dependencies. This contributes to making the last layer 1,900 MB in size!</p>

<p>Should these commands be at the instance stage? They are taken from the <code class="language-plaintext highlighter-rouge">pre_install</code> key in a config dictionary that looks like this:</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># swebench/harness/constants.py
</span>
<span class="c1"># ... 
</span><span class="n">SPECS_MATPLOTLIB</span><span class="p">.</span><span class="n">update</span><span class="p">(</span>
    <span class="p">{</span>
        <span class="n">k</span><span class="p">:</span> <span class="p">{</span>
            <span class="s">"python"</span><span class="p">:</span> <span class="s">"3.8"</span><span class="p">,</span>
            <span class="s">"packages"</span><span class="p">:</span> <span class="s">"requirements.txt"</span><span class="p">,</span>
            <span class="s">"install"</span><span class="p">:</span> <span class="s">"python -m pip install -e ."</span><span class="p">,</span>
            <span class="s">"pre_install"</span><span class="p">:</span> <span class="p">[</span>
                <span class="s">"apt-get -y update &amp;&amp; apt-get -y upgrade &amp;&amp; DEBIAN_FRONTEND=noninteractive apt-get install -y imagemagick ffmpeg libfreetype6-dev pkg-config texlive texlive-latex-extra texlive-fonts-recommended texlive-xetex texlive-luatex cm-super"</span>
            <span class="p">],</span>
            <span class="s">"pip_packages"</span><span class="p">:</span> <span class="p">[</span><span class="s">"pytest"</span><span class="p">,</span> <span class="s">"ipython"</span><span class="p">],</span>
            <span class="s">"test_cmd"</span><span class="p">:</span> <span class="n">TEST_PYTEST</span><span class="p">,</span>
        <span class="p">}</span>
        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="p">[</span><span class="s">"3.1"</span><span class="p">,</span> <span class="s">"3.2"</span><span class="p">,</span> <span class="s">"3.3"</span><span class="p">,</span> <span class="s">"3.4"</span><span class="p">]</span>
    <span class="p">}</span>
<span class="p">)</span>

<span class="n">SPECS_MATPLOTLIB</span><span class="p">.</span><span class="n">update</span><span class="p">(</span>
    <span class="p">{</span>
        <span class="n">k</span><span class="p">:</span> <span class="p">{</span>
            <span class="s">"python"</span><span class="p">:</span> <span class="s">"3.5"</span><span class="p">,</span>
            <span class="s">"install"</span><span class="p">:</span> <span class="s">"python setup.py build; python setup.py install"</span><span class="p">,</span>
            <span class="s">"pre_install"</span><span class="p">:</span> <span class="p">[</span>
                <span class="s">"apt-get -y update &amp;&amp; apt-get -y upgrade &amp;&amp; apt-get install -y imagemagick ffmpeg"</span>
            <span class="p">],</span>
            <span class="s">"pip_packages"</span><span class="p">:</span> <span class="p">[</span><span class="s">"pytest"</span><span class="p">],</span>
            <span class="s">"execute_test_as_nonroot"</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
            <span class="s">"test_cmd"</span><span class="p">:</span> <span class="n">TEST_PYTEST</span><span class="p">,</span>
        <span class="p">}</span>
        <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="p">[</span><span class="s">"2.0"</span><span class="p">,</span> <span class="s">"2.1"</span><span class="p">,</span> <span class="s">"2.2"</span><span class="p">,</span> <span class="s">"1.0"</span><span class="p">,</span> <span class="s">"1.1"</span><span class="p">,</span> <span class="s">"1.2"</span><span class="p">,</span> <span class="s">"1.3"</span><span class="p">,</span> <span class="s">"1.4"</span><span class="p">,</span> <span class="s">"1.5"</span><span class="p">]</span>
    <span class="p">}</span>
<span class="p">)</span>
</code></pre></div></div>

<p>The <code class="language-plaintext highlighter-rouge">pre_install</code> command only depends on the version <code class="language-plaintext highlighter-rouge">k</code> of matplotlib, not on the specific instance. Therefore, it makes sense to move this command to a deeper layer, i.e. to the <code class="language-plaintext highlighter-rouge">env</code> image. Doing so reduces the size of the topmost layer from 1,900 MB to 110MB, a 17x reduction.</p>

<h3 id="disabling-the-pip-cache-or-how-to-go-insane">Disabling the pip cache (or how to go insane)</h3>
<p>A much simpler optimisation is to disable the pip cache. It’s standard practice in Dockerfiles to pass <code class="language-plaintext highlighter-rouge">--no-cache-dir</code> to pip, so that the pip cache is not stored in the image. I only bring this one up because it led me to an interesting rabbit hole.</p>

<p>There are <code class="language-plaintext highlighter-rouge">pip</code> commands in a number of places in the setup scripts. To keep diffs simple, I thought: better to use the  <code class="language-plaintext highlighter-rouge">PIP_NO_CACHE_DIR</code> environment variable, rather than adding the <code class="language-plaintext highlighter-rouge">--no-cache-dir</code> flag to every pip command. This very reasonable idea was about to lose me a day of my life.</p>

<p>I set <code class="language-plaintext highlighter-rouge">PIP_NO_CACHE_DIR=1</code> and tested it on a few images, and it worked as expected. However, when I wanted to rebuild all the images, I discovered that <em>some</em> would no longer build, with a mysterious traceback looking something like this:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Traceback (most recent call last):
  File "/local/lib/python3.5/site-packages/pip/_internal/basecommand.py", line 78, in _build_session
    if options.cache_dir else None
  File "/lib/python3.5/posixpath.py", line 89, in join
    genericpath._check_arg_types('join', a, *p)
  File "/lib/python3.5/genericpath.py", line 143, in _check_arg_types
    (funcname, s.__class__.__name__)) from None
TypeError: join() argument must be str or bytes, not 'int'
</code></pre></div></div>

<p>I was baffled that the behaviour of <code class="language-plaintext highlighter-rouge">pip</code> could change between instances, because <code class="language-plaintext highlighter-rouge">pip</code> is one of the first things installed in the <code class="language-plaintext highlighter-rouge">base</code> image that all others inherit from:</p>

<div class="language-Dockerfile highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">RUN </span>apt update <span class="o">&amp;&amp;</span> apt <span class="nb">install</span> <span class="nt">-y</span> <span class="se">\
</span>...
python3 \
python3-pip 
</code></pre></div></div>

<p>The traceback did lead me to <a href="https://github.com/pypa/pip/issues/5385">this ancient GitHub issue</a> from 2018. The issue was fixed in <a href="https://github.com/pypa/pip/pull/5884">this PR</a>, which was merged into <code class="language-plaintext highlighter-rouge">pip</code> 19 and later.</p>

<p>However, my base image used a much more recent version of <code class="language-plaintext highlighter-rouge">pip</code>.</p>

<p>After much despair and gnashing of teeth, I eventually discovered that the images use Anaconda at the <code class="language-plaintext highlighter-rouge">env</code> stage like this:</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># swebench/harness/test_spec.py
</span><span class="n">cmd</span> <span class="o">=</span> <span class="sa">f</span><span class="s">"conda create -n </span><span class="si">{</span><span class="n">env_name</span><span class="si">}</span><span class="s"> python=</span><span class="si">{</span><span class="n">specs</span><span class="p">[</span><span class="s">'python'</span><span class="p">]</span><span class="si">}</span><span class="s"> -y"</span>
</code></pre></div></div>

<p>Anaconda installs different versions of <code class="language-plaintext highlighter-rouge">pip</code> depending on the Python version. The oldest issues in the SWE-bench dataset are very old. They use ancient versions of Python, and hence of <code class="language-plaintext highlighter-rouge">pip</code>. For example, Django 5470 is from 2015, and the corresponding image uses Python 3.5 and <code class="language-plaintext highlighter-rouge">pip</code> 10.</p>

<p>So, if <code class="language-plaintext highlighter-rouge">PIP_NO_CACHE_DIR=1</code> crashes pip on pip &lt; 19, how were we supposed to disable the cache? As I found out by GitHub comments from 2016, by setting <code class="language-plaintext highlighter-rouge">PIP_NO_CACHE_DIR=0</code>!</p>

<figure>
<img src="../assets/images/swebench-docker/img_4.png" />
<figcaption class="caption">
    <p>GitHub <a href="https://github.com/pypa/pip/issues/2897#issuecomment-267380843">comment</a> from 2016 expressing surprise that one needs to set <code class="language-plaintext highlighter-rouge">PIP_NO_CACHE_DIR=0</code> to disable the pip cache.</p>
  </figcaption>
</figure>

<p>The aforementioned PR (merged into <code class="language-plaintext highlighter-rouge">pip</code> 19) fixes the crash, and causes <code class="language-plaintext highlighter-rouge">PIP_NO_CACHE_DIR=1</code> to disable the cache as expected. However, backward compatibility was preserved with the “well-known” behaviour that <code class="language-plaintext highlighter-rouge">PIP_NO_CACHE_DIR=0</code> disables the cache.</p>

<figure>
<img src="../assets/images/swebench-docker/img_5.png" />
<figcaption class="caption">
    <p>GitHub <a href="https://github.com/pypa/pip/issues/5385#issuecomment-415734783">comment</a> from 2018 discussing backward compatibility.</p>
  </figcaption>
</figure>

<p>In summary, I was able to disable the cache for all instances by setting <code class="language-plaintext highlighter-rouge">PIP_NO_CACHE_DIR=0</code>. Of course, all modern documentation on pip instructs you to set <code class="language-plaintext highlighter-rouge">PIP_NO_CACHE_DIR=1</code> to disable the cache, and doesn’t mention this behaviour. So I had set up a <em>devilishly</em> confusing Dockerfile. I wrote a long code comment explaining the issue, and vowed to never do this again.</p>

<h2 id="impact-size">Impact on size</h2>
<p>The 2294 SWE-bench docker images are sometimes reported to be around 2,000 GB in size. For example, the Princeton/OpenAI team wrote that</p>

<blockquote>
  <p>By default, the harness <code class="language-plaintext highlighter-rouge">cache_level</code> is set to <code class="language-plaintext highlighter-rouge">env</code>, which means that the harness will store the base and environment images, but not the instance images.</p>

  <p>In this setting, the base and environment images will be reused across runs, but take up about 100GB of disk space. At the time of release, we require about 120GB of free disk space to run the harness with any <code class="language-plaintext highlighter-rouge">cache_level</code>. [Note by TA: they mean any <code class="language-plaintext highlighter-rouge">cache_level</code> other than <code class="language-plaintext highlighter-rouge">instance</code>]</p>

  <p>For users who want the fastest possible evaluation times, we recommend setting <code class="language-plaintext highlighter-rouge">cache_level</code> to <code class="language-plaintext highlighter-rouge">instance</code>. In this setting, the harness will store images for all instances […] However, all base, environment, and instance images will be stored, taking up about 2,000GB of disk space.</p>
</blockquote>

<p>The 120GB number (for a cache level other than <code class="language-plaintext highlighter-rouge">instance</code>) has been widely reported by evals professionals, for example:</p>

<figure>
<img src="../assets/images/swebench-docker/image-20250619172345623.png" style="max-width: 500px" />
<figcaption class="caption">
    <p>Screenshot showing reported disk space requirements for SWE-bench evaluations.</p>
  </figcaption>
</figure>

<p>Similarly, the All Hands team <a href="https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed">wrote</a> that</p>
<blockquote>
  <p>because each agent runs in its own environment, it is necessary to create many environments, which requires hundreds of gigabytes of space</p>
</blockquote>

<p>I’m not sure where the 2,000 GB number comes from. When summing the individual sizes of all (original) SWE-bench images, I get 3129 GiB. However, this ignores that many of these images share the same layers! When Docker builds or pulls these images, shared layers are only stored once.</p>

<p>When correctly calculated by summing only the sizes of the <em>unique</em> layers, the size of the unoptimized SWE-bench images comes to 684 GiB, which is nowhere near 2,000 GB. For SWE-bench Verified, the true size of the original images is 189 GiB. (You can reproduce my calculation using the script <code class="language-plaintext highlighter-rouge">get_registry_size.py</code>, and my data is also shared in the <a href="https://github.com/epoch-research/SWE-bench/">repository</a>.)</p>

<p>After all my optimisations, the total size of the SWE-bench images is 67 GiB (10x reduction) while the SWE-bench Verified set fits in 30 GiB (6x reduction).</p>

<table>
  <thead>
    <tr>
      <th> </th>
      <th>SWE-bench (2290)</th>
      <th>SWE-bench Verified (500)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Optimised (ours)</td>
      <td><strong>67 GiB</strong></td>
      <td><strong>30 GiB</strong></td>
    </tr>
    <tr>
      <td>Original</td>
      <td><strong>684 GiB</strong></td>
      <td><strong>189 GiB</strong></td>
    </tr>
    <tr>
      <td>Original, reported by SWE-bench authors</td>
      <td>1,800 GiB (2,000 GB)</td>
      <td>N/A</td>
    </tr>
  </tbody>
</table>

<h2 id="running-swe-bench-verified-in-about-an-hour">Running SWE-bench Verified in about an hour</h2>

<p>Using our image registry, we’re able to run SWE-bench Verified in 62 to 73 minutes for many major models. Specifically, we ran the benchmark on a single GitHub actions runner with 32 cores and 128GB of RAM. We gave models a limit of 300,000 tokens per sample for the whole conversation (i.e. summing input and output tokens for every request in the conversation)<sup id="fnref:fntokens" role="doc-noteref"><a href="#fn:fntokens" class="footnote" rel="footnote">4</a></sup>. Here were the runtimes for three major models:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">gemini-2.0-flash-001</code>: 62 minutes</li>
  <li><code class="language-plaintext highlighter-rouge">gpt-4o-2024-11-20</code>: 70 minutes</li>
  <li><code class="language-plaintext highlighter-rouge">claude-3-7-sonnet-20250219</code>: 63 minutes</li>
</ul>

<p>As we have discussed above, OpenHands <a href="https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed">reported</a> evaluation times of 10 minutes per sample on one machine, which they were able to reduce to about 20 seconds per sample by using 32 machines in parallel.</p>

<p>Using our optimized image registry, we achieve speeds of about 8 seconds per sample on a single large machine. This is 77x faster than OpenHands, and still 2.4 times faster than what OpenHands achieved with 32 machines. The comparison isn’t strictly a fair one; while OpenHands didn’t share details of their hardware, they were likely using less powerful machines.</p>

<p>Note that we have high API rate limits on these models, which are necessary to replicate these runtimes. Each eval used 100-150M tokens (of which the majority cached tokens), so we are using roughly 2M tokens per minute during the evaluation.</p>

<h2 id="how-to-use-our-image-registry">How to use our image registry</h2>

<p>Our <a href="https://github.com/orgs/epoch-research/packages?repo_name=SWE-bench">image registry</a> is public, MIT-licensed, and hosted on <a href="https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry">GitHub Container Registry</a>. Each image can be accessed by its name, and we follow the same naming pattern as the original SWE-bench authors. At the moment, all images only have the tag <code class="language-plaintext highlighter-rouge">latest</code>.</p>

<p>The naming format is <code class="language-plaintext highlighter-rouge">ghcr.io/epoch-research/swe-bench.eval.&lt;arch&gt;.&lt;instance_id&gt;</code>, for example <code class="language-plaintext highlighter-rouge">ghcr.io/epoch-research/swe-bench.eval.x86_64.astropy__astropy-13236</code>.</p>

<p>For <code class="language-plaintext highlighter-rouge">x86_64</code>, we’re able to build 2290/2294 (99.8%) of the images, and all 500/500 out of the SWE-bench Verified set.</p>

<p>For <code class="language-plaintext highlighter-rouge">arm64</code>, 1819 (out of 2294) images are provided on a best-effort basis, and have not been tested.</p>
<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:metaphor" role="doc-endnote">
      <p>Note the potentially confusing metaphor: an image is built by adding layers from bottom to top, so <em>higher</em> layers come <em>later</em> in the Dockerfile, while <em>lower</em> (deeper) layers come <em>earlier</em> in the Dockerfile. <a href="#fnref:metaphor" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:cherry" role="doc-endnote">
      <p>This example isn’t cherry-picked, I chose it at random towards the middle of the Django dataset, when sorted by issue number. (The issue numbers range from around 5000 to around 17,000, and the vast majority are in the 10,000 to 17,000 range.) <a href="#fnref:cherry" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:not-multi-stage" role="doc-endnote">

      <p>As the <a href="https://docs.docker.com/build/building/multi-stage/">docs</a> explain, the purpose of a multi-stage build is to <em>selectively copy artifacts from one stage to another</em>:</p>

      <blockquote>
        <p>With multi-stage builds, you use multiple <code class="language-plaintext highlighter-rouge">FROM</code> statements in your Dockerfile. Each <code class="language-plaintext highlighter-rouge">FROM</code> instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the final image.</p>
      </blockquote>

      <p>In a multi-stage build, we selectively copy artifacts to make the final stage smaller and more cacheable. In SWE-bench, the stages just build on top of one another without any selective copying. From the point of view of caching and of the final images being produced, it is just as if we put all the instructions in one Dockerfile. The purpose of the three stages from the SWE-bench authors is likely to make the large number of generated Dockerfiles more manageable, and to be able to selectively prune just the <code class="language-plaintext highlighter-rouge">instance</code> stages while running the benchmark on a machine with limited disk space. <a href="#fnref:not-multi-stage" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:fntokens" role="doc-endnote">
      <p>The SWE-bench Verified evaluations on our <a href="https://epoch.ai/data/ai-benchmarking-dashboard">Benchmarking Hub</a> currently set this maximum to 1 million tokens. We also don’t run the eval directly on the images as they are in the registry, but add a few very lightweight layers containing the SWE-Agent tools that we use for our evaluations. For most models, the runtime in production is very similar to the numbers in this blog post; for some reasoning models that create a lot of output, with 1 million tokens we are bottlenecked by API rate limits. For more details on our evaluation setup, see the <a href="https://epoch.ai/data/ai-benchmarking-dashboard">Benchmarking Hub</a>. <a href="#fnref:fntokens" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><summary type="html"><![CDATA[Epoch AI is releasing a public registry of optimized Docker images for SWE-bench. This allows us to run SWE-bench Verified in 62 minutes on a single GitHub actions VM.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/swebench-docker/banner.png" /><media:content medium="image" url="https://bayes.net/assets/images/swebench-docker/banner.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">How should we analyse survey forecasts of AI timelines?</title><link href="https://bayes.net/espai/" rel="alternate" type="text/html" title="How should we analyse survey forecasts of AI timelines?" /><published>2024-12-16T00:00:00+00:00</published><updated>2024-12-16T00:00:00+00:00</updated><id>https://bayes.net/espai</id><content type="html" xml:base="https://bayes.net/espai/"><![CDATA[<p style="font-size: smaller"><a href="https://aiimpacts.org/how-should-we-analyse-survey-forecasts-of-ai-timelines">Read at AI Impacts</a></p>

<p>The Expert Survey on Progress in AI (ESPAI) is a large survey of AI researchers about the future of AI, conducted in <a href="https://arxiv.org/abs/1705.08807">2016</a>, <a href="https://wiki.aiimpacts.org/doku.php?id=ai_timelines:predictions_of_human-level_ai_timelines:ai_timeline_surveys:2022_expert_survey_on_progress_in_ai">2022</a>, and <a href="https://arxiv.org/abs/2401.02843">2023</a>. One main focus of the survey is the timing of progress in AI<sup id="fnref:scope" role="doc-noteref"><a href="#fn:scope" class="footnote" rel="footnote">1</a></sup>.</p>

<p>The timing-related results of the survey are usually presented as a cumulative distribution function (CDF) showing probabilities as a function of years, in the aggregated opinion of respondents. Respondents gave triples of (year, probability) pairs for various AI milestones. Starting from these responses, two key steps of processing are required to obtain such a CDF:</p>

<ul>
  <li>Fitting a continuous probability distribution to each response</li>
  <li>Aggregating these distributions</li>
</ul>

<p>These two steps require a number of judgement calls.
In addition, summarising and presenting the results involves many other implicit choices.</p>

<p>In this report, I investigate these choices and their impact on the results of the survey (for the 2023 iteration). I provide recommendations for how the survey results should be analysed and presented in the future.</p>

<h1 id="headline-results">Headline results</h1>

<p>This plot represents a summary of my best guesses as to how the ESPAI data should be analysed and presented.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/headline_result-400-ca75d63f2.webp 400w, /generated/_posts/../assets/images/espai/headline_result-600-ca75d63f2.webp 600w, /generated/_posts/../assets/images/espai/headline_result-800-ca75d63f2.webp 800w, /generated/_posts/../assets/images/espai/headline_result-1000-ca75d63f2.webp 1000w, /generated/_posts/../assets/images/espai/headline_result-1500-ca75d63f2.webp 1500w, /generated/_posts/../assets/images/espai/headline_result-2000-ca75d63f2.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/headline_result-400-ca75d63f2.jpeg 400w, /generated/_posts/../assets/images/espai/headline_result-600-ca75d63f2.jpeg 600w, /generated/_posts/../assets/images/espai/headline_result-800-ca75d63f2.jpeg 800w, /generated/_posts/../assets/images/espai/headline_result-1000-ca75d63f2.jpeg 1000w, /generated/_posts/../assets/images/espai/headline_result-1500-ca75d63f2.jpeg 1500w, /generated/_posts/../assets/images/espai/headline_result-2000-ca75d63f2.jpeg 2000w" type="image/jpeg" /><img alt="CDF of ESPAI survey showing median and central 50% of expert responses." src="/generated/_posts/../assets/images/espai/headline_result-800-ca75d63f2.png" width="2400" height="1800" /></picture>

<div class="bootstrap-styles bootstrap-reboot">
  <div class="fw-bold">
</div>
  <div class="accordion" id="compare-headline-accordion">
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading0">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#compare-headline-accordioncontent0" aria-expanded="false" aria-controls="compare-headline-accordioncontent0">
        
<div>See previous</div>


      </button>
    </h2>
    <div id="compare-headline-accordioncontent0" class="accordion-collapse collapse" aria-labelledby="heading0">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/grace_2024_figure_3-400-639725bef.webp 400w, /generated/_posts/../assets/images/espai/grace_2024_figure_3-600-639725bef.webp 600w, /generated/_posts/../assets/images/espai/grace_2024_figure_3-800-639725bef.webp 800w, /generated/_posts/../assets/images/espai/grace_2024_figure_3-1000-639725bef.webp 1000w, /generated/_posts/../assets/images/espai/grace_2024_figure_3-1493-639725bef.webp 1493w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/grace_2024_figure_3-400-639725bef.jpeg 400w, /generated/_posts/../assets/images/espai/grace_2024_figure_3-600-639725bef.jpeg 600w, /generated/_posts/../assets/images/espai/grace_2024_figure_3-800-639725bef.jpeg 800w, /generated/_posts/../assets/images/espai/grace_2024_figure_3-1000-639725bef.jpeg 1000w, /generated/_posts/../assets/images/espai/grace_2024_figure_3-1493-639725bef.jpeg 1493w" type="image/jpeg" /><img alt="Previous headline results" src="/generated/_posts/../assets/images/espai/grace_2024_figure_3-800-639725bef.png" width="1493" height="1941" /></picture>

<p><a href="https://arxiv.org/abs/2401.02843">Thousands of AI Authors on the Future of AI</a>, Figure 3. I added annotations to the 20%, 50%, and 80% points, for comparison with my plot.</p>


      </div>
    </div>
  </div>
  
</div>
  </div>

<p>I differ from previous authors in four main ways:</p>

<ul>
  <li><strong>Show distribution of responses</strong>. Previous summary plots showed a random subset of responses, rather than quantifying the range of opinion among experts. I show a shaded area representing the central 50% of individual-level CDFs (25th to 75th percentile). <a href="#range-of-responses">More</a></li>
  <li><strong>Aggregate task and occupation questions</strong>. Previous analyses only showed task (HLMI) and occupation (FAOL) results separately, whereas I provide a single estimate combining both. By not providing a single headline result, previous approaches made summarization more difficult, and left room for selective interpretations. I find evidence that task automation (HLMI) numbers have been far more widely reported than occupation automation (FAOL). <a href="#aggregating-hlmi-faol">More</a></li>
  <li><strong>Median aggregation</strong>. I’m quite uncertain as to which method is most appropriate in this context for aggregating the individual distributions into a single distribution. The arithmetic mean of probabilities, used by previous authors, is a reasonable option. I choose the median merely because it has the convenient property that we get the same result whether we take the median in the vertical direction (probabilities) or the horizontal (years). <a href="#aggregation">More</a></li>
  <li><strong>Flexible distributions</strong>: I fit individual-level CDF data to “flexible” interpolation-based distributions that can match the input data exactly. The original authors use the Gamma distribution. This change (and distribution fitting in general) makes only a small difference to the aggregate results. <a href="#distribution-fitting">More</a></li>
</ul>

<div class="bootstrap-styles bootstrap-reboot">
  <div class="fw-bold">
</div>
  <div class="accordion" id="combined-effect-headline-accordion">
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading0">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#combined-effect-headline-accordioncontent0" aria-expanded="false" aria-controls="combined-effect-headline-accordioncontent0">
        
<div>Compare mine (3/4 suggestions) with previous</div>


      </button>
    </h2>
    <div id="combined-effect-headline-accordioncontent0" class="accordion-collapse collapse" aria-labelledby="heading0">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/combined_effect_headline-400-b410acc3d.webp 400w, /generated/_posts/../assets/images/espai/combined_effect_headline-600-b410acc3d.webp 600w, /generated/_posts/../assets/images/espai/combined_effect_headline-800-b410acc3d.webp 800w, /generated/_posts/../assets/images/espai/combined_effect_headline-1000-b410acc3d.webp 1000w, /generated/_posts/../assets/images/espai/combined_effect_headline-1500-b410acc3d.webp 1500w, /generated/_posts/../assets/images/espai/combined_effect_headline-1920-b410acc3d.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/combined_effect_headline-400-b410acc3d.jpeg 400w, /generated/_posts/../assets/images/espai/combined_effect_headline-600-b410acc3d.jpeg 600w, /generated/_posts/../assets/images/espai/combined_effect_headline-800-b410acc3d.jpeg 800w, /generated/_posts/../assets/images/espai/combined_effect_headline-1000-b410acc3d.jpeg 1000w, /generated/_posts/../assets/images/espai/combined_effect_headline-1500-b410acc3d.jpeg 1500w, /generated/_posts/../assets/images/espai/combined_effect_headline-1920-b410acc3d.jpeg 1920w" type="image/jpeg" /><img alt="Direct comparison of 3/4 elements of our approach with previous results" src="/generated/_posts/../assets/images/espai/combined_effect_headline-800-b410acc3d.png" width="1920" height="1440" /></picture>

<p>Combined effect of our approach (3/4 elements), compared with previous results. For legibility, this does not show the range of responses, although I consider this one of the most important innovations over previous analyses.</p>

<table>
  <thead>
    <tr>
      <th>CDF</th>
      <th>Framing of automation</th>
      <th>Distribution family</th>
      <th>Loss function</th>
      <th>Aggregation</th>
      <th>p20</th>
      <th>p50</th>
      <th>p80</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span style="color: blue">Blue (ours)</span></td>
      <td>Aggregate of tasks (HLMI) and occupations (FAOL)</td>
      <td>Flexible</td>
      <td>Not applicable</td>
      <td>Median</td>
      <td>2048</td>
      <td>2073</td>
      <td>2103</td>
    </tr>
    <tr>
      <td><span style="color: orange">Orange (previous)</span></td>
      <td>Tasks (HLMI)</td>
      <td>Gamma</td>
      <td>MSE of probabilities</td>
      <td>Arithmetic mean of probabilities</td>
      <td>2031</td>
      <td>2047</td>
      <td>2110</td>
    </tr>
    <tr>
      <td><span style="color: green">Green (previous)</span></td>
      <td>Occupations (FAOL)</td>
      <td>Gamma</td>
      <td>MSE of probabilities</td>
      <td>Arithmetic mean of probabilities</td>
      <td>2051</td>
      <td>2110</td>
      <td>2843</td>
    </tr>
  </tbody>
</table>

<p>Note: Although previous authors give equal prominence to the orange (tasks, HLMI) and green (occupations, FAOL) results, I find evidence that the orange (tasks, HLMI) curve has been far more widely reported (<a href="#aggregating-hlmi-faol">More</a>).</p>


      </div>
    </div>
  </div>
  
</div>
  </div>

<p>The last two points (aggregation and distribution fitting) directly affect the numerical results. The first two are about how the headline result of the survey should be conceived of and communicated.</p>

<p>These four choices vary in both their <em>impact</em>, and in my <em>confidence</em> that they represent an improvement over previous analyses. The two tables below summarise my views on the topic.</p>

<table>
  <thead>
    <tr>
      <th>Choice</th>
      <th>Impact on understanding and communication of main results</th>
      <th>Confidence it’s an improvement</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Show range of responses (<a href="#range-of-responses">More</a>)</td>
      <td>High</td>
      <td>Very high</td>
    </tr>
    <tr>
      <td>Aggregate FAOL and HLMI (<a href="#aggregating-hlmi-faol">More</a>)</td>
      <td>High</td>
      <td>Moderate</td>
    </tr>
  </tbody>
</table>

<table>
  <thead>
    <tr>
      <th>Choice</th>
      <th>Numerical impact on aggregate CDF</th>
      <th>Confidence it’s an improvement</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Median aggregation (<a href="#aggregation">More</a>)</td>
      <td>High</td>
      <td>Very low</td>
    </tr>
    <tr>
      <td>Flexible distributions (<a href="#distribution-fitting">More</a>)</td>
      <td>Minimal</td>
      <td>High</td>
    </tr>
  </tbody>
</table>

<p>Even if you disagree with these choices, you can still benefit from my work! The <a href="#codebase">code</a> used to implement these new variations is open source. It provides user-friendly configuration objects that make it easy to run your own analysis and produce your own plots. The source data is included in version control. AI Impacts plans to use this code when analysing future iterations of ESPAI. I also welcome engagement from the wider research community.</p>

<h2 id="suggested-textual-description">Suggested textual description</h2>

<p>If you need a textual description of the results in the plot, I would recommend:</p>

<blockquote>
  <p>Experts were asked when it will be feasible to automate all tasks or occupations. The median expert thinks this is 20% likely by 2048, and 80% likely by 2103. There was substantial disagreement among experts. For automation by 2048, the middle half of experts assigned it a probability between 1% and a 60% (meaning ¼ assigned it a chance lower than 1%, and ¼ gave a chance higher than 60%). For automation by 2103, the central half of experts forecasts ranged from a 25% chance to a 100% chance.<sup id="fnref:language" role="doc-noteref"><a href="#fn:language" class="footnote" rel="footnote">2</a></sup></p>
</blockquote>

<p>This description still contains big simplifications (e.g. using “the median expert thinks” even though no expert directly answered questions about 2048 or 2103). However, it communicates both:</p>

<ul>
  <li>The uncertainty represented by the aggregated CDF (using the 60% belief interval from 20% to 80%)</li>
  <li>The range of disagreement among experts (using the central 50% of responses)</li>
</ul>

<p>In some cases, this may be too much information. I recommend if at all possible that the results should not be reduced to the single number of the year by which experts expect a 50% chance of advanced AI. Instead, emphasise that we have a probability distribution over years by giving two points on the distribution. So if a very concise summary is required, you could use:</p>

<blockquote>
  <p>Surveyed experts think it’s unlikely (20%) it will become feasible to automate all tasks or occupations by 2048, but it probably will (80%) by 2103.</p>
</blockquote>

<p>If even greater simplicity is required, I would urge something like the following, over just using the median year:</p>

<blockquote>
  <p>AI experts think full automation is most likely to become feasible between 2048 and 2103.</p>
</blockquote>

<h1 class="no_toc" id="contents">Contents</h1>
<ol id="markdown-toc">
  <li><a href="#headline-results" id="markdown-toc-headline-results">Headline results</a>    <ol>
      <li><a href="#suggested-textual-description" id="markdown-toc-suggested-textual-description">Suggested textual description</a></li>
    </ol>
  </li>
  <li><a href="#the-distribution-of-raw-responses" id="markdown-toc-the-distribution-of-raw-responses">The distribution of raw responses</a>    <ol>
      <li><a href="#example-retail-salesperson-occupation" id="markdown-toc-example-retail-salesperson-occupation">Example: Retail Salesperson occupation</a></li>
      <li><a href="#timing-of-human-level-performance" id="markdown-toc-timing-of-human-level-performance">Timing of human-level performance</a></li>
    </ol>
  </li>
  <li><a href="#aggregation" id="markdown-toc-aggregation">Aggregation</a>    <ol>
      <li><a href="#possible-methods" id="markdown-toc-possible-methods">Possible methods</a></li>
      <li><a href="#mean-vs-median-aggregation" id="markdown-toc-mean-vs-median-aggregation">Mean vs Median aggregation</a></li>
      <li><a href="#why-the-mean-and-median-differ" id="markdown-toc-why-the-mean-and-median-differ">Why the mean and median differ</a></li>
      <li><a href="#aside-the-winsorized-geometric-mean-of-odds" id="markdown-toc-aside-the-winsorized-geometric-mean-of-odds">Aside: the winsorized geometric mean of odds</a></li>
    </ol>
  </li>
  <li><a href="#distribution-fitting" id="markdown-toc-distribution-fitting">Distribution fitting</a>    <ol>
      <li><a href="#why-fit-a-distribution" id="markdown-toc-why-fit-a-distribution">Why fit a distribution?</a></li>
      <li><a href="#limitations-of-previous-analyses" id="markdown-toc-limitations-of-previous-analyses">Limitations of previous analyses</a>        <ol>
          <li><a href="#constraints-of-gamma-distribution" id="markdown-toc-constraints-of-gamma-distribution">Constraints of Gamma distribution</a></li>
          <li><a href="#inappropriate-loss-function" id="markdown-toc-inappropriate-loss-function">Inappropriate loss function</a></li>
        </ol>
      </li>
      <li><a href="#flexible-distributions" id="markdown-toc-flexible-distributions">Flexible distributions</a></li>
      <li><a href="#other-distributions" id="markdown-toc-other-distributions">Other distributions</a></li>
    </ol>
  </li>
  <li><a href="#range-of-responses" id="markdown-toc-range-of-responses">Displaying the distribution of responses</a></li>
  <li><a href="#aggregating-hlmi-faol" id="markdown-toc-aggregating-hlmi-faol">Aggregating across the task and occupation framings</a></li>
  <li><a href="#codebase" id="markdown-toc-codebase">Codebase</a></li>
</ol>

<h1 id="the-distribution-of-raw-responses">The distribution of raw responses</h1>

<p>Even readers who are familiar with ESPAI may only have seen the results after processing. It can be helpful to look at the raw data, i.e. respondent’s answers to questions before any processing, to remind ourselves how the survey was conducted.</p>

<p>All questions about how soon a milestone would be reached were framed in two ways: fixed-years and fixed-probabilities. Half of respondents were asked to estimate the probability that a milestone would be reached by a given year (“fixed-years framing”), while the other half were asked to estimate the year by which the milestone would be feasible with a given probability (“fixed-probabilities framing”).</p>

<h2 id="example-retail-salesperson-occupation">Example: Retail Salesperson occupation</h2>
<p>Responses about one such milestone (say, the occupation of retail salesperson in the example below), if shown as a scatterplot, form three horizontal lines for fixed probabilities, and three vertical lines for fixed years. These correspond to the six questions being asked about the milestone:</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-400-3419bf229.webp 400w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-600-3419bf229.webp 600w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-800-3419bf229.webp 800w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-1000-3419bf229.webp 1000w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-1500-3419bf229.webp 1500w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-1920-3419bf229.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-400-3419bf229.jpeg 400w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-600-3419bf229.jpeg 600w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-800-3419bf229.jpeg 800w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-1000-3419bf229.jpeg 1000w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-1500-3419bf229.jpeg 1500w, /generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-1920-3419bf229.jpeg 1920w" type="image/jpeg" /><img alt="Scatterplot of survey responses for automating retail salesperson occupation, showing fixed probabilities and fixed years." src="/generated/_posts/../assets/images/espai/raw_scatter_retail_salesperson-800-3419bf229.png" width="1920" height="1440" /></picture>

<p>The scatterplot is a helpful reminder of the data’s shape in its rawest form. However, all scatterplots will form three horizontal and three vertical lines. We can show more structured information about the distribution of responses for each of the six questions by using six box and whisker plots<sup id="fnref:whiskers" role="doc-noteref"><a href="#fn:whiskers" class="footnote" rel="footnote">3</a></sup>, as shown below:</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-400-01fad8fce.webp 400w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-600-01fad8fce.webp 600w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-800-01fad8fce.webp 800w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-1000-01fad8fce.webp 1000w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-1500-01fad8fce.webp 1500w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-1920-01fad8fce.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-400-01fad8fce.jpeg 400w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-600-01fad8fce.jpeg 600w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-800-01fad8fce.jpeg 800w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-1000-01fad8fce.jpeg 1000w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-1500-01fad8fce.jpeg 1500w, /generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-1920-01fad8fce.jpeg 1920w" type="image/jpeg" /><img alt="Box plots showing probability and year distributions for automating retail salesperson occupation." src="/generated/_posts/../assets/images/espai/raw_boxplot_retail_salesperson-800-01fad8fce.png" width="1920" height="1440" /></picture>

<p>We can see several useful things in this set of box plots:</p>

<ul>
  <li><strong>There is a large framing effect, whereby the fixed-years framing produces later predictions</strong>. (This effect is familiar from previous analyses of ESPAI, where it has been shown to occur systematically).
    <ul>
      <li>For example, the prediction (2043, 50%) is the <em>85th percentile</em> of responses for the 50% question in the fixed-probabilities framing, while the same prediction is the <em>median</em> response for the 2043 question in the fixed-years framing.</li>
      <li>When asked about 2073 in the fixed-years framing, the median response was 90%, which is much later than even the 85th percentile response to the 90% question int the fixed-probabilities framing.</li>
    </ul>
  </li>
  <li><strong>Responses follow a skewed distribution</strong>
    <ul>
      <li>For all three questions in the fixed-probabilities framing, the responses have a large right skew</li>
      <li>In the fixed-years framing, the 2033 question produces a right skew (up skew in the boxplot), whereas the 2073 question produces a left-skew (down skew in the boxplot), with more than 25% of respondents giving a probability of 100%.</li>
    </ul>
  </li>
  <li><strong>There is a wide range of responses, indicating substantial disagreement among respondents</strong>. For example, when asked about 2043, the interval (centred on the median) that contains half of responses ranged from a 30% chance to a 90% chance. The interval that contains 70% of responses ranged from a 10% chance to a 98% chance.</li>
</ul>

<p>We can now look at the distribution of raw responses for the timing of human-level performance.</p>

<h2 id="timing-of-human-level-performance">Timing of human-level performance</h2>
<p>When the survey investigated the timing of human-level performance, the question was framed in two ways, as tasks, and as occupations<sup id="fnref:other_hlmi_faol_differences" role="doc-noteref"><a href="#fn:other_hlmi_faol_differences" class="footnote" rel="footnote">4</a></sup>:</p>

<ul>
  <li>“High-Level Machine Intelligence” (HLMI): when unaided machines can accomplish every <strong>task</strong> better and more cheaply than human workers.</li>
  <li>“Full Automation of Labor” (FAOL): when for any <strong>occupation</strong>, machines could be built to carry it out  better and more cheaply than human workers.</li>
</ul>

<p>We can now take each of these in turn (expand the collapsible sections below).</p>

<div class="bootstrap-styles bootstrap-reboot">
  <div class="fw-bold"><div>Raw data</div>
</div>
  <div class="accordion" id="raw-data-outer-accordion">
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading0">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#raw-data-outer-accordioncontent0" aria-expanded="false" aria-controls="raw-data-outer-accordioncontent0">
        
<div>Full Automation of Labor (FAOL)</div>


      </button>
    </h2>
    <div id="raw-data-outer-accordioncontent0" class="accordion-collapse collapse" aria-labelledby="heading0">
      <div class="accordion-body">
        
<div class="bootstrap-styles bootstrap-reboot">
  <div class="fw-bold">
</div>
  <div class="accordion" id="raw-data-faol-inner-accordion">
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading0">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#raw-data-faol-inner-accordioncontent0" aria-expanded="false" aria-controls="raw-data-faol-inner-accordioncontent0">
        
<div>Box Plot</div>


      </button>
    </h2>
    <div id="raw-data-faol-inner-accordioncontent0" class="accordion-collapse collapse" aria-labelledby="heading0">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/raw_boxplot_FAOL-400-931918384.webp 400w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-600-931918384.webp 600w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-800-931918384.webp 800w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-1000-931918384.webp 1000w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-1500-931918384.webp 1500w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-1920-931918384.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/raw_boxplot_FAOL-400-931918384.jpeg 400w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-600-931918384.jpeg 600w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-800-931918384.jpeg 800w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-1000-931918384.jpeg 1000w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-1500-931918384.jpeg 1500w, /generated/_posts/../assets/images/espai/raw_boxplot_FAOL-1920-931918384.jpeg 1920w" type="image/jpeg" /><img alt="Box plots for FAOL in the fixed-years and fixed-probabilities framings." src="/generated/_posts/../assets/images/espai/raw_boxplot_FAOL-800-931918384.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading1">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#raw-data-faol-inner-accordioncontent1" aria-expanded="false" aria-controls="raw-data-faol-inner-accordioncontent1">
        <div>Fixed Probabilities</div>


      </button>
    </h2>
    <div id="raw-data-faol-inner-accordioncontent1" class="accordion-collapse collapse" aria-labelledby="heading1">
      <div class="accordion-body">
        
<p>In the fixed probabilities framing, respondents were asked for the number of years until a 10%, 50%, and 90% probability of FAOL.</p>

<table>
  <thead>
    <tr>
      <th style="text-align: left">Probability of FAOL</th>
      <th style="text-align: right">Mean response</th>
      <th style="text-align: right">15th percentile response</th>
      <th style="text-align: right">Median response</th>
      <th style="text-align: right">85th percentile response</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">10%</td>
      <td style="text-align: right">508177</td>
      <td style="text-align: right">10</td>
      <td style="text-align: right">40</td>
      <td style="text-align: right">100</td>
    </tr>
    <tr>
      <td style="text-align: left">50%</td>
      <td style="text-align: right">783590</td>
      <td style="text-align: right">20</td>
      <td style="text-align: right">70</td>
      <td style="text-align: right">200</td>
    </tr>
    <tr>
      <td style="text-align: left">90%</td>
      <td style="text-align: right">1.01197e+06</td>
      <td style="text-align: right">35</td>
      <td style="text-align: right">100</td>
      <td style="text-align: right">500</td>
    </tr>
  </tbody>
</table>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading2">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#raw-data-faol-inner-accordioncontent2" aria-expanded="false" aria-controls="raw-data-faol-inner-accordioncontent2">
        <div>Fixed Years</div>


      </button>
    </h2>
    <div id="raw-data-faol-inner-accordioncontent2" class="accordion-collapse collapse" aria-labelledby="heading2">
      <div class="accordion-body">
        
<p>In the fixed years framing, respondents were asked for the probability of FAOL within 10, 20, and 50 years.</p>

<table>
  <thead>
    <tr>
      <th style="text-align: right">Years until FAOL</th>
      <th style="text-align: left">Mean response</th>
      <th style="text-align: left">15th percentile response</th>
      <th style="text-align: left">Median response</th>
      <th style="text-align: left">85th percentile response</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: right">10</td>
      <td style="text-align: left">6.02%</td>
      <td style="text-align: left">0.00%</td>
      <td style="text-align: left">0.00%</td>
      <td style="text-align: left">10.00%</td>
    </tr>
    <tr>
      <td style="text-align: right">20</td>
      <td style="text-align: left">12.30%</td>
      <td style="text-align: left">0.00%</td>
      <td style="text-align: left">2.00%</td>
      <td style="text-align: left">30.00%</td>
    </tr>
    <tr>
      <td style="text-align: right">50</td>
      <td style="text-align: left">24.66%</td>
      <td style="text-align: left">0.00%</td>
      <td style="text-align: left">10.00%</td>
      <td style="text-align: left">60.00%</td>
    </tr>
  </tbody>
</table>


      </div>
    </div>
  </div>
  
</div>
  </div>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading1">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#raw-data-outer-accordioncontent1" aria-expanded="false" aria-controls="raw-data-outer-accordioncontent1">
        <div>High Level Machine Intelligence (HLMI)</div>


      </button>
    </h2>
    <div id="raw-data-outer-accordioncontent1" class="accordion-collapse collapse" aria-labelledby="heading1">
      <div class="accordion-body">
        
<div class="bootstrap-styles bootstrap-reboot">
  <div class="fw-bold">
</div>
  <div class="accordion" id="raw-data-hlmi-inner-accordion">
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading0">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#raw-data-hlmi-inner-accordioncontent0" aria-expanded="false" aria-controls="raw-data-hlmi-inner-accordioncontent0">
        
<div>Box Plot</div>


      </button>
    </h2>
    <div id="raw-data-hlmi-inner-accordioncontent0" class="accordion-collapse collapse" aria-labelledby="heading0">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/raw_boxplot_HLMI-400-ff157ddef.webp 400w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-600-ff157ddef.webp 600w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-800-ff157ddef.webp 800w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-1000-ff157ddef.webp 1000w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-1500-ff157ddef.webp 1500w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-1920-ff157ddef.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/raw_boxplot_HLMI-400-ff157ddef.jpeg 400w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-600-ff157ddef.jpeg 600w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-800-ff157ddef.jpeg 800w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-1000-ff157ddef.jpeg 1000w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-1500-ff157ddef.jpeg 1500w, /generated/_posts/../assets/images/espai/raw_boxplot_HLMI-1920-ff157ddef.jpeg 1920w" type="image/jpeg" /><img alt="Box plots for HLMI in the fixed-years and fixed-probabilities framings." src="/generated/_posts/../assets/images/espai/raw_boxplot_HLMI-800-ff157ddef.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading1">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#raw-data-hlmi-inner-accordioncontent1" aria-expanded="false" aria-controls="raw-data-hlmi-inner-accordioncontent1">
        <div>Fixed Probabilities</div>


      </button>
    </h2>
    <div id="raw-data-hlmi-inner-accordioncontent1" class="accordion-collapse collapse" aria-labelledby="heading1">
      <div class="accordion-body">
        
<p>In the fixed probabilities framing, respondents were asked for the number of years until a 10%, 50%, and 90% probability of HLMI.</p>

<table>
  <thead>
    <tr>
      <th style="text-align: left">Probability of HLMI</th>
      <th style="text-align: right">Mean response</th>
      <th style="text-align: right">15th percentile response</th>
      <th style="text-align: right">Median response</th>
      <th style="text-align: right">85th percentile response</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: left">10%</td>
      <td style="text-align: right">41.19</td>
      <td style="text-align: right">2</td>
      <td style="text-align: right">5</td>
      <td style="text-align: right">20</td>
    </tr>
    <tr>
      <td style="text-align: left">50%</td>
      <td style="text-align: right">1307.74</td>
      <td style="text-align: right">7</td>
      <td style="text-align: right">20</td>
      <td style="text-align: right">50</td>
    </tr>
    <tr>
      <td style="text-align: left">90%</td>
      <td style="text-align: right">457537</td>
      <td style="text-align: right">15</td>
      <td style="text-align: right">50</td>
      <td style="text-align: right">100</td>
    </tr>
  </tbody>
</table>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading2">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#raw-data-hlmi-inner-accordioncontent2" aria-expanded="false" aria-controls="raw-data-hlmi-inner-accordioncontent2">
        <div>Fixed Years</div>


      </button>
    </h2>
    <div id="raw-data-hlmi-inner-accordioncontent2" class="accordion-collapse collapse" aria-labelledby="heading2">
      <div class="accordion-body">
        
<p>In the fixed years framing, respondents were asked for the probability of HLMI within 10, 20, and 40 years.</p>

<table>
  <thead>
    <tr>
      <th style="text-align: right">Years until HLMI</th>
      <th style="text-align: left">Mean response</th>
      <th style="text-align: left">15th percentile response</th>
      <th style="text-align: left">Median response</th>
      <th style="text-align: left">85th percentile response</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td style="text-align: right">10</td>
      <td style="text-align: left">18.25%</td>
      <td style="text-align: left">0.00%</td>
      <td style="text-align: left">10.00%</td>
      <td style="text-align: left">50.00%</td>
    </tr>
    <tr>
      <td style="text-align: right">20</td>
      <td style="text-align: left">34.70%</td>
      <td style="text-align: left">4.00%</td>
      <td style="text-align: left">30.00%</td>
      <td style="text-align: left">75.00%</td>
    </tr>
    <tr>
      <td style="text-align: right">40</td>
      <td style="text-align: left">54.58%</td>
      <td style="text-align: left">10.00%</td>
      <td style="text-align: left">50.00%</td>
      <td style="text-align: left">95.00%</td>
    </tr>
  </tbody>
</table>


      </div>
    </div>
  </div>
  
</div>
  </div>


      </div>
    </div>
  </div>
  
</div>
  </div>

<h1 id="aggregation">Aggregation</h1>

<h2 id="possible-methods">Possible methods</h2>
<p>All previous analyses produced the aggregate distribution by taking the average of CDF values, that is, by taking the mean of probability values at each year.</p>

<p>There are many other possible aggregation methods. We can put these into two categories:</p>

<ul>
  <li>vertical methods like the above aggregate probability values at each year</li>
  <li>horizontal methods aggregate year values at each probability</li>
</ul>

<p>This figure illustrates both methods on a very simple example with two CDFs to aggregate.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/illustrate_agg_methods-400-3cdbda1b5.webp 400w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-600-3cdbda1b5.webp 600w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-800-3cdbda1b5.webp 800w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-1000-3cdbda1b5.webp 1000w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-1500-3cdbda1b5.webp 1500w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-2000-3cdbda1b5.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/illustrate_agg_methods-400-3cdbda1b5.jpeg 400w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-600-3cdbda1b5.jpeg 600w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-800-3cdbda1b5.jpeg 800w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-1000-3cdbda1b5.jpeg 1000w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-1500-3cdbda1b5.jpeg 1500w, /generated/_posts/../assets/images/espai/illustrate_agg_methods-2000-3cdbda1b5.jpeg 2000w" type="image/jpeg" /><img alt="Diagram showing vertical and horizontal methods for aggregating CDFs." src="/generated/_posts/../assets/images/espai/illustrate_agg_methods-800-3cdbda1b5.png" width="4500" height="1800" /></picture>

<p>For both vertical and horizontal aggregation, we need not take the mean of values. In principle any aggregation function could be used, of which the mean and median are only the two most obvious examples.</p>

<p>When it comes to aggregating probabilities (vertical aggregation), there are additional complications. The topic has been well studied, and many aggregation methods have been proposed.</p>

<p>A full assessment of the topic would take us far beyond the scope of this report, so I will only briefly mention one prominent recommendation: taking the geometric mean of odds. The core observation is that the arithmetic mean of probabilities ignores information from extreme predictions. This can be seen with a simple example. In scenario A, we aggregate the two predictions (1%, 10%), whereas in scenario B the two predictions are (0.1%, 10%). The arithmetic mean of probabilities is close to 5% in both cases (5.5% for A and 5.05% for B). It gives very little weight to the difference between 1% and 0.1%, which is after all a factor of 10. The geometric mean of odds reacts much more strongly to this much more extreme prediction, being about 3.2% in scenario A, and 1.0% in scenario B.</p>

<p>This behaviour of the geometric mean of odds is theoretically appealing, but it is only advisable if extreme predictions are really to be taken at face value. We might worry that these predictions are much more overconfident.</p>

<p>As a further complication, in the case of ESPAI, in practise we cannot apply the geometric mean of odds. This is because for nearly every year (every vertical line) we might consider, many of the respondents’ fitted CDFs take values indistinguishable from 0 or 1. This causes the geometric mean of odds to immediately become 0 or 1<sup id="fnref:zero_one" role="doc-noteref"><a href="#fn:zero_one" class="footnote" rel="footnote">5</a></sup>.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/geomean_odds_bad-400-7e0a03b14.webp 400w, /generated/_posts/../assets/images/espai/geomean_odds_bad-600-7e0a03b14.webp 600w, /generated/_posts/../assets/images/espai/geomean_odds_bad-800-7e0a03b14.webp 800w, /generated/_posts/../assets/images/espai/geomean_odds_bad-1000-7e0a03b14.webp 1000w, /generated/_posts/../assets/images/espai/geomean_odds_bad-1500-7e0a03b14.webp 1500w, /generated/_posts/../assets/images/espai/geomean_odds_bad-1920-7e0a03b14.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/geomean_odds_bad-400-7e0a03b14.jpeg 400w, /generated/_posts/../assets/images/espai/geomean_odds_bad-600-7e0a03b14.jpeg 600w, /generated/_posts/../assets/images/espai/geomean_odds_bad-800-7e0a03b14.jpeg 800w, /generated/_posts/../assets/images/espai/geomean_odds_bad-1000-7e0a03b14.jpeg 1000w, /generated/_posts/../assets/images/espai/geomean_odds_bad-1500-7e0a03b14.jpeg 1500w, /generated/_posts/../assets/images/espai/geomean_odds_bad-1920-7e0a03b14.jpeg 1920w" type="image/jpeg" /><img alt="Visualization showing the problems with using the geometric mean of odds for aggregation, where extreme probabilities lead to the aggregate CDF reaching 0 or 1." src="/generated/_posts/../assets/images/espai/geomean_odds_bad-800-7e0a03b14.png" width="1920" height="1440" /></picture>

<p>Aggregating years is also problematic. Because the input is bounded on the left but not the right, the arithmetic mean of responses is inevitably dominated by extremely large values. This method would produce a CDF where any probability of the event is essentially infinitely many years away. We might hope to address this problem by using the geometric mean of years, but this in turn suffers from numerical and conceptual issues similar to those of the geometric mean of odds. Ultimately, taking the median of years is the only method of aggregating years I was able to apply.</p>

<p>The median of years and median of probabilities give the same answer. This makes intuitive sense since CDFs are strictly increasing<sup id="fnref:median-theorem" role="doc-noteref"><a href="#fn:median-theorem" class="footnote" rel="footnote">6</a></sup>. So I simply call this the “median”.</p>

<h2 id="mean-vs-median-aggregation">Mean vs Median aggregation</h2>
<p>As a result of these difficulties, I will present only the following aggregation methods:</p>

<ul>
  <li>(Arithmetic) mean of probabilities</li>
  <li>Median of probabilities</li>
</ul>

<p>These plots use the Gamma distribution with the mean square error (MSE) of probabilities as the loss function, so the mean aggregation line corresponds to the results of previous analyses.</p>

<div class="bootstrap-styles bootstrap-reboot">
  <div class="fw-bold"><div>Mean vs Median aggregation</div>
</div>
  <div class="accordion" id="mean-vs-median-accordion">
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading0">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#mean-vs-median-accordioncontent0" aria-expanded="false" aria-controls="mean-vs-median-accordioncontent0">
        
<div>Full automation of labor (FAOL)</div>


      </button>
    </h2>
    <div id="mean-vs-median-accordioncontent0" class="accordion-collapse collapse" aria-labelledby="heading0">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_faol-400-327ae02db.webp 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-600-327ae02db.webp 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-800-327ae02db.webp 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-1000-327ae02db.webp 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-1500-327ae02db.webp 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-1920-327ae02db.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_faol-400-327ae02db.jpeg 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-600-327ae02db.jpeg 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-800-327ae02db.jpeg 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-1000-327ae02db.jpeg 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-1500-327ae02db.jpeg 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol-1920-327ae02db.jpeg 1920w" type="image/jpeg" /><img alt="Comparison of mean and median aggregation methods for FAOL." src="/generated/_posts/../assets/images/espai/compare_agg_methods_faol-800-327ae02db.png" width="1920" height="1440" /></picture>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-400-b0e8ab94e.webp 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-600-b0e8ab94e.webp 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-800-b0e8ab94e.webp 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-1000-b0e8ab94e.webp 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-1500-b0e8ab94e.webp 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-1920-b0e8ab94e.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-400-b0e8ab94e.jpeg 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-600-b0e8ab94e.jpeg 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-800-b0e8ab94e.jpeg 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-1000-b0e8ab94e.jpeg 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-1500-b0e8ab94e.jpeg 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-1920-b0e8ab94e.jpeg 1920w" type="image/jpeg" /><img alt="Extended comparison of mean and median aggregation for FAOL with additional data points." src="/generated/_posts/../assets/images/espai/compare_agg_methods_faol_2800-800-b0e8ab94e.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading1">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#mean-vs-median-accordioncontent1" aria-expanded="false" aria-controls="mean-vs-median-accordioncontent1">
        <div>High Level Machine Intelligence (HLMI)</div>


      </button>
    </h2>
    <div id="mean-vs-median-accordioncontent1" class="accordion-collapse collapse" aria-labelledby="heading1">
      <div class="accordion-body">
        <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-400-c9de403f1.webp 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-600-c9de403f1.webp 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-800-c9de403f1.webp 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-1000-c9de403f1.webp 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-1500-c9de403f1.webp 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-1920-c9de403f1.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-400-c9de403f1.jpeg 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-600-c9de403f1.jpeg 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-800-c9de403f1.jpeg 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-1000-c9de403f1.jpeg 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-1500-c9de403f1.jpeg 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-1920-c9de403f1.jpeg 1920w" type="image/jpeg" /><img alt="Comparison of mean and median aggregation methods for HLMI." src="/generated/_posts/../assets/images/espai/compare_agg_methods_hlmi-800-c9de403f1.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading2">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#mean-vs-median-accordioncontent2" aria-expanded="false" aria-controls="mean-vs-median-accordioncontent2">
        <div>Truck Driver</div>


      </button>
    </h2>
    <div id="mean-vs-median-accordioncontent2" class="accordion-collapse collapse" aria-labelledby="heading2">
      <div class="accordion-body">
        <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-400-226379173.webp 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-600-226379173.webp 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-800-226379173.webp 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-1000-226379173.webp 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-1500-226379173.webp 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-1920-226379173.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-400-226379173.jpeg 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-600-226379173.jpeg 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-800-226379173.jpeg 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-1000-226379173.jpeg 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-1500-226379173.jpeg 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-1920-226379173.jpeg 1920w" type="image/jpeg" /><img alt="Comparison of mean and median aggregation methods for Truck Driver occupation." src="/generated/_posts/../assets/images/espai/compare_agg_methods_TRUCK_DRIVER-800-226379173.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading3">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#mean-vs-median-accordioncontent3" aria-expanded="false" aria-controls="mean-vs-median-accordioncontent3">
        <div>Surgeon</div>


      </button>
    </h2>
    <div id="mean-vs-median-accordioncontent3" class="accordion-collapse collapse" aria-labelledby="heading3">
      <div class="accordion-body">
        <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-400-cb2d9e8bb.webp 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-600-cb2d9e8bb.webp 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-800-cb2d9e8bb.webp 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-1000-cb2d9e8bb.webp 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-1500-cb2d9e8bb.webp 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-1920-cb2d9e8bb.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-400-cb2d9e8bb.jpeg 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-600-cb2d9e8bb.jpeg 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-800-cb2d9e8bb.jpeg 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-1000-cb2d9e8bb.jpeg 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-1500-cb2d9e8bb.jpeg 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-1920-cb2d9e8bb.jpeg 1920w" type="image/jpeg" /><img alt="Comparison of mean and median aggregation methods for Surgeon occupation." src="/generated/_posts/../assets/images/espai/compare_agg_methods_SURGEON-800-cb2d9e8bb.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading4">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#mean-vs-median-accordioncontent4" aria-expanded="false" aria-controls="mean-vs-median-accordioncontent4">
        <div>Retail Salesperson</div>


      </button>
    </h2>
    <div id="mean-vs-median-accordioncontent4" class="accordion-collapse collapse" aria-labelledby="heading4">
      <div class="accordion-body">
        <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-400-72672d778.webp 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-600-72672d778.webp 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-800-72672d778.webp 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-1000-72672d778.webp 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-1500-72672d778.webp 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-1920-72672d778.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-400-72672d778.jpeg 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-600-72672d778.jpeg 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-800-72672d778.jpeg 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-1000-72672d778.jpeg 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-1500-72672d778.jpeg 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-1920-72672d778.jpeg 1920w" type="image/jpeg" /><img alt="Comparison of mean and median aggregation methods for Retail Salesperson occupation." src="/generated/_posts/../assets/images/espai/compare_agg_methods_RETAIL_SALESPERSON-800-72672d778.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading5">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#mean-vs-median-accordioncontent5" aria-expanded="false" aria-controls="mean-vs-median-accordioncontent5">
        <div>AI Researcher</div>


      </button>
    </h2>
    <div id="mean-vs-median-accordioncontent5" class="accordion-collapse collapse" aria-labelledby="heading5">
      <div class="accordion-body">
        <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-400-72b23373a.webp 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-600-72b23373a.webp 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-800-72b23373a.webp 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-1000-72b23373a.webp 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-1500-72b23373a.webp 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-1920-72b23373a.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-400-72b23373a.jpeg 400w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-600-72b23373a.jpeg 600w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-800-72b23373a.jpeg 800w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-1000-72b23373a.jpeg 1000w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-1500-72b23373a.jpeg 1500w, /generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-1920-72b23373a.jpeg 1920w" type="image/jpeg" /><img alt="Comparison of mean and median aggregation methods for AI Researcher occupation." src="/generated/_posts/../assets/images/espai/compare_agg_methods_AI_RESEARCHER-800-72b23373a.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
</div>
  </div>

<p>We see a notable pattern in each of these cases. As we go from left to right, the median always starts below the mean (i.e. the median initially gives later predictions), but eventually overtakes the mean (i.e. the median eventually gives earlier predictions). Median aggregation also always gives rise to a more confident probability distribution: one whose probability mass is more concentrated.</p>

<h2 id="why-the-mean-and-median-differ">Why the mean and median differ</h2>
<p>When the mean is very different from the median, this means that the distribution of responses is highly skewed. We can illustrate this by displaying a histogram of CDF values for a given year.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-400-637fdc5f8.webp 400w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-600-637fdc5f8.webp 600w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-800-637fdc5f8.webp 800w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-1000-637fdc5f8.webp 1000w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-1500-637fdc5f8.webp 1500w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-2000-637fdc5f8.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-400-637fdc5f8.jpeg 400w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-600-637fdc5f8.jpeg 600w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-800-637fdc5f8.jpeg 800w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-1000-637fdc5f8.jpeg 1000w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-1500-637fdc5f8.jpeg 1500w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-2000-637fdc5f8.jpeg 2000w" type="image/jpeg" /><img alt="Histogram showing distribution of FAOL CDF values, comparing mean and median aggregation." src="/generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_FAOL-800-637fdc5f8.png" width="2160" height="1440" /></picture>

<p>The results for automation of all occupations (FAOL) are quite interesting. For the years 2040 and 2060, the results are extremely skewed. A large majority assigns very low probabilities, but there is a right tail of high probabilities, which causes the mean to greatly exceed the median. For the years 2080 and 2100, a bimodal distribution emerges. We have a big cluster with probabilities near zero and a big cluster with probabilities near 1. Opinion is extremely polarised. By 2200 the median exceeds the mean. When we reach 2500, a majority think FAOL is near-certain, but a significant left tail causes the mean to lag far behind the median.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-400-a7e43ec26.webp 400w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-600-a7e43ec26.webp 600w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-800-a7e43ec26.webp 800w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-1000-a7e43ec26.webp 1000w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-1500-a7e43ec26.webp 1500w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-2000-a7e43ec26.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-400-a7e43ec26.jpeg 400w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-600-a7e43ec26.jpeg 600w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-800-a7e43ec26.jpeg 800w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-1000-a7e43ec26.jpeg 1000w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-1500-a7e43ec26.jpeg 1500w, /generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-2000-a7e43ec26.jpeg 2000w" type="image/jpeg" /><img alt="Histogram showing distribution of HLMI CDF values, comparing mean and median aggregation." src="/generated/_posts/../assets/images/espai/mean_vs_median_cdf_slice_histogram_HLMI-800-a7e43ec26.png" width="2160" height="1440" /></picture>

<p>With task automation (HLMI), we see the same basic pattern (repeated everywhere): the median at first trails behind the mean, and for later years and higher probabilities, the median overtakes the mean. However, skewness is less extreme than for FAOL, and we do not see a strongly bimodal histogram (extreme polarisation) at any point.</p>

<h2 id="aside-the-winsorized-geometric-mean-of-odds">Aside: the winsorized geometric mean of odds</h2>
<p>There is one way to use the geometric mean of odds that avoids the problem of zeroes and ones. This is to winsorize the data: to replace the most extreme values with less extreme values. For example, we could replace all values less than 0.1 with 0.1, and all values greater than 0.9 with 0.9.</p>

<p>Of course, this introduces a highly subjective choice that massively affects the results. We could replace all values less than 0.01 with 0.01, or all values less than 0.001 with 0.001. Therefore, I do not consider this technique suitable for the creation of headline result.</p>

<p>However, it lets us do some potentially interesting explorations. Winsorising essentially means we do not trust the most extreme predictions. We can now explore what the geometric mean of odds would look like under various degrees of winsorisation. e.g. what does it look like if we ignore all predictions more extreme than 1:100? What about 1:1000?</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-400-8452e51e5.webp 400w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-600-8452e51e5.webp 600w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-800-8452e51e5.webp 800w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-1000-8452e51e5.webp 1000w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-1500-8452e51e5.webp 1500w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-1920-8452e51e5.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-400-8452e51e5.jpeg 400w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-600-8452e51e5.jpeg 600w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-800-8452e51e5.jpeg 800w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-1000-8452e51e5.jpeg 1000w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-1500-8452e51e5.jpeg 1500w, /generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-1920-8452e51e5.jpeg 1920w" type="image/jpeg" /><img alt="Plot showing how winsorization levels affect geometric mean aggregation for FAOL." src="/generated/_posts/../assets/images/espai/winsorized_geomean_FAOL-800-8452e51e5.png" width="1920" height="1440" /></picture>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-400-7f4093598.webp 400w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-600-7f4093598.webp 600w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-800-7f4093598.webp 800w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-1000-7f4093598.webp 1000w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-1500-7f4093598.webp 1500w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-1920-7f4093598.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-400-7f4093598.jpeg 400w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-600-7f4093598.jpeg 600w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-800-7f4093598.jpeg 800w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-1000-7f4093598.jpeg 1000w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-1500-7f4093598.jpeg 1500w, /generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-1920-7f4093598.jpeg 1920w" type="image/jpeg" /><img alt="Plot showing how winsorization levels affect geometric mean aggregation for HLMI." src="/generated/_posts/../assets/images/espai/winsorized_geomean_HLMI-800-7f4093598.png" width="1920" height="1440" /></picture>

<p>Very informally, we can see that for HLMI (tasks) and FAOL (occupations), the arithmetic mean of probabilities roughly corresponds to the geometric mean of odds with a winsorisation level of about 1:10. We’ve already discussed the well-known effect that the arithmetic mean of probabilities ignores more extreme predictions, compared to the geometric mean of odds. For this particular data, we can roughly quantify this effect, and see that it is equivalent to ignoring all predictions &lt;10% and &gt;90%. I find this to be quite an extreme level of winsorisation. Consider, for example, that the fixed-probabilities framing explicitly asked for predictions at the 10% and 90% levels – it would be odd to simultaneously consider these probabilities too extreme to be trusted.</p>

<h1 id="distribution-fitting">Distribution fitting</h1>

<p>All previous analyses of the ESPAI data fitted each respondent’s CDF data (triples of (year, probability)) to a Gamma distribution before aggregating these distributions.</p>

<h2 id="why-fit-a-distribution">Why fit a distribution?</h2>

<p>Creating a full continuous distribution from three CDF points necessarily imposes some assumptions that were not present in the data. And recall, the respondents just gave numbers in text fields, and never saw the distribution that was later fitted to their CDF data.</p>

<p>So to begin with, it’s worth asking: why fit a distribution at all?</p>

<p>If we are only looking at a particular framing and question, for example FAOL with fixed years, it may indeed be preferable to look directly at the raw data. This allows us to talk strictly about what respondents said, without any additional assumptions. Even in this restricted setting, however, we might want to be able to get predictions for other years or probabilities than those respondents were asked about; this requires a full CDF. A simple example where this is required is for making comparisons across different iterations of the ESPAI survey in the fixed-years setting. Each survey asks for predictions about a fixed number of years <em>from the date of the survey</em>. So the fixed-years question asks about different calendar years each time the survey is made.</p>

<p>A more fundamental problem for the raw data approach is that we wish to aggregate the results of different framings into a single estimate. We can only aggregate across the fixed-years and fixed-probability framings by aggregating full distributions. In addition, even within the fixed-years framing, we cannot aggregate the occupations (FAOL) and tasks (HLMI) framings, because different years were used (10, 20, and 40 years for HLMI and 10, 20, and 50 years for FAOL).</p>

<h2 id="limitations-of-previous-analyses">Limitations of previous analyses</h2>

<h3 id="constraints-of-gamma-distribution">Constraints of Gamma distribution</h3>

<p>While creating a full CDF from three points inevitably imposes assumptions not present in the data, we might think that, at a minimum, it would be desirable to have this CDF pass through the three points.</p>

<p>Previous analyses used a Gamma distribution. The gamma distribution is a 2-parameter distribution that is able to exactly match 2 points of CDF data, but not 3 points. The gamma distribution (and any 2-parameter distribution) necessarily loses information and distorts the expert’s beliefs even for the points where we know exactly what they believe.</p>

<p>Here are 9 examples from the fixed-probabilities framing<sup id="fnref:plot-fn" role="doc-noteref"><a href="#fn:plot-fn" class="footnote" rel="footnote">7</a></sup>. They are representative of the bottom half of fits (from the 50th to 90th percentile). Each subplot shows an example where the fitted gamma CDF (shown as a gray curve) attempts to match three points from a respondent’s data (shown as red crosses).</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-400-52fe1713e.webp 400w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-600-52fe1713e.webp 600w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-800-52fe1713e.webp 800w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-1000-52fe1713e.webp 1000w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-1500-52fe1713e.webp 1500w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-2000-52fe1713e.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-400-52fe1713e.jpeg 400w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-600-52fe1713e.jpeg 600w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-800-52fe1713e.jpeg 800w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-1000-52fe1713e.jpeg 1000w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-1500-52fe1713e.jpeg 1500w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-2000-52fe1713e.jpeg 2000w" type="image/jpeg" /><img alt="Gamma distribution fits to fixed probabilities survey data, showing respondent points and Gamma CDFs." src="/generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_False-800-52fe1713e.png" width="2670" height="2769" /></picture>

<p>First, we can see that the gamma is not flexible enough to match the three points. While the median fit (A1) is acceptable, some fits are poor.</p>

<h3 id="inappropriate-loss-function">Inappropriate loss function</h3>
<p>In addition, if we look carefully we can see an interesting systematic pattern in the poor fits. We can see that when the Gamma has trouble fitting the data, it prefers to fit two points well, even at the expense of a very poor fit on the third point, rather than choosing a middle ground with an acceptable fit on all three points. This begins to be visible in row B (67th to 87th percentile), and becomes blatantly clear in row C (84th to 95th percentile). In fact, in C2 and C3, the Gamma fits two points exactly and completely ignores the third. When this happens, the worst-fit point is always the 0.9 or 0.1 point, never the 0.5 point.</p>

<p>The errors at the 0.1 and 0.9 points can completely change the nature of the prediction. This becomes clear if we go to odds space, and express the odds ratio between the data and the gamma CDF.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-400-648afb1c2.webp 400w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-600-648afb1c2.webp 600w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-800-648afb1c2.webp 800w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-1000-648afb1c2.webp 1000w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-1500-648afb1c2.webp 1500w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-2000-648afb1c2.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-400-648afb1c2.jpeg 400w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-600-648afb1c2.jpeg 600w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-800-648afb1c2.jpeg 800w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-1000-648afb1c2.jpeg 1000w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-1500-648afb1c2.jpeg 1500w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-2000-648afb1c2.jpeg 2000w" type="image/jpeg" /><img alt="Gamma distribution fits to fixed probabilities survey data, showing respondent points and Gamma CDFs, with annotations" src="/generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_probabilities_annotations_True-800-648afb1c2.png" width="2662" height="2769" /></picture>

<p>While a 2x odds ratio (e.g. in B2) is already substantial, when we move to the worst 15% of the fits, the odds ratio for the worst of the three points becomes astronomical.</p>

<p>The reason this happens is that the loss function used in previous work is not the appropriate one.</p>

<p>Previous analyses used mean squared error (MSE) of probabilities as their loss function: <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>L</mi><mtext>MSE</mtext></msub><mo>=</mo><msub><mo>∑</mo><mi>i</mi></msub><mo stretchy="false">(</mo><msub><mi>p</mi><mi>i</mi></msub><mo>−</mo><msub><mover accent="true"><mi>p</mi><mo>^</mo></mover><mi>i</mi></msub><msup><mo stretchy="false">)</mo><mn>2</mn></msup></mrow><annotation encoding="application/x-tex">L_{\text{MSE}} = \sum_i (p_i - \hat{p}_i)^2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8333em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal">L</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3283em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">MSE</span></span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0497em;vertical-align:-0.2997em;"></span><span class="mop"><span class="mop op-symbol small-op" style="position:relative;top:0em;">∑</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.162em;"><span style="top:-2.4003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2997em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord accent"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.6944em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">p</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.1667em;"><span class="mord">^</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.1944em;"><span></span></span></span></span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span>, where <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>p</mi><mi>i</mi></msub></mrow><annotation encoding="application/x-tex">p_i</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span> are the probabilities from the respondent’s data and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mover accent="true"><mi>p</mi><mo>^</mo></mover><mi>i</mi></msub></mrow><annotation encoding="application/x-tex">\hat{p}_i</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord"><span class="mord accent"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.6944em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">p</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.1667em;"><span class="mord">^</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.1944em;"><span></span></span></span></span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span> are the probabilities from the fitted CDF. This loss function treats all probability differences equally, regardless of where they occur in the distribution. For instance, it considers a deviation of 0.05 to be equally bad whether it occurs at <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi><mo>=</mo><mn>0.5</mn></mrow><annotation encoding="application/x-tex">p=0.5</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0.5</span></span></span></span> or at <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi><mo>=</mo><mn>0.99</mn></mrow><annotation encoding="application/x-tex">p=0.99</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0.99</span></span></span></span>.</p>

<p>This is inappropriate when fitting CDF data. Consider the case depicted in C2, where the respondent thinks the event in question is 90% likely by 150 years from the date of the survey. Meanwhile, the Gamma CDF fitted by MSE gives a probability of 99.98% at 150 years. This dramatic departure from the respondent’s beliefs is represented in the 777x odds ratio. A 777x odds ratio at <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi><mo>=</mo><mn>0.5</mn></mrow><annotation encoding="application/x-tex">p=0.5</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0.5</span></span></span></span> would mean changing from even odds (1:1) to odds of 777:1, or a probability of &gt;99.8%. (A 13x odds ratio, as seen for the 0.1 point in C1 (84th percentile), would mean changing from even odds to odds of 13:1, or a probability of 93%.)</p>

<p>The appropriate loss function for CDF data is the log loss, also known as the cross-entropy loss: <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>L</mi><mtext>log</mtext></msub><mo>=</mo><mo>−</mo><msub><mo>∑</mo><mi>i</mi></msub><mo stretchy="false">[</mo><msub><mi>p</mi><mi>i</mi></msub><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><msub><mover accent="true"><mi>p</mi><mo>^</mo></mover><mi>i</mi></msub><mo stretchy="false">)</mo><mo>+</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><msub><mi>p</mi><mi>i</mi></msub><mo stretchy="false">)</mo><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><msub><mover accent="true"><mi>p</mi><mo>^</mo></mover><mi>i</mi></msub><mo stretchy="false">)</mo><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">L_{\text{log}} = -\sum_i [p_i \log(\hat{p}_i) + (1-p_i)\log(1-\hat{p}_i)]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.9694em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord mathnormal">L</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">log</span></span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0497em;vertical-align:-0.2997em;"></span><span class="mord">−</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop"><span class="mop op-symbol small-op" style="position:relative;top:0em;">∑</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.162em;"><span style="top:-2.4003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2997em;"><span></span></span></span></span></span></span><span class="mopen">[</span><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord"><span class="mord accent"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.6944em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">p</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.1667em;"><span class="mord">^</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.1944em;"><span></span></span></span></span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord accent"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.6944em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord mathnormal">p</span></span><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.1667em;"><span class="mord">^</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.1944em;"><span></span></span></span></span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">)]</span></span></span></span>. This loss function naturally accounts for the fact that probability differences near 0 and 1 represent much larger differences in beliefs than the same probability differences near 0.5.<sup id="fnref:kl-divergence" role="doc-noteref"><a href="#fn:kl-divergence" class="footnote" rel="footnote">8</a></sup></p>

<p>As expected from this theoretical argument, we can see that the log loss, unlike the MSE of probabilities, does not display the pathological behaviour of ignoring the 0.1 or 0.9 point, and so avoids extreme odds ratios (see especially C1-C3):</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-400-1c7e7df7a.webp 400w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-600-1c7e7df7a.webp 600w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-800-1c7e7df7a.webp 800w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-1000-1c7e7df7a.webp 1000w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-1500-1c7e7df7a.webp 1500w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-2000-1c7e7df7a.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-400-1c7e7df7a.jpeg 400w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-600-1c7e7df7a.jpeg 600w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-800-1c7e7df7a.jpeg 800w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-1000-1c7e7df7a.jpeg 1000w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-1500-1c7e7df7a.jpeg 1500w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-2000-1c7e7df7a.jpeg 2000w" type="image/jpeg" /><img alt="Comparison of log loss and MSE on Gamma distribution fits for fixed probabilities framing." src="/generated/_posts/../assets/images/espai/9_cdfs_gamma_loss_Fixed_probabilities-800-1c7e7df7a.png" width="2670" height="2769" /></picture>

<p>As an informal analysis, this plot suggests that the MSE leads to extremely poor fits on &gt;15% of the data, but also that most of the MSE fits are close to the log loss fits.</p>

<p>When we create the aggregate CDF, we see hardly any impact of the loss function:</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-400-9fd702584.webp 400w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-600-9fd702584.webp 600w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-800-9fd702584.webp 800w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-1000-9fd702584.webp 1000w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-1500-9fd702584.webp 1500w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-1920-9fd702584.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-400-9fd702584.jpeg 400w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-600-9fd702584.jpeg 600w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-800-9fd702584.jpeg 800w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-1000-9fd702584.jpeg 1000w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-1500-9fd702584.jpeg 1500w, /generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-1920-9fd702584.jpeg 1920w" type="image/jpeg" /><img alt="Aggregate CDFs for HLMI and FAOL using Gamma and flexible distributions." src="/generated/_posts/../assets/images/espai/gamma_effect_of_loss_aggregate_HLMI_FAOL-800-9fd702584.png" width="1920" height="1440" /></picture>

<h2 id="flexible-distributions">Flexible distributions</h2>

<p>Regardless of the loss function used, we know that the Gamma distribution cannot match the three points of CDF data given by the expert<sup id="fnref:gengamma" role="doc-noteref"><a href="#fn:gengamma" class="footnote" rel="footnote">9</a></sup>. When we use any such distribution, our results do not merely reflect the expert’s beliefs, they also reflect the mathematical constraint we imposed upon those beliefs.</p>

<p>Overriding expert responses in this way may be appropriate when we have a strong theoretical justification to impose a particular distribution family. For example, if we have a strong reason to believe that experts think (or ought to think) of a variable as a sum of many small independent contributions, we may wish to impose a normal distribution, even if the responses they gave us are incompatible with a normal distribution.</p>

<p>However, the authors of previous analyses did not justify the choice of the gamma distribution at any point. In addition, I am not aware of any strong argument to impose a particular distribution family in this case.</p>

<p>While creating a full CDF from three points inevitably imposes assumptions not present in the data, at a minimum, it would be desirable to have this CDF pass through the three points.</p>

<p>To achieve this, I used proprietary probability distributions which I call ‘flexible distributions’. I developed these over the last several years, for precisely the class of use cases faced by ESPAI. These distributions have the following properties:</p>

<ul>
  <li>Always exactly match three CDF points (or indeed an arbitrary number of them)…</li>
  <li>…while taking a simple and smooth shape</li>
  <li>Can be unbounded, or given an upper or lower bound, or both</li>
</ul>

<p>The distributions I used in this analysis are based on <a href="https://en.wikipedia.org/wiki/Interpolation">interpolation</a> theory. The full mathematical and algorithmic details are proprietary, and the distributions are available as a service at <a href="https://makedistribution.com/">MakeDistribution.com</a>. However, you can see how these distributions behave with the free interactive web UI below (select interpolation-based families under expert settings). In addition, to make this work reproducible, the specific fitted CDFs used in the ESPAI analysis are open source<sup id="fnref:os-impl" role="doc-noteref"><a href="#fn:os-impl" class="footnote" rel="footnote">10</a></sup>.</p>

<details>
<summary style="cursor: pointer;">
<span style="text-decoration: underline;">Try the MakeDistribution interface</span>
</summary>
<iframe style="width: 125%;
  max-width: 95vw;
  min-width: 100%;
  left: 50%;
  transform: translateX(-50%);
  position: relative;
  border: 1px solid grey;
  border-radius: 5px;
  height: 770px;" src="https://makedistribution.com/playground/"></iframe>
</details>

<p>This plot compares Gamma distribution fits versus flexible distribution fits for fixed probabilities framing, displaying respondent points and Gamma CDFs.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-400-629bacd6f.webp 400w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-600-629bacd6f.webp 600w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-800-629bacd6f.webp 800w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-1000-629bacd6f.webp 1000w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-1500-629bacd6f.webp 1500w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-2000-629bacd6f.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-400-629bacd6f.jpeg 400w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-600-629bacd6f.jpeg 600w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-800-629bacd6f.jpeg 800w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-1000-629bacd6f.jpeg 1000w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-1500-629bacd6f.jpeg 1500w, /generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-2000-629bacd6f.jpeg 2000w" type="image/jpeg" /><img alt="Comparison of Gamma and flexible distribution fits for fixed probabilities framing." src="/generated/_posts/../assets/images/espai/9_cdfs_gamma_vs_flexible_Fixed_probabilities-800-629bacd6f.png" width="2670" height="2769" /></picture>

<p>When we aggregate the individual distributions, however, we find that the choice of distribution has a very limited impact, barely any more than the impact of the loss function.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-400-eed21f095.webp 400w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-600-eed21f095.webp 600w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-800-eed21f095.webp 800w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-1000-eed21f095.webp 1000w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-1500-eed21f095.webp 1500w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-1920-eed21f095.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-400-eed21f095.jpeg 400w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-600-eed21f095.jpeg 600w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-800-eed21f095.jpeg 800w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-1000-eed21f095.jpeg 1000w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-1500-eed21f095.jpeg 1500w, /generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-1920-eed21f095.jpeg 1920w" type="image/jpeg" /><img alt="Aggregate CDFs for HLMI and FAOL using Gamma and flexible distributions." src="/generated/_posts/../assets/images/espai/gamma_vs_flexible_aggregate_HLMI_FAOL-800-eed21f095.png" width="1920" height="1440" /></picture>

<p>It may be somewhat surprising to see so little difference in aggregate, when we consider that there appeared to be systematic patterns in the poor gamma fits<sup id="fnref:patterns-bias" role="doc-noteref"><a href="#fn:patterns-bias" class="footnote" rel="footnote">11</a></sup>. However, this might be explained by the fact that the majority of fits were of acceptable quality.</p>

<p>I ran many variations of this analysis (and so can you, using the open-source <a href="#codebase">codebase</a>). None showed a dramatic effect of the distribution family.</p>

<h2 id="other-distributions">Other distributions</h2>

<p>In addition to flexible distributions, I also investigated the use of alternative ‘traditional’ distributions, such as the Weibull or Generalised gamma<sup id="fnref:gengamma:1" role="doc-noteref"><a href="#fn:gengamma" class="footnote" rel="footnote">9</a></sup>. For each distribution family, I tried fitting them both with the MSE of probabilities loss used by previous authors, and with the log loss. These had little impact on the aggregate CDF, which might be considered unsurprising since even the flexible distribution did not have large effects on aggregate results.</p>

<h1 id="range-of-responses">Displaying the distribution of responses</h1>

<p>What is the range of opinion<sup id="fnref:disagreement_vs_framing" role="doc-noteref"><a href="#fn:disagreement_vs_framing" class="footnote" rel="footnote">12</a></sup> among experts? Previous analyses gave only an informal sense of this by displaying a few dozen randomly selected CDFs:</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/grace_2018_figure_1-400-77b68b37c.webp 400w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-600-77b68b37c.webp 600w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-800-77b68b37c.webp 800w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-1000-77b68b37c.webp 1000w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-1500-77b68b37c.webp 1500w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-1658-77b68b37c.webp 1658w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/grace_2018_figure_1-400-77b68b37c.jpeg 400w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-600-77b68b37c.jpeg 600w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-800-77b68b37c.jpeg 800w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-1000-77b68b37c.jpeg 1000w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-1500-77b68b37c.jpeg 1500w, /generated/_posts/../assets/images/espai/grace_2018_figure_1-1658-77b68b37c.jpeg 1658w" type="image/jpeg" /><img alt="Scatterplot of previous ESPAI survey CDFs." src="/generated/_posts/../assets/images/espai/grace_2018_figure_1-800-77b68b37c.png" width="1658" height="1058" /></picture>

<p><em><a href="https://arxiv.org/pdf/1705.08807">When Will AI Exceed Human Performance? Evidence from AI Experts</a></em>, Figure 1.</p>

<p>Their plots also included a 95% bootstrap confidence interval for the mean CDF. This is a measure of statistical variability in the estimate of the mean due to the finite sample size, not a measure of the dispersion of responses. Since ESPAI sample sizes are quite large, and the mean hence quite precisely estimated, I believe this bootstrap confidence interval is of secondary importance.</p>

<p>I dispense with the bootstrap CI and instead use the shaded area around the aggregate CDF to show the distribution of responses, specifically the central half of CDFs, from the 25th to the 75th percentile. This is a more systematic and quantitative alternative to displaying a random subset of individual CDFs.</p>

<p>It is clear that authors of previous ESPAI analyses are well aware of what the bootstrap CI measures and interpret it correctly. However, it’s possible that some casual readers did not become fully aware of this. For the avoidance of doubt, the 95% bootstrap CI is radically different (and radically more narrow) than the interval containing 95% of individual CDFs. The latter would cover almost the entire plot:</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-400-9d7505984.webp 400w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-600-9d7505984.webp 600w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-800-9d7505984.webp 800w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1000-9d7505984.webp 1000w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1500-9d7505984.webp 1500w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1920-9d7505984.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-400-9d7505984.jpeg 400w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-600-9d7505984.jpeg 600w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-800-9d7505984.jpeg 800w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1000-9d7505984.jpeg 1000w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1500-9d7505984.jpeg 1500w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1920-9d7505984.jpeg 1920w" type="image/jpeg" /><img alt="Shaded area showing central 95% of individual CDFs for HLMI" src="/generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-800-9d7505984.png" width="1920" height="1440" /></picture>

<p>The degree of disagreement among respondents is such that instead of 95%, I show the central 50% in my plots. This is the widest interval that I found sufficiently visually informative. More typical intervals like the central 80% or 70% would cover such a wide range of predictions as to be less informative.</p>

<div class="bootstrap-styles bootstrap-reboot">
  <div class="fw-bold"><div>Distribution of responses</div>
</div>
  <div class="accordion" id="range-of-responses-accordion">
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading0">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#range-of-responses-accordioncontent0" aria-expanded="false" aria-controls="range-of-responses-accordioncontent0">
        
<div>Full automation of labor (FAOL): central <strong>95%</strong> (2.5th to 97.5th percentile)</div>


      </button>
    </h2>
    <div id="range-of-responses-accordioncontent0" class="accordion-collapse collapse" aria-labelledby="heading0">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-400-d60089c8a.webp 400w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-600-d60089c8a.webp 600w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-800-d60089c8a.webp 800w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-1000-d60089c8a.webp 1000w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-1500-d60089c8a.webp 1500w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-1920-d60089c8a.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-400-d60089c8a.jpeg 400w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-600-d60089c8a.jpeg 600w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-800-d60089c8a.jpeg 800w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-1000-d60089c8a.jpeg 1000w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-1500-d60089c8a.jpeg 1500w, /generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-1920-d60089c8a.jpeg 1920w" type="image/jpeg" /><img alt="Shaded area showing central 95% of individual CDFs for FAOL" src="/generated/_posts/../assets/images/espai/range_of_responses_95_FAOL-800-d60089c8a.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading1">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#range-of-responses-accordioncontent1" aria-expanded="false" aria-controls="range-of-responses-accordioncontent1">
        <div>Full automation of labor (FAOL): central <strong>80%</strong> (10th to 90th percentile)</div>


      </button>
    </h2>
    <div id="range-of-responses-accordioncontent1" class="accordion-collapse collapse" aria-labelledby="heading1">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-400-ec23db928.webp 400w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-600-ec23db928.webp 600w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-800-ec23db928.webp 800w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-1000-ec23db928.webp 1000w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-1500-ec23db928.webp 1500w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-1920-ec23db928.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-400-ec23db928.jpeg 400w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-600-ec23db928.jpeg 600w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-800-ec23db928.jpeg 800w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-1000-ec23db928.jpeg 1000w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-1500-ec23db928.jpeg 1500w, /generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-1920-ec23db928.jpeg 1920w" type="image/jpeg" /><img alt="Shaded area showing central 80% of individual CDFs for FAOL" src="/generated/_posts/../assets/images/espai/range_of_responses_80_FAOL-800-ec23db928.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading2">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#range-of-responses-accordioncontent2" aria-expanded="false" aria-controls="range-of-responses-accordioncontent2">
        <div>Full automation of labor (FAOL): central <strong>70%</strong> (15th to 85th percentile)</div>


      </button>
    </h2>
    <div id="range-of-responses-accordioncontent2" class="accordion-collapse collapse" aria-labelledby="heading2">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-400-8fe080a68.webp 400w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-600-8fe080a68.webp 600w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-800-8fe080a68.webp 800w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-1000-8fe080a68.webp 1000w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-1500-8fe080a68.webp 1500w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-1920-8fe080a68.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-400-8fe080a68.jpeg 400w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-600-8fe080a68.jpeg 600w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-800-8fe080a68.jpeg 800w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-1000-8fe080a68.jpeg 1000w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-1500-8fe080a68.jpeg 1500w, /generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-1920-8fe080a68.jpeg 1920w" type="image/jpeg" /><img alt="Shaded area showing central 70% of individual CDFs for FAOL" src="/generated/_posts/../assets/images/espai/range_of_responses_70_FAOL-800-8fe080a68.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading3">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#range-of-responses-accordioncontent3" aria-expanded="false" aria-controls="range-of-responses-accordioncontent3">
        <div>Full automation of labor (FAOL): central <strong>50%</strong> (25th to 75th percentile)</div>


      </button>
    </h2>
    <div id="range-of-responses-accordioncontent3" class="accordion-collapse collapse" aria-labelledby="heading3">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-400-4c95edc16.webp 400w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-600-4c95edc16.webp 600w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-800-4c95edc16.webp 800w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-1000-4c95edc16.webp 1000w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-1500-4c95edc16.webp 1500w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-1920-4c95edc16.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-400-4c95edc16.jpeg 400w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-600-4c95edc16.jpeg 600w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-800-4c95edc16.jpeg 800w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-1000-4c95edc16.jpeg 1000w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-1500-4c95edc16.jpeg 1500w, /generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-1920-4c95edc16.jpeg 1920w" type="image/jpeg" /><img alt="Shaded area showing central 50% of individual CDFs for FAOL" src="/generated/_posts/../assets/images/espai/range_of_responses_50_FAOL-800-4c95edc16.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading4">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#range-of-responses-accordioncontent4" aria-expanded="false" aria-controls="range-of-responses-accordioncontent4">
        <div>High Level Machine Intelligence (HLMI): central <strong>95%</strong> (2.5th to 97.5th percentile)</div>


      </button>
    </h2>
    <div id="range-of-responses-accordioncontent4" class="accordion-collapse collapse" aria-labelledby="heading4">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-400-9d7505984.webp 400w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-600-9d7505984.webp 600w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-800-9d7505984.webp 800w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1000-9d7505984.webp 1000w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1500-9d7505984.webp 1500w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1920-9d7505984.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-400-9d7505984.jpeg 400w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-600-9d7505984.jpeg 600w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-800-9d7505984.jpeg 800w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1000-9d7505984.jpeg 1000w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1500-9d7505984.jpeg 1500w, /generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-1920-9d7505984.jpeg 1920w" type="image/jpeg" /><img alt="Shaded area showing central 95% of individual CDFs for HLMI" src="/generated/_posts/../assets/images/espai/range_of_responses_95_HLMI-800-9d7505984.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading5">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#range-of-responses-accordioncontent5" aria-expanded="false" aria-controls="range-of-responses-accordioncontent5">
        <div>High Level Machine Intelligence (HLMI): central <strong>80%</strong> (10th to 90th percentile)</div>


      </button>
    </h2>
    <div id="range-of-responses-accordioncontent5" class="accordion-collapse collapse" aria-labelledby="heading5">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-400-8cc7c751c.webp 400w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-600-8cc7c751c.webp 600w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-800-8cc7c751c.webp 800w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-1000-8cc7c751c.webp 1000w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-1500-8cc7c751c.webp 1500w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-1920-8cc7c751c.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-400-8cc7c751c.jpeg 400w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-600-8cc7c751c.jpeg 600w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-800-8cc7c751c.jpeg 800w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-1000-8cc7c751c.jpeg 1000w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-1500-8cc7c751c.jpeg 1500w, /generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-1920-8cc7c751c.jpeg 1920w" type="image/jpeg" /><img alt="Shaded area showing central 80% of individual CDFs for HLMI" src="/generated/_posts/../assets/images/espai/range_of_responses_80_HLMI-800-8cc7c751c.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading6">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#range-of-responses-accordioncontent6" aria-expanded="false" aria-controls="range-of-responses-accordioncontent6">
        <div>High Level Machine Intelligence (HLMI): central <strong>70%</strong> (15th to 85th percentile)</div>


      </button>
    </h2>
    <div id="range-of-responses-accordioncontent6" class="accordion-collapse collapse" aria-labelledby="heading6">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-400-e62c6d1b4.webp 400w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-600-e62c6d1b4.webp 600w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-800-e62c6d1b4.webp 800w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-1000-e62c6d1b4.webp 1000w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-1500-e62c6d1b4.webp 1500w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-1920-e62c6d1b4.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-400-e62c6d1b4.jpeg 400w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-600-e62c6d1b4.jpeg 600w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-800-e62c6d1b4.jpeg 800w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-1000-e62c6d1b4.jpeg 1000w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-1500-e62c6d1b4.jpeg 1500w, /generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-1920-e62c6d1b4.jpeg 1920w" type="image/jpeg" /><img alt="Shaded area showing central 70% of individual CDFs for HLMI" src="/generated/_posts/../assets/images/espai/range_of_responses_70_HLMI-800-e62c6d1b4.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading7">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#range-of-responses-accordioncontent7" aria-expanded="false" aria-controls="range-of-responses-accordioncontent7">
        <div>High Level Machine Intelligence (HLMI): central <strong>50%</strong> (25th to 75th percentile)</div>


      </button>
    </h2>
    <div id="range-of-responses-accordioncontent7" class="accordion-collapse collapse" aria-labelledby="heading7">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-400-9c67a3736.webp 400w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-600-9c67a3736.webp 600w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-800-9c67a3736.webp 800w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-1000-9c67a3736.webp 1000w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-1500-9c67a3736.webp 1500w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-1920-9c67a3736.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-400-9c67a3736.jpeg 400w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-600-9c67a3736.jpeg 600w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-800-9c67a3736.jpeg 800w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-1000-9c67a3736.jpeg 1000w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-1500-9c67a3736.jpeg 1500w, /generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-1920-9c67a3736.jpeg 1920w" type="image/jpeg" /><img alt="Shaded area showing central 50% of individual CDFs for HLMI" src="/generated/_posts/../assets/images/espai/range_of_responses_50_HLMI-800-9c67a3736.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
</div>
  </div>

<h1 id="aggregating-hlmi-faol">Aggregating across the task and occupation framings</h1>

<p>Before being asked for their forecasts, respondents were shown the following definitions for HLMI (High-Level Machine Intelligence) and FAOL (Full Automation of Labor):</p>

<p>HLMI (tasks):</p>
<blockquote>
  <p>High-level machine intelligence (HLMI) is achieved when unaided machines can accomplish every task better and more cheaply than human workers. Ignore aspects of tasks for which being a human is intrinsically advantageous, e.g., being accepted as a jury member. Think feasibility, not adoption.</p>
</blockquote>

<p>FAOL (occupations):</p>
<blockquote>
  <p>Say an occupation becomes fully automatable when unaided machines can accomplish it better and more cheaply than human workers. Ignore aspects of occupations for which being a human is intrinsically advantageous, e.g., being accepted as a jury member. Think feasibility, not adoption.
Say we have reached ‘full automation of labor’ when all occupations are fully automatable. That is, when for any occupation, machines could be built to carry out the task better and more cheaply than human workers.</p>
</blockquote>

<p>The two questions are very similar. The main difference is that HLMI is phrased in terms of tasks, while FAOL asks about occupations. In principle, we should expect the same prediction on both questions. As noted by the authors,</p>

<blockquote>
  <p>since occupations might naturally be understood either as complex tasks, composed of tasks, or closely connected with one of these, achieving HLMI seems to either imply having already achieved FAOL, or suggest being close.</p>
</blockquote>

<p>So it is legitimate to think of these as two different framings of the same question.</p>

<p>Despite their similarity, these framings yield very different predictions. The figures below show the result of using my preferred settings (median aggregation, flexible distributions), except that HLMI and FAOL are shown separately instead of aggregated:</p>

<div class="bootstrap-styles bootstrap-reboot">
  <div class="fw-bold"><div>HLMI vs FAOL</div>
</div>
  <div class="accordion" id="hlmi-vs-faol-accordion">
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading0">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#hlmi-vs-faol-accordioncontent0" aria-expanded="false" aria-controls="hlmi-vs-faol-accordioncontent0">
        
<div>Full automation of labor (FAOL)</div>


      </button>
    </h2>
    <div id="hlmi-vs-faol-accordioncontent0" class="accordion-collapse collapse" aria-labelledby="heading0">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/headline_result_FAOL-400-309704ca2.webp 400w, /generated/_posts/../assets/images/espai/headline_result_FAOL-600-309704ca2.webp 600w, /generated/_posts/../assets/images/espai/headline_result_FAOL-800-309704ca2.webp 800w, /generated/_posts/../assets/images/espai/headline_result_FAOL-1000-309704ca2.webp 1000w, /generated/_posts/../assets/images/espai/headline_result_FAOL-1500-309704ca2.webp 1500w, /generated/_posts/../assets/images/espai/headline_result_FAOL-2000-309704ca2.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/headline_result_FAOL-400-309704ca2.jpeg 400w, /generated/_posts/../assets/images/espai/headline_result_FAOL-600-309704ca2.jpeg 600w, /generated/_posts/../assets/images/espai/headline_result_FAOL-800-309704ca2.jpeg 800w, /generated/_posts/../assets/images/espai/headline_result_FAOL-1000-309704ca2.jpeg 1000w, /generated/_posts/../assets/images/espai/headline_result_FAOL-1500-309704ca2.jpeg 1500w, /generated/_posts/../assets/images/espai/headline_result_FAOL-2000-309704ca2.jpeg 2000w" type="image/jpeg" /><img alt="" src="/generated/_posts/../assets/images/espai/headline_result_FAOL-800-309704ca2.png" width="2400" height="1800" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading1">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#hlmi-vs-faol-accordioncontent1" aria-expanded="false" aria-controls="hlmi-vs-faol-accordioncontent1">
        <div>High Level Machine Intelligence (HLMI)</div>


      </button>
    </h2>
    <div id="hlmi-vs-faol-accordioncontent1" class="accordion-collapse collapse" aria-labelledby="heading1">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/headline_result_HLMI-400-767c2d218.webp 400w, /generated/_posts/../assets/images/espai/headline_result_HLMI-600-767c2d218.webp 600w, /generated/_posts/../assets/images/espai/headline_result_HLMI-800-767c2d218.webp 800w, /generated/_posts/../assets/images/espai/headline_result_HLMI-1000-767c2d218.webp 1000w, /generated/_posts/../assets/images/espai/headline_result_HLMI-1500-767c2d218.webp 1500w, /generated/_posts/../assets/images/espai/headline_result_HLMI-2000-767c2d218.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/headline_result_HLMI-400-767c2d218.jpeg 400w, /generated/_posts/../assets/images/espai/headline_result_HLMI-600-767c2d218.jpeg 600w, /generated/_posts/../assets/images/espai/headline_result_HLMI-800-767c2d218.jpeg 800w, /generated/_posts/../assets/images/espai/headline_result_HLMI-1000-767c2d218.jpeg 1000w, /generated/_posts/../assets/images/espai/headline_result_HLMI-1500-767c2d218.jpeg 1500w, /generated/_posts/../assets/images/espai/headline_result_HLMI-2000-767c2d218.jpeg 2000w" type="image/jpeg" /><img alt="" src="/generated/_posts/../assets/images/espai/headline_result_HLMI-800-767c2d218.png" width="2400" height="1800" /></picture>


      </div>
    </div>
  </div>
  
    <div class="accordion-item">
    <h2 class="accordion-header" id="heading2">
      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#hlmi-vs-faol-accordioncontent2" aria-expanded="false" aria-controls="hlmi-vs-faol-accordioncontent2">
        <div>Comparison of HLMI and FAOL</div>


      </button>
    </h2>
    <div id="hlmi-vs-faol-accordioncontent2" class="accordion-collapse collapse" aria-labelledby="heading2">
      <div class="accordion-body">
        
<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_hlmi_faol-400-35afec9b7.webp 400w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-600-35afec9b7.webp 600w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-800-35afec9b7.webp 800w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-1000-35afec9b7.webp 1000w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-1500-35afec9b7.webp 1500w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-1920-35afec9b7.webp 1920w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/compare_hlmi_faol-400-35afec9b7.jpeg 400w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-600-35afec9b7.jpeg 600w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-800-35afec9b7.jpeg 800w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-1000-35afec9b7.jpeg 1000w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-1500-35afec9b7.jpeg 1500w, /generated/_posts/../assets/images/espai/compare_hlmi_faol-1920-35afec9b7.jpeg 1920w" type="image/jpeg" /><img alt="" src="/generated/_posts/../assets/images/espai/compare_hlmi_faol-800-35afec9b7.png" width="1920" height="1440" /></picture>


      </div>
    </div>
  </div>
  
</div>
  </div>

<p>Previous analyses never aggregated the task and occupation results, only presenting them separately. Recall that using their methodology<sup id="fnref:theirmeth" role="doc-noteref"><a href="#fn:theirmeth" class="footnote" rel="footnote">13</a></sup>, the authors reported the median year for all human tasks was 2047, while for occupations it was 2116 (a difference of 69 years!).</p>

<p>Presenting results separately allows for a deeper understanding for patient and sophisticated readers. However, we must be realistic: it is very likely that a single “headline” result will be most widely spread and remembered. Attempting to prevent this by <em>only</em> presenting HLMI (tasks) and FAOL (occupations) separately is largely futile, in my opinion. While it may sometimes encourage nuance, more often it will make it easier for readers to choose whichever of the two results best fits their preconceptions.</p>

<p>Indeed, my brief investigation suggests that citations of the 2023 survey results are strongly biased towards tasks (HLMI) over occupations (FAOL). Out of the 20 articles<sup id="fnref:articles-table" role="doc-noteref"><a href="#fn:articles-table" class="footnote" rel="footnote">14</a></sup> on the first two pages of Google Scholar citations of the 2024 preprint, 7 reported at least one of HLMI or FAOL. Among these</p>

<ul>
  <li>6 out of 7 (85%) reported tasks (HLMI) only</li>
  <li>1 out of 7 (15%) reported tasks and occupations</li>
  <li>None (0%) reported occupations (FAOL) only</li>
</ul>

<p>Therefore, I consider it preferable, when providing headline results, to aggregate accross HLMI and FAOL to provide a single estimate of when all tasks or occupations will be automatable.</p>

<p>I achieve this by simply including answers to both questions prior to aggregation, i.e. no special form of aggregation is used for aggregating tasks (HLMI) and occupations (FAOL). Since more respondents were asked about tasks than occupations, I achieve equal weight by resampling from the occupations (FAOL) responses.</p>

<h1 id="codebase">Codebase</h1>

<p>For this analysis, I wrote a fully new codebase, available at <strong><a href="https://github.com/tadamcz/espai">github.com/tadamcz/espai</a></strong>. This was necessary because system used for previous analyses relied on a collection of Jupyter notebooks that required manually running cells in a specific, undocumented order to achieve results.</p>

<p>This new codebase, written in Python, makes our analyses reproducible for the first time. The codebase includes a robust test suite.</p>

<p>We are open sourcing the codebase and invite scrutiny and contributions from other researchers. It provides user-friendly configuration objects that make it easy for you to run your own variations of the analysis and produce your own plots.</p>
<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:scope" role="doc-endnote">
      <p>Timing will be my sole focus. I ignore ESPAI’s questions about whether the overall impact of AI will be positive or negative, the preferred rate of progress, etc. <a href="#fnref:scope" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:language" role="doc-endnote">
      <p>This uses plain language as much as possible. Depending on your audience, you may wish to replace “central half” with “interquartile range”, or use phrases like “75th percentile”. Also, you can round 2048 to 2050 and 2103 to 2100 without losing anything of value. <a href="#fnref:language" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:whiskers" role="doc-endnote">
      <p>Note that the ‘whiskers’ of our box plot are slightly nonstandard: they show the 15th and 85th percentile responses. Whiskers are more commonly used to represent the 1.5 IQR value: from above the upper quartile (75th percentile), a distance of 1.5 times the interquartile range (IQR) is measured out and a whisker is drawn <em>up to</em> the largest observed data point from the dataset that falls within this distance. <a href="#fnref:whiskers" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:other_hlmi_faol_differences" role="doc-endnote">
      <p>As a further subtlety, “the question sets do differ beyond definitions: only the HLMI questions are preceded by the instruction to “assume that human scientific activity continues without major negative disruption,” and the FAOL block asks a sequence of questions about the automation of specific occupations before asking about full automation of labor” (<a href="https://arxiv.org/abs/2401.02843">Thousands of AI Authors on the Future of AI</a>) <a href="#fnref:other_hlmi_faol_differences" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:zero_one" role="doc-endnote">
      <p>In reality there are even more complications that I elide in the main text. If a set of probabilities contains both values of exactly 1, and values of exactly 0, the geometric mean of odds is undefined. If a one is present and there are no zeroes, the aggregate is one; and a zero is present and there are no ones, the aggregate is zero. However, floating point numbers by design have much more precision near zero than near one. For example, we can represent extremely small numbers like <code class="language-plaintext highlighter-rouge">1e-18</code>, but <code class="language-plaintext highlighter-rouge">1 - 1e-18</code> just gets represented as <code class="language-plaintext highlighter-rouge">1.0</code>. This means that very high probabilities get represented as 1 when equally extreme low probabilities do not get represented as zero. As a result, high probabilities get an “unfair advantage”. It should be possible to circumvent some of these problems by using alternative representations of the probabilities. However, many respondents directly give probabilities of 0% or 100% (as opposed to their fitted CDFs merely reaching these values). This poses a more fundamental problem for the geometric mean of odds. <a href="#fnref:zero_one" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:median-theorem" role="doc-endnote">
      <p>I believe this is probably a theorem (with the possible exception of some degenerate cases),  but I am not entirely sure since I have not attempted to actually write down or locate a proof. If you’ve got a proof or counter-example please contact me. <a href="#fnref:median-theorem" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:plot-fn" role="doc-endnote">

      <p>I give examples only for the fixed-probabilities framing in the main text because it’s easier to explain in the context of the loss functions we are using, which all use probabilities. However, we can see similar phenomena when looking at the fixed-years data. These are 9 plots representative of the bottom half of fixed-years Gamma fits. <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-400-e3ca9eefe.webp 400w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-600-e3ca9eefe.webp 600w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-800-e3ca9eefe.webp 800w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-1000-e3ca9eefe.webp 1000w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-1500-e3ca9eefe.webp 1500w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-2000-e3ca9eefe.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-400-e3ca9eefe.jpeg 400w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-600-e3ca9eefe.jpeg 600w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-800-e3ca9eefe.jpeg 800w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-1000-e3ca9eefe.jpeg 1000w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-1500-e3ca9eefe.jpeg 1500w, /generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-2000-e3ca9eefe.jpeg 2000w" type="image/jpeg" /><img alt="Gamma distribution fits to fixed years survey data, showing respondent points and Gamma CDFs." src="/generated/_posts/../assets/images/espai/9_prev_gamma_fits_Fixed_years_annotations_True-800-e3ca9eefe.png" width="2670" height="2768" /></picture>
 Since I am in this section aiming for expository clarity rather than the greatest rigour, I also elided the following complication in the main text. All distributions shown are Gammas fitted by previous authors, using the MSE of probabilities as the loss function. However, to produce the ranking of fits used to select which examples to plot, I used a different loss function. This was the MSE of years (horizontal direction) for the fixed-years plot, and the log loss for the fixed-probabilities plot. These loss functions make my examples more intuitive, while still being somewhat systematic (instead of cherry-picking examples). <a href="#fnref:plot-fn" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:kl-divergence" role="doc-endnote">

      <p>The log loss can be motivated by analogy to the Kullback-Leibler (KL) divergence between discrete distributions. For each point in a respondent’s CDF data, we can think of it as a binary probability distribution <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi>p</mi><mo separator="true">,</mo><mn>1</mn><mo>−</mo><mi>p</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(p, 1-p)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">p</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">p</span><span class="mclose">)</span></span></span></span>. The fitted CDF gives us another binary distribution <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi>q</mi><mo separator="true">,</mo><mn>1</mn><mo>−</mo><mi>q</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(q, 1-q)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mclose">)</span></span></span></span> at that point. The KL divergence between these distributions would be</p>

      <span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.25em" columnalign="right left" columnspacing="0em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><msub><mi>D</mi><mrow><mi>K</mi><mi>L</mi></mrow></msub><mo stretchy="false">(</mo><mi>p</mi><mi mathvariant="normal">∥</mi><mi>q</mi><mo stretchy="false">)</mo></mrow></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><mrow></mrow><mo>=</mo><mi>p</mi><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><mi>p</mi><mi mathvariant="normal">/</mi><mi>q</mi><mo stretchy="false">)</mo><mo>+</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>p</mi><mo stretchy="false">)</mo><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>p</mi><mo stretchy="false">)</mo><mi mathvariant="normal">/</mi><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>q</mi><mo stretchy="false">)</mo><mo stretchy="false">)</mo></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow></mrow></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="true"><mrow><mrow></mrow><mo>=</mo><mi>p</mi><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><mi>p</mi><mo stretchy="false">)</mo><mo>−</mo><mi>p</mi><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><mi>q</mi><mo stretchy="false">)</mo><mo>+</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>p</mi><mo stretchy="false">)</mo><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>p</mi><mo stretchy="false">)</mo><mo>−</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>p</mi><mo stretchy="false">)</mo><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>q</mi><mo stretchy="false">)</mo></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">\begin{align*}
D_{KL}(p\|q) &amp;= p \log(p/q) + (1-p)\log((1-p)/(1-q)) \\
&amp;= p\log(p) - p\log(q) + (1-p)\log(1-p) - (1-p)\log(1-q)
\end{align*}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:3em;vertical-align:-1.25em;"></span><span class="mord"><span class="mtable"><span class="col-align-r"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.75em;"><span style="top:-3.91em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal" style="margin-right:0.02778em;">D</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3283em;"><span style="top:-2.55em;margin-left:-0.0278em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.07153em;">K</span><span class="mord mathnormal mtight">L</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">p</span><span class="mord">∥</span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mclose">)</span></span></span><span style="top:-2.41em;"><span class="pstrut" style="height:3em;"></span><span class="mord"></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.25em;"><span></span></span></span></span></span><span class="col-align-l"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.75em;"><span style="top:-3.91em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord"></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord mathnormal">p</span><span class="mord">/</span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal">p</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">((</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal">p</span><span class="mclose">)</span><span class="mord">/</span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mclose">))</span></span></span><span style="top:-2.41em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord"></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord mathnormal">p</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal">p</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal">p</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal">p</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mclose">)</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.25em;"><span></span></span></span></span></span></span></span></span></span></span></span>

      <p>The log loss <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>−</mo><mo stretchy="false">[</mo><mi>p</mi><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><mi>q</mi><mo stretchy="false">)</mo><mo>+</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>p</mi><mo stretchy="false">)</mo><mi>log</mi><mo>⁡</mo><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>q</mi><mo stretchy="false">)</mo><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">-[p\log(q) + (1-p)\log(1-q)]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">−</span><span class="mopen">[</span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">p</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mclose">)]</span></span></span></span> differs from this only by dropping the terms that don’t depend on <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>q</mi></mrow><annotation encoding="application/x-tex">q</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span></span>, and thus has the same minimum. However, this is merely an intuitive motivation: we are not actually comparing two discrete distributions, but rather measuring how well our continuous CDF matches specific points. <a href="#fnref:kl-divergence" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:gengamma" role="doc-endnote">
      <p>Note that although the generalised gamma distribution has three parameters, as far as I can tell it does not have the flexibility to fit three arbitrary points of CDF data. I came to this conclusion by extensive empirical investigation, but I haven’t been able to locate or write a proof to conclusively establish this one way or another. Please write to me if you know the answer. By the way, I don’t know of any parametric 3-parameter distribution that has this property. I used flexible distributions for ESPAI because they are the only solution I am aware of. <a href="#fnref:gengamma" class="reversefootnote" role="doc-backlink">&#8617;</a> <a href="#fnref:gengamma:1" class="reversefootnote" role="doc-backlink">&#8617;<sup>2</sup></a></p>
    </li>
    <li id="fn:os-impl" role="doc-endnote">
      <p>The code uses the paid MakeDistribution API, but a copy of all API responses needed to perform the analysis is stored in the repository. <a href="#fnref:os-impl" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:patterns-bias" role="doc-endnote">

      <p>I informally explored possible biases in the Gamma fits using the following histograms of residuals. While several of the residual distributions seem clearly biased, they also in most cases have 80% of the probability mass quite close to a residual of zero. I still do not fully understand why the effect of this data on aggregate CDFs is so muted, but I have not prioritised a more rigorous analysis.</p>
      <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-400-f5cb72cdc.webp 400w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-600-f5cb72cdc.webp 600w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-800-f5cb72cdc.webp 800w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-1000-f5cb72cdc.webp 1000w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-1500-f5cb72cdc.webp 1500w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-2000-f5cb72cdc.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-400-f5cb72cdc.jpeg 400w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-600-f5cb72cdc.jpeg 600w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-800-f5cb72cdc.jpeg 800w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-1000-f5cb72cdc.jpeg 1000w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-1500-f5cb72cdc.jpeg 1500w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-2000-f5cb72cdc.jpeg 2000w" type="image/jpeg" /><img alt="Histogram of residuals for Gamma fits in FAOL." src="/generated/_posts/../assets/images/espai/prev_fits_bias_hist_FAOL-800-f5cb72cdc.png" width="4500" height="3000" /></picture>

      <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-400-45e5a09c1.webp 400w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-600-45e5a09c1.webp 600w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-800-45e5a09c1.webp 800w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-1000-45e5a09c1.webp 1000w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-1500-45e5a09c1.webp 1500w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-2000-45e5a09c1.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-400-45e5a09c1.jpeg 400w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-600-45e5a09c1.jpeg 600w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-800-45e5a09c1.jpeg 800w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-1000-45e5a09c1.jpeg 1000w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-1500-45e5a09c1.jpeg 1500w, /generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-2000-45e5a09c1.jpeg 2000w" type="image/jpeg" /><img alt="Histogram of residuals for Gamma fits in HLMI." src="/generated/_posts/../assets/images/espai/prev_fits_bias_hist_HLMI-800-45e5a09c1.png" width="4500" height="3000" /></picture>
      <p><a href="#fnref:patterns-bias" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:disagreement_vs_framing" role="doc-endnote">

      <p>Due to the large framing effects of both tasks vs occupations, and fixed-years vs fixed-probabilities, which have been consistently observed, one may reasonably quarrel with describing this plot as showing “disagreement among respondents” or “the range of opinion among experts”. Part of why the range is so wide is that responses are highly sensitive to framing. Rather than saying experts <em>disagree</em> per se, purists might wish to say that expert opinion is undefined or unstable.</p>

      <p>This is a rather philosophical point. The more practical version of it is to ask whether we should aggregate accross these framings, or just present them separately.</p>

      <p>My position (further discussed <a href="#aggregating-hlmi-faol">here</a>) is that while disaggregated results should also be available, aggregation is necessary to produce useful results. Aggregating things that have some commonalities and some differences is indeed inherent to science. While previous authors presented HLMI and FAOL separately, they did not present fixed-years and fixed-probabilities separately, which would be required if we take the anti-aggregation argument to its full conclusion. <a href="#fnref:disagreement_vs_framing" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:theirmeth" role="doc-endnote">
      <p>Their methodology is different from what I used in the plots above, but yields very similar results for the median year. <a href="#fnref:theirmeth" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:articles-table" role="doc-endnote">
      <p>Here is the full table:</p>

      <table>
        <thead>
          <tr>
            <th>Title</th>
            <th>Year</th>
            <th>Link</th>
            <th>Citation</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>Artificial intelligence: Arguments for catastrophic risk</td>
            <td>2024</td>
            <td><a href="https://compass.onlinelibrary.wiley.com/doi/abs/10.1111/phc3.12964">Link</a></td>
            <td>HLMI only</td>
          </tr>
          <tr>
            <td>Safety cases for frontier AI</td>
            <td>2024</td>
            <td><a href="https://arxiv.org/abs/2410.21572">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>Me, myself and AI: How gender, personality and emotions determine willingness to use Strong AI for self-improvement</td>
            <td>2024</td>
            <td><a href="https://www.sciencedirect.com/science/article/pii/S0040162524005584">Link</a></td>
            <td>HLMI only</td>
          </tr>
          <tr>
            <td>Theory Is All You Need: AI, Human Cognition, and Causal Reasoning</td>
            <td>2024</td>
            <td><a href="https://www.bu.edu/dbi/files/2024/08/FelinHolwegAug2024_SSRN.pdf">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>Shared Awareness Across Domain‐Specific Artificial Intelligence</td>
            <td>2024</td>
            <td><a href="https://onlinelibrary.wiley.com/doi/abs/10.1002/aisy.202300740">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>Existential risk from transformative AI: an economic perspective</td>
            <td>2024</td>
            <td><a href="https://journals.vilniustech.lt/index.php/TEDE/article/view/21525">Link</a></td>
            <td>HLMI only</td>
          </tr>
          <tr>
            <td>Theory is all you need: AI, human cognition, and decision making</td>
            <td>2024</td>
            <td><a href="https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4737265">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>Generative artificial intelligence usage by researchers at work</td>
            <td>2024</td>
            <td><a href="https://www.sciencedirect.com/science/article/pii/S0736585324000911">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>AI Horizon Scanning, White Paper p3395, IEEE-SA. Part I: Areas of Attention</td>
            <td>2024</td>
            <td><a href="https://arxiv.org/abs/2410.01808">Link</a></td>
            <td>Two tasks (build a payment processing site, fine-tune an LLM)</td>
          </tr>
          <tr>
            <td>Generative AI, Ingenuity, and Law</td>
            <td>2024</td>
            <td><a href="https://ieeexplore.ieee.org/abstract/document/10598190/">Link</a></td>
            <td>HLMI only</td>
          </tr>
          <tr>
            <td>AI Emergency Preparedness: Examining the federal government’s ability to detect and respond to AI-related national security threats</td>
            <td>2024</td>
            <td><a href="https://arxiv.org/abs/2407.17347">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>Transformative AI, existential risk, and real interest rates</td>
            <td>2024</td>
            <td><a href="https://basilhalperin.com/papers/agi_emh.pdf">Link</a></td>
            <td>HLMI only</td>
          </tr>
          <tr>
            <td>Misrepresented Technological Solutions in Imagined Futures: The Origins and Dangers of AI Hype in the Research Community</td>
            <td>2024</td>
            <td><a href="https://ojs.aaai.org/index.php/AIES/article/view/31737">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>Eliciting the Priors of Large Language Models using Iterated In-Context Learning</td>
            <td>2024</td>
            <td><a href="https://arxiv.org/abs/2406.01860">Link</a></td>
            <td>HLMI only</td>
          </tr>
          <tr>
            <td>Strategic Insights from Simulation Gaming of AI Race Dynamics</td>
            <td>2024</td>
            <td><a href="https://arxiv.org/abs/2410.03092">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>Evolutionary debunking and value alignment</td>
            <td>2024</td>
            <td><a href="https://globalprioritiesinstitute.org/wp-content/uploads/Michael-T.-Dale-and-Bradford-Saad-Evolutionary-debunking-and-value-alignment.pdf">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>Robust Technology Regulation</td>
            <td>2024</td>
            <td><a href="https://arxiv.org/abs/2408.17398">Link</a></td>
            <td>Extinction risk only</td>
          </tr>
          <tr>
            <td>Interpreting Affine Recurrence Learning in GPT-style Transformers</td>
            <td>2024</td>
            <td><a href="https://arxiv.org/abs/2410.17438">Link</a></td>
            <td>No numbers</td>
          </tr>
          <tr>
            <td>Malicious use of AI and challenges to psychological security: Future risks</td>
            <td>2024</td>
            <td><a href="https://russiancouncil.ru/en/analytics-and-comments/analytics/malicious-use-of-ai-and-challenges-to-psychological-security-future-risks/">Link</a></td>
            <td>HLMI and FAOL</td>
          </tr>
          <tr>
            <td>Grow Your Artificial Intelligence Competence</td>
            <td>2024</td>
            <td><a href="https://ieeexplore.ieee.org/abstract/document/10685842/">Link</a></td>
            <td>No numbers</td>
          </tr>
        </tbody>
      </table>
      <p><a href="#fnref:articles-table" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><summary type="html"><![CDATA[This report examines how to interpret AI timeline forecasts from AI experts. I consider how distribution fitting and aggregation methods influence results, and provide recommendations for how survey results should be analysed and presented in the future.]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/espai/metatag.png" /><media:content medium="image" url="https://bayes.net/assets/images/espai/metatag.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Elevated computing</title><link href="https://bayes.net/elevated-computing/" rel="alternate" type="text/html" title="Elevated computing" /><published>2023-08-03T00:00:00+00:00</published><updated>2023-08-03T00:00:00+00:00</updated><id>https://bayes.net/elevated-computing</id><content type="html" xml:base="https://bayes.net/elevated-computing/"><![CDATA[<p>I made a mount to lift my laptop off the surface of my desk:</p>

<div class="bootstrap-styles bootstrap-reboot">
  <div id="mount-carousel" class="carousel carousel-dark slide">
    <div class="carousel-indicators">
      
        <button type="button" data-bs-target="#mount-carousel" data-bs-slide-to="0" class=" active"></button>
      
        <button type="button" data-bs-target="#mount-carousel" data-bs-slide-to="1" class=""></button>
      
        <button type="button" data-bs-target="#mount-carousel" data-bs-slide-to="2" class=""></button>
      
        <button type="button" data-bs-target="#mount-carousel" data-bs-slide-to="3" class=""></button>
      
        <button type="button" data-bs-target="#mount-carousel" data-bs-slide-to="4" class=""></button>
      
    </div>
    <div class="carousel-inner">
      
        <div class="carousel-item  active" style="object-fit: contain">
          <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3308-400-dcd5a0ce9.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-600-dcd5a0ce9.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-800-dcd5a0ce9.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-1000-dcd5a0ce9.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-1500-dcd5a0ce9.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-2000-dcd5a0ce9.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3308-400-dcd5a0ce9.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-600-dcd5a0ce9.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-800-dcd5a0ce9.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-1000-dcd5a0ce9.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-1500-dcd5a0ce9.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3308-2000-dcd5a0ce9.jpeg 2000w" type="image/jpeg" /><img alt="IMG_3308" src="/generated/_posts/../assets/images/laptop-mount/IMG_3308-800-dcd5a0ce9.jpg" width="4032" height="3024" /></picture>

        </div>
      
        <div class="carousel-item " style="object-fit: contain">
          <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3316-400-edeb48d16.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-600-edeb48d16.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-800-edeb48d16.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-1000-edeb48d16.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-1500-edeb48d16.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-2000-edeb48d16.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3316-400-edeb48d16.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-600-edeb48d16.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-800-edeb48d16.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-1000-edeb48d16.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-1500-edeb48d16.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3316-2000-edeb48d16.jpeg 2000w" type="image/jpeg" /><img alt="IMG_3315" src="/generated/_posts/../assets/images/laptop-mount/IMG_3316-800-edeb48d16.jpg" width="4032" height="3024" /></picture>

        </div>
      
        <div class="carousel-item " style="object-fit: contain">
          <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3312-400-bcdbc5f08.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-600-bcdbc5f08.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-800-bcdbc5f08.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-1000-bcdbc5f08.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-1500-bcdbc5f08.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-2000-bcdbc5f08.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3312-400-bcdbc5f08.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-600-bcdbc5f08.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-800-bcdbc5f08.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-1000-bcdbc5f08.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-1500-bcdbc5f08.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3312-2000-bcdbc5f08.jpeg 2000w" type="image/jpeg" /><img alt="IMG_3312" src="/generated/_posts/../assets/images/laptop-mount/IMG_3312-800-bcdbc5f08.jpg" width="4032" height="3024" /></picture>

        </div>
      
        <div class="carousel-item " style="object-fit: contain">
          <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3331-400-801364899.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-600-801364899.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-800-801364899.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-1000-801364899.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-1500-801364899.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-2000-801364899.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3331-400-801364899.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-600-801364899.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-800-801364899.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-1000-801364899.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-1500-801364899.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3331-2000-801364899.jpeg 2000w" type="image/jpeg" /><img alt="IMG_3331" src="/generated/_posts/../assets/images/laptop-mount/IMG_3331-800-801364899.jpg" width="3024" height="3024" /></picture>

        </div>
      
        <div class="carousel-item " style="object-fit: contain">
          <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_0116-400-20f3a1ee0.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-600-20f3a1ee0.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-800-20f3a1ee0.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-1000-20f3a1ee0.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-1500-20f3a1ee0.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-2000-20f3a1ee0.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_0116-400-20f3a1ee0.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-600-20f3a1ee0.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-800-20f3a1ee0.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-1000-20f3a1ee0.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-1500-20f3a1ee0.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_0116-2000-20f3a1ee0.jpeg 2000w" type="image/jpeg" /><img alt="IMG_0116.HEIC" src="/generated/_posts/../assets/images/laptop-mount/IMG_0116-800-20f3a1ee0.jpg" width="4032" height="3024" /></picture>

        </div>
      
    </div>
    <button class="carousel-control-prev btn-danger" type="button" data-bs-target="#mount-carousel" data-bs-slide="prev">
      <span class="carousel-control-prev-icon" aria-hidden="true"></span>
      <span class="visually-hidden">Previous</span>
    </button>
    <button class="carousel-control-next" type="button" data-bs-target="#mount-carousel" data-bs-slide="next">
      <span class="carousel-control-next-icon" aria-hidden="true"></span>
      <span class="visually-hidden">Next</span>
    </button>
  </div>
</div>

<style>
  .carousel-item {
    aspect-ratio: 1/1;
  }
  .carousel-item picture img {
    position: absolute;
    min-height: 100%;
    min-width: 100%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
</style>

<p>I operate my laptop with its lid closed, using only an external monitor. The downside is that the closed laptop is a useless rectangle that takes up a lot of precious desk space. This type of product would have solved 80% of the problem:</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-400-58b35e685.webp 400w, /generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-600-58b35e685.webp 600w, /generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-800-58b35e685.webp 800w, /generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-1000-58b35e685.webp 1000w, /generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-1500-58b35e685.webp 1500w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-400-58b35e685.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-600-58b35e685.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-800-58b35e685.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-1000-58b35e685.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-1500-58b35e685.jpeg 1500w" type="image/jpeg" /><img alt="best-vertical-laptop-stand-macbook.jpg" src="/generated/_posts/../assets/images/laptop-mount/best-vertical-laptop-stand-macbook-800-58b35e685.jpg" width="1500" height="1000" /></picture>

<p>However, even <em>more</em> space could be saved by removing the laptop from the desk entirely. A pole or stand of some sort is already needed anyway to hold up the monitor, so why not use it to hold the laptop as well?</p>

<p>My solution consists of two repurposed commercially available products, along with a piece of 6mm birch plywood to hold them together.</p>

<p>Attached to the monitor pole, we have a VESA mount that can tilt and swivel. Instead of holding a monitor, it’s holding the wooden plank.</p>

<p class="small-img"><a href="https://www.google.com/search?q=AV+Link+PMB100+35mm+Pole+Mount+Bracket+For+TV+%26+Monitor+Screens,+Black"><picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/vesa-400-d1fa7988d.webp 400w, /generated/_posts/../assets/images/laptop-mount/vesa-600-d1fa7988d.webp 600w, /generated/_posts/../assets/images/laptop-mount/vesa-679-d1fa7988d.webp 679w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/vesa-400-d1fa7988d.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/vesa-600-d1fa7988d.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/vesa-679-d1fa7988d.jpeg 679w" type="image/jpeg" /><img alt="vesa" src="/generated/_posts/../assets/images/laptop-mount/vesa-679-d1fa7988d.jpg" width="679" height="642" /></picture>
</a></p>

<p>On the other side of the plank, we have 4 pieces of metal sold as an under-desk laptop mount:</p>

<p class="small-img"><a href="https://www.google.com/search?q=JEMACHE+Under+Desk+Laptop+Mount,+Metal+Under+Table+Desk+Holder+for+Laptop,+Mac+Mini,+MacBook,+Keyboard+with+Anti-Scratch+Silicone+(Black)"><picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/under-desk-400-1f2c0a253.webp 400w, /generated/_posts/../assets/images/laptop-mount/under-desk-600-1f2c0a253.webp 600w, /generated/_posts/../assets/images/laptop-mount/under-desk-679-1f2c0a253.webp 679w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/under-desk-400-1f2c0a253.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/under-desk-600-1f2c0a253.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/under-desk-679-1f2c0a253.jpeg 679w" type="image/jpeg" /><img alt="under-desk" src="/generated/_posts/../assets/images/laptop-mount/under-desk-679-1f2c0a253.jpg" width="679" height="574" /></picture>
</a></p>

<h1 id="details">Details</h1>

<p>To keep the setup compact, we want the pole-to-VESA piece to be as short as possible. There are zillions of pole-mounted VESA monitor arms to choose from, but finding something <em>without</em> the arm was a bit more difficult.</p>

<p>All inputs were sourced from the internet:</p>

<ul>
  <li>I ordered the wood cut to measure from <code class="language-plaintext highlighter-rouge">woodsheets.com</code> , which cost £8.60 including shipping.</li>
  <li>The pole mount was <a href="https://www.google.com/search?q=AV+Link+PMB100+35mm+Pole+Mount+Bracket+For+TV+%26+Monitor+Screens,+Black">£13.77 from Amazon</a></li>
  <li>The under-desk mounting solution was <a href="https://www.google.com/search?q=JEMACHE+Under+Desk+Laptop+Mount,+Metal+Under+Table+Desk+Holder+for+Laptop,+Mac+Mini,+MacBook,+Keyboard+with+Anti-Scratch+Silicone+(Black)">£16.99 from Amazon</a></li>
</ul>

<p>I used linseed oil to give the wood a nicer finish; this is of course optional but the aesthetic improvement is significant.</p>

<div class="display-flex">

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/varnish-before-400-f8948a73c.webp 400w, /generated/_posts/../assets/images/laptop-mount/varnish-before-600-f8948a73c.webp 600w, /generated/_posts/../assets/images/laptop-mount/varnish-before-800-f8948a73c.webp 800w, /generated/_posts/../assets/images/laptop-mount/varnish-before-1000-f8948a73c.webp 1000w, /generated/_posts/../assets/images/laptop-mount/varnish-before-1500-f8948a73c.webp 1500w, /generated/_posts/../assets/images/laptop-mount/varnish-before-2000-f8948a73c.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/varnish-before-400-f8948a73c.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/varnish-before-600-f8948a73c.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/varnish-before-800-f8948a73c.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/varnish-before-1000-f8948a73c.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/varnish-before-1500-f8948a73c.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/varnish-before-2000-f8948a73c.jpeg 2000w" type="image/jpeg" /><img alt="varnish-before.JPG" src="/generated/_posts/../assets/images/laptop-mount/varnish-before-800-f8948a73c.jpg" width="3024" height="3024" /></picture>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/varnish-after-400-801364899.webp 400w, /generated/_posts/../assets/images/laptop-mount/varnish-after-600-801364899.webp 600w, /generated/_posts/../assets/images/laptop-mount/varnish-after-800-801364899.webp 800w, /generated/_posts/../assets/images/laptop-mount/varnish-after-1000-801364899.webp 1000w, /generated/_posts/../assets/images/laptop-mount/varnish-after-1500-801364899.webp 1500w, /generated/_posts/../assets/images/laptop-mount/varnish-after-2000-801364899.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/varnish-after-400-801364899.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/varnish-after-600-801364899.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/varnish-after-800-801364899.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/varnish-after-1000-801364899.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/varnish-after-1500-801364899.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/varnish-after-2000-801364899.jpeg 2000w" type="image/jpeg" /><img alt="varnish-after.JPG" src="/generated/_posts/../assets/images/laptop-mount/varnish-after-800-801364899.jpg" width="3024" height="3024" /></picture>

</div>

<p>The “under-desk” bits come with little silicon-ish pads to avoid scratching the laptop. Similarly, I put plastic caps on the screw heads on the laptop side:</p>

<div class="display-flex">

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3120-400-037dc0f4d.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-600-037dc0f4d.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-800-037dc0f4d.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-1000-037dc0f4d.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-1500-037dc0f4d.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-2000-037dc0f4d.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3120-400-037dc0f4d.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-600-037dc0f4d.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-800-037dc0f4d.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-1000-037dc0f4d.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-1500-037dc0f4d.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3120-2000-037dc0f4d.jpeg 2000w" type="image/jpeg" /><img alt="IMG_3120" src="/generated/_posts/../assets/images/laptop-mount/IMG_3120-800-037dc0f4d.jpg" width="3024" height="3024" /></picture>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3119-400-437561f48.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-600-437561f48.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-800-437561f48.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-1000-437561f48.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-1500-437561f48.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-2000-437561f48.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3119-400-437561f48.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-600-437561f48.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-800-437561f48.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-1000-437561f48.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-1500-437561f48.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3119-2000-437561f48.jpeg 2000w" type="image/jpeg" /><img alt="IMG_3119" src="/generated/_posts/../assets/images/laptop-mount/IMG_3119-800-437561f48.jpg" width="3024" height="3024" /></picture>

</div>

<p>Had I realised these would be needed, I would probably have chosen to use glue instead of screws to attach the wood to the VESA mount.</p>

<p>After completing this project, I also mounted a 3.5 inch external hard drive enclosure in a similar way. I glued it directly to the VESA mount. Arbitrary objects could be thus held aloft. The scope of this innovation has no limits currently known to science.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3329-400-a445189b1.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-600-a445189b1.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-800-a445189b1.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-1000-a445189b1.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-1500-a445189b1.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-2000-a445189b1.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3329-400-a445189b1.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-600-a445189b1.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-800-a445189b1.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-1000-a445189b1.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-1500-a445189b1.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3329-2000-a445189b1.jpeg 2000w" type="image/jpeg" /><img alt="IMG_3329" src="/generated/_posts/../assets/images/laptop-mount/IMG_3329-800-a445189b1.jpg" width="4032" height="3024" /></picture>

<p>As I have two poles, I put the hard drive on the other pole, but it would have comfortably fit on the first pole.</p>

<h1 id="previous-versions-of-this-idea">Previous versions of this idea</h1>

<p>For my previous attempt, I hand-sawed a piece of scrap wood from a previous project. This looked tolerable, but for £8.60 it was worth having another piece cut to size:</p>

<picture class="small-img"><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3118-400-8a8d94b21.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-600-8a8d94b21.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-800-8a8d94b21.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-1000-8a8d94b21.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-1500-8a8d94b21.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-2000-8a8d94b21.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_3118-400-8a8d94b21.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-600-8a8d94b21.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-800-8a8d94b21.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-1000-8a8d94b21.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-1500-8a8d94b21.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_3118-2000-8a8d94b21.jpeg 2000w" type="image/jpeg" /><img alt="IMG_3118" src="/generated/_posts/../assets/images/laptop-mount/IMG_3118-800-8a8d94b21.jpg" width="4032" height="3024" /></picture>

<p>My initial idea was to use a VESA mount and a cheap laptop sleeve. I used this for several months:</p>

<div class="bootstrap-styles bootstrap-reboot">
  <div id="sleeve-carousel" class="carousel carousel-dark slide">
    <div class="carousel-indicators">
      
        <button type="button" data-bs-target="#sleeve-carousel" data-bs-slide-to="0" class=" active"></button>
      
        <button type="button" data-bs-target="#sleeve-carousel" data-bs-slide-to="1" class=""></button>
      
        <button type="button" data-bs-target="#sleeve-carousel" data-bs-slide-to="2" class=""></button>
      
    </div>
    <div class="carousel-inner">
      
        <div class="carousel-item  active" style="object-fit: contain">
          <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_1589-400-e3b294717.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-600-e3b294717.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-800-e3b294717.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-1000-e3b294717.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-1500-e3b294717.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-2000-e3b294717.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_1589-400-e3b294717.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-600-e3b294717.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-800-e3b294717.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-1000-e3b294717.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-1500-e3b294717.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_1589-2000-e3b294717.jpeg 2000w" type="image/jpeg" /><img alt="IMG_1589.JPG" src="/generated/_posts/../assets/images/laptop-mount/IMG_1589-800-e3b294717.jpg" width="4032" height="3024" /></picture>

        </div>
      
        <div class="carousel-item " style="object-fit: contain">
          <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_1590-400-fd01ccfcc.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-600-fd01ccfcc.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-800-fd01ccfcc.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-1000-fd01ccfcc.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-1500-fd01ccfcc.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-2000-fd01ccfcc.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_1590-400-fd01ccfcc.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-600-fd01ccfcc.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-800-fd01ccfcc.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-1000-fd01ccfcc.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-1500-fd01ccfcc.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_1590-2000-fd01ccfcc.jpeg 2000w" type="image/jpeg" /><img alt="IMG_1590" src="/generated/_posts/../assets/images/laptop-mount/IMG_1590-800-fd01ccfcc.jpg" width="4032" height="3024" /></picture>

        </div>
      
        <div class="carousel-item " style="object-fit: contain">
          <picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_1862-400-d4faf383e.webp 400w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-600-d4faf383e.webp 600w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-800-d4faf383e.webp 800w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-1000-d4faf383e.webp 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-1500-d4faf383e.webp 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-2000-d4faf383e.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/laptop-mount/IMG_1862-400-d4faf383e.jpeg 400w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-600-d4faf383e.jpeg 600w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-800-d4faf383e.jpeg 800w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-1000-d4faf383e.jpeg 1000w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-1500-d4faf383e.jpeg 1500w, /generated/_posts/../assets/images/laptop-mount/IMG_1862-2000-d4faf383e.jpeg 2000w" type="image/jpeg" /><img alt="IMG_1862" src="/generated/_posts/../assets/images/laptop-mount/IMG_1862-800-d4faf383e.jpg" width="4032" height="3024" /></picture>

        </div>
      
    </div>
    <button class="carousel-control-prev btn-danger" type="button" data-bs-target="#sleeve-carousel" data-bs-slide="prev">
      <span class="carousel-control-prev-icon" aria-hidden="true"></span>
      <span class="visually-hidden">Previous</span>
    </button>
    <button class="carousel-control-next" type="button" data-bs-target="#sleeve-carousel" data-bs-slide="next">
      <span class="carousel-control-next-icon" aria-hidden="true"></span>
      <span class="visually-hidden">Next</span>
    </button>
  </div>
</div>

<style>
  .carousel-item {
    aspect-ratio: 1/1;
  }
  .carousel-item picture img {
    position: absolute;
    min-height: 100%;
    min-width: 100%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
</style>

<p>However, inserting and removing the laptop was rather inconvenient because the sleeve lacks rigidity. With the wood-based solution, it’s a simple one-handed process. The sleeve also has worse heat dissipation, despite the addition of aeration holes.</p>]]></content><author><name></name></author><category term="DIY" /><category term="how to" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/laptop-mount/meta-tag.JPG" /><media:content medium="image" url="https://bayes.net/assets/images/laptop-mount/meta-tag.JPG" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">How to run Cronicle (a cron replacement) in a Docker container</title><link href="https://bayes.net/cronicle/" rel="alternate" type="text/html" title="How to run Cronicle (a cron replacement) in a Docker container" /><published>2022-05-07T00:00:00+00:00</published><updated>2022-05-07T00:00:00+00:00</updated><id>https://bayes.net/cronicle</id><content type="html" xml:base="https://bayes.net/cronicle/"><![CDATA[<p>I really don’t like cron jobs and crontab:</p>
<ul>
  <li>crontab has a horrible syntax (it’s <a href="https://en.wikipedia.org/wiki/Cron">from 1975</a>…)</li>
  <li>logging the output of jobs needs to be specified manually</li>
  <li>viewing logs is inconvenient (even just for checking whether a job ran or not!)</li>
  <li>cron jobs run in a minimal environment that’s inconvenient to modify</li>
</ul>

<p><a href="https://github.com/jhuckaby/Cronicle">Cronicle</a> is a friendlier alternative (“a task scheduler with a web based front-end UI”).</p>

<p><strong>Very important</strong>: the default username/password for the web interface is <code class="language-plaintext highlighter-rouge">admin</code>/<code class="language-plaintext highlighter-rouge">admin</code>. This could let anyone run arbitrary shell commands on your server! Change the password immediately after setting up.</p>

<p>Here’s how to run Cronicle Dockerized.</p>

<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker run <span class="nt">-d</span> <span class="se">\</span>
  <span class="nt">-v</span> /cronicle-data/data:/opt/cronicle/data:rw <span class="se">\</span>
  <span class="nt">-v</span> /cronicle-data/logs:/opt/cronicle/logs:rw <span class="se">\</span>
  <span class="nt">-v</span> /cronicle-data/plugins:/opt/cronicle/plugins:rw <span class="se">\</span>
  <span class="nt">-v</span> /cronicle-data/app:/app:rw <span class="se">\</span>
  <span class="nt">--hostname</span> your_hostname.com <span class="nt">-p</span> 11531:3012 <span class="se">\</span>
  <span class="nt">-e</span> <span class="nv">CRONICLE_base_app_url</span><span class="o">=</span><span class="s1">'http://your_hostname.com:11531'</span> <span class="se">\</span>
  <span class="nt">--name</span> cronicle <span class="se">\</span>
  bluet/cronicle-docker:latest
</code></pre></div></div>

<p>You can now point <code class="language-plaintext highlighter-rouge">http://your_hostname.com</code> to the correct IP address and visit <code class="language-plaintext highlighter-rouge">http://your_hostname.com:11531</code> in your browser to access a web interface for Cronicle.</p>

<p>Comments:</p>
<ul>
  <li>11531 is a port number chosen randomly. You should generally use 80, the default port used by web browsers; for me that port is occupied by other applications I run on the host web server.</li>
  <li>The source for the Docker image <code class="language-plaintext highlighter-rouge">bluet/cronicle-docker</code> is <a href="https://github.com/bluet/docker-cronicle-docker">here</a>.</li>
  <li>On 7 May 2022, I confirmed that these steps work on brand new server, with revision <a href="https://github.com/bluet/docker-cronicle-docker/tree/3e4211e8902bcd17c6192f6ed1f2a8f3cf0e24ba"><code class="language-plaintext highlighter-rouge">3e4211e</code></a> of <code class="language-plaintext highlighter-rouge">bluet/cronicle-docker</code>.</li>
</ul>]]></content><author><name></name></author><category term="software" /><category term="docker" /><category term="how to" /><summary type="html"><![CDATA[I really don’t like cron jobs and crontab: crontab has a horrible syntax (it’s from 1975…) logging the output of jobs needs to be specified manually viewing logs is inconvenient (even just for checking whether a job ran or not!) cron jobs run in a minimal environment that’s inconvenient to modify]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/cronicle.png" /><media:content medium="image" url="https://bayes.net/assets/images/cronicle.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">How much of the fall in fertility could be explained by lower mortality?</title><link href="https://bayes.net/fertility-mortality/" rel="alternate" type="text/html" title="How much of the fall in fertility could be explained by lower mortality?" /><published>2021-08-05T00:00:00+00:00</published><updated>2021-08-05T00:00:00+00:00</updated><id>https://bayes.net/fertility-mortality</id><content type="html" xml:base="https://bayes.net/fertility-mortality/"><![CDATA[<p><a href="https://ourworldindata.org/child-mortality#when-more-infants-survive-fertility-goes-down"><picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-400-d852f09da.webp 400w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-600-d852f09da.webp 600w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-800-d852f09da.webp 800w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-1000-d852f09da.webp 1000w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-1500-d852f09da.webp 1500w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-2000-d852f09da.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-400-d852f09da.jpeg 400w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-600-d852f09da.jpeg 600w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-800-d852f09da.jpeg 800w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-1000-d852f09da.jpeg 1000w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-1500-d852f09da.jpeg 1500w, /generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-2000-d852f09da.jpeg 2000w" type="image/jpeg" /><img alt="" src="/generated/_posts/../assets/images/ourworldindata_scatter-fertility-vs-infant-survival-800-d852f09da.png" width="3000" height="2142" /></picture>
</a></p>

<p>Many people think that lower child mortality causes fertility to decline.</p>

<p>One prominent theory for this relationship, as described by <a href="https://ourworldindata.org/child-mortality#when-more-infants-survive-fertility-goes-down">Our World in Data</a><sup id="fnref:quote-context" role="doc-noteref"><a href="#fn:quote-context" class="footnote" rel="footnote">1</a></sup>, is that “infant survival reduces the parents’ demand for children”<sup id="fnref:aside-1" role="doc-noteref"><a href="#fn:aside-1" class="footnote" rel="footnote">2</a></sup>. (Infants are children under 1 years old).</p>

<p>In this article, I want to look at how we can precisify that theory, and what magnitude the effect could possibly take. What fraction of the decline in birth rates could the theory explain?</p>

<p><strong>Important.</strong> I don’t want to make claims here about how parents <em>actually</em> make fertility choices. I only want to examine the implications of various models, and specifically how much of the observed changes in fertility the models could explain.</p>

<h2 id="constant-number-of-children">Constant number of children</h2>
<p>One natural interpretation of “increasing infant survival reduces the parents’ demand for children” is that parents are adjusting the number of births to keep the number of surviving children constant.</p>

<p>Looking at Our World in Data’s graph, we can see that in most of the countries depicted, the infant survival rate went from about 80% to essentially 100%. This is a factor of 1.25. Meanwhile, there were 1/3 as many births. If parents were adjusting the number of births to keep the number of surviving children constant, the decline in infant mortality would explain a change in births by a factor of 1/1.25=0.8, a -0.2 change that is only <strong>30%</strong> of the -2/3 change in births.</p>

<p>The basic mathematical reason this happens is that even when mortality is tragically high, the survival rate is still thankfully much closer to 1 than to 0, so even a very large proportional fall in mortality will only amount to a small proportional increase in survival.</p>

<p>Some children survive infancy but die later in childhood. Although Our World in Data’s quote focuses on infant mortality, it makes sense to consider older children too. I’ll look at under-5 mortality, which generally has better data than older age groups, and also captures a large fraction of all child mortality<sup id="fnref:over-5-data" role="doc-noteref"><a href="#fn:over-5-data" class="footnote" rel="footnote">3</a></sup>.</p>

<h3 id="england-1861-1951">England (1861-1951)</h3>
<p>England is a country with an early demographic transition and good data available.</p>

<p><a href="https://link.springer.com/content/pdf/10.1007/s00148-004-0208-z.pdf">Doepke 2005</a> quotes the following numbers:</p>

<table>
  <thead>
    <tr>
      <th> </th>
      <th>1861</th>
      <th>1951</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Infant mortality</td>
      <td>16%</td>
      <td>3%</td>
    </tr>
    <tr>
      <td>1-5yo mortality</td>
      <td>13%</td>
      <td>0.5%</td>
    </tr>
    <tr>
      <td>0-5 yo mortality</td>
      <td>27%</td>
      <td>3.5%</td>
    </tr>
    <tr>
      <td><strong>Survival to 5 years</strong></td>
      <td><strong>73%</strong></td>
      <td><strong>96.5%</strong></td>
    </tr>
  </tbody>
  <tbody>
    <tr>
      <td>Fertility</td>
      <td>4.9</td>
      <td>2.1</td>
    </tr>
  </tbody>
</table>

<p>Fertility fell by 57%, while survival to 5 years rose by 32%. Hence, if parents aim to keep the number of surviving children constant, the change in child survival can <a href="https://docs.google.com/spreadsheets/d/1vsQLOVcay-nYTfEZFVST4yO3NiETo2EoafF5PybGBd4/edit#gid=0&amp;range=D45">explain <strong>43%</strong></a><sup id="fnref:file" role="doc-noteref"><a href="#fn:file" class="footnote" rel="footnote">4</a></sup> of the actual fall in fertility. (It would have explained only 23% had we erroneously considered only the change in infant survival.)</p>

<h3 id="sub-saharan-africa-1990-2017">Sub-Saharan Africa (1990-2017)</h3>
<p>If we look now at sub-Saharan Africa data from the World Bank, the 1990-2017 change in fertility is from 6.3 to 4.8, a 25% decrease, whereas the 5-year survival rate went from 0.82 to 0.92, a 12% increase. So the fraction of the actual change in fertility that could be explained by the survival rate is <strong>44%</strong>. (This would have been 23% had we looked only at infant survival).</p>

<p><img src="../assets/images/fertility.svg" alt="" />
<em><a href="https://docs.google.com/spreadsheets/d/1vsQLOVcay-nYTfEZFVST4yO3NiETo2EoafF5PybGBd4/edit#gid=0">Source data and calculations</a></em></p>

<p>So far, we have seen that this very simple theory of parental decision-making can explain 30-44% of the decline in fertility, while also noticing that considering childhood mortality beyond infancy was important to giving the theory its full due.</p>

<p>However, in more sophisticated models of fertility choices, the theory looks worse.</p>

<h2 id="a-more-sophisticated-model-of-fertility-decisions">A more sophisticated model of fertility decisions</h2>
<p>Let us imagine that instead of holding it constant, parents treat the number of surviving children as one good among many in an optimization problem.</p>

<p>An increase in the child survival rate can be seen as a decrease in the cost of surviving children. Parents will then substitute away from other goods and increase their target number of surviving children. If your child is less likely to die as an infant, you may decide to aim to have <em>more</em> children: the risk of experiencing the loss of a child is lower.<sup id="fnref:aside-99" role="doc-noteref"><a href="#fn:aside-99" class="footnote" rel="footnote">5</a></sup></p>

<p>For a more formal analysis, we can turn to the <a href="https://www.jstor.org/stable/pdf/1912563.pdf">Barro and Becker (1989)</a> model of fertility. I’ll be giving a simplified version of the presentation in <a href="https://link.springer.com/content/pdf/10.1007/s00148-004-0208-z.pdf">Doepke 2005</a>.</p>

<p>In this model, parents care about their own consumption as well as their number of surviving children. The parents maximise<sup id="fnref:uf" role="doc-noteref"><a href="#fn:uf" class="footnote" rel="footnote">6</a></sup></p>

<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>U</mi><mo stretchy="false">(</mo><mi>c</mi><mo separator="true">,</mo><mi>n</mi><mo stretchy="false">)</mo><mo>=</mo><mi>u</mi><mo stretchy="false">(</mo><mi>c</mi><mo stretchy="false">)</mo><mo>+</mo><msup><mi>n</mi><mi>ϵ</mi></msup><mi>V</mi></mrow><annotation encoding="application/x-tex">U(c,n) = u(c) + n^\epsilon V</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.10903em;">U</span><span class="mopen">(</span><span class="mord mathnormal">c</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">n</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">u</span><span class="mopen">(</span><span class="mord mathnormal">c</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:0.7144em;"></span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7144em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">ϵ</span></span></span></span></span></span></span></span><span class="mord mathnormal" style="margin-right:0.22222em;">V</span></span></span></span></span>

<p>where</p>

<ul>
  <li><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">n</span></span></span></span> is the number of surviving children and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>V</mi></mrow><annotation encoding="application/x-tex">V</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.22222em;">V</span></span></span></span> is the value of a surviving child</li>
  <li><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>ϵ</mi></mrow><annotation encoding="application/x-tex">\epsilon</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">ϵ</span></span></span></span>  is a constant <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>∈</mo><mo stretchy="false">(</mo><mn>0</mn><mo separator="true">,</mo><mn>1</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\in (0,1)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.5782em;vertical-align:-0.0391em;"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">0</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">1</span><span class="mclose">)</span></span></span></span></li>
  <li><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>u</mi><mo stretchy="false">(</mo><mi>c</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">u(c)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">u</span><span class="mopen">(</span><span class="mord mathnormal">c</span><span class="mclose">)</span></span></span></span> is the part of utility that depends on consumption<sup id="fnref:uc" role="doc-noteref"><a href="#fn:uc" class="footnote" rel="footnote">7</a></sup></li>
</ul>

<p>The income of a parent is <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>w</mi></mrow><annotation encoding="application/x-tex">w</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span></span></span></span>, and there is a cost per birth of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi></mrow><annotation encoding="application/x-tex">p</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span></span></span></span> and an additional cost of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>q</mi></mrow><annotation encoding="application/x-tex">q</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span></span> per surviving child<sup id="fnref:aside-2" role="doc-noteref"><a href="#fn:aside-2" class="footnote" rel="footnote">8</a></sup>. The parents choose <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span>, the number of births. <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi></mrow><annotation encoding="application/x-tex">s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span></span></span></span> is the probability of survival of a child, so that <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi><mo>=</mo><mi>s</mi><mi>b</mi></mrow><annotation encoding="application/x-tex">n=sb</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">n</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">b</span></span></span></span>.</p>

<p>Consumption is therefore <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>c</mi><mo>=</mo><mi>w</mi><mo>−</mo><mo stretchy="false">(</mo><mi>p</mi><mo>+</mo><mi>q</mi><mi>s</mi><mo stretchy="false">)</mo><mi>b</mi></mrow><annotation encoding="application/x-tex">c=w-(p+qs)b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">c</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6667em;vertical-align:-0.0833em;"></span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mord mathnormal">s</span><span class="mclose">)</span><span class="mord mathnormal">b</span></span></span></span> and the problem becomes
<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mrow><mi>max</mi><mo>⁡</mo></mrow><mi>b</mi></msub><mi>U</mi><mo>=</mo><mi>u</mi><mo stretchy="false">(</mo><mi>w</mi><mo>−</mo><mo stretchy="false">(</mo><mi>p</mi><mo>+</mo><mi>q</mi><mi>s</mi><mo stretchy="false">)</mo><mi>b</mi><mo stretchy="false">)</mo><mo>+</mo><mo stretchy="false">(</mo><mi>s</mi><mi>b</mi><msup><mo stretchy="false">)</mo><mi>ϵ</mi></msup><mi>V</mi></mrow><annotation encoding="application/x-tex">\max_{b} U = u(w-(p+qs)b) + (sb)^\epsilon V</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8333em;vertical-align:-0.15em;"></span><span class="mop"><span class="mop">max</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361em;"><span style="top:-2.55em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">b</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal" style="margin-right:0.10903em;">U</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">u</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.02691em;">w</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">p</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mord mathnormal">s</span><span class="mclose">)</span><span class="mord mathnormal">b</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">s</span><span class="mord mathnormal">b</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6644em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">ϵ</span></span></span></span></span></span></span></span><span class="mord mathnormal" style="margin-right:0.22222em;">V</span></span></span></span></p>

<p>Letting <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>b</mi><mo lspace="0em" rspace="0em">∗</mo></msup><mo stretchy="false">(</mo><mi>s</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">b^{*}(s)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6887em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">∗</span></span></span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">s</span><span class="mclose">)</span></span></span></span> denote the optimal number of births as a function of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi></mrow><annotation encoding="application/x-tex">s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span></span></span></span>, what are its properties?</p>

<p>The simplest one is that <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><msup><mi>b</mi><mo>∗</mo></msup><mo stretchy="false">(</mo><mi>s</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">sb^*(s)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">s</span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6887em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mbin mtight">∗</span></span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">s</span><span class="mclose">)</span></span></span></span>, the number of <em>surviving</em> children, is increasing in <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi></mrow><annotation encoding="application/x-tex">s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span></span></span></span>. This is the substitution effect we described intuitively earlier in this section. This means that if <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi></mrow><annotation encoding="application/x-tex">s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span></span></span></span> is multiplied by a factor <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>x</mi></mrow><annotation encoding="application/x-tex">x</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">x</span></span></span></span> (say 1.25), <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>b</mi><mo>∗</mo></msup><mo stretchy="false">(</mo><mi>s</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">b^*(s)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6887em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mbin mtight">∗</span></span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">s</span><span class="mclose">)</span></span></span></span> will be multiplied <em>more than</em> <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mi mathvariant="normal">/</mi><mi>x</mi></mrow><annotation encoding="application/x-tex">1/x</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">1/</span><span class="mord mathnormal">x</span></span></span></span> (more than 0.8).</p>

<p>When we looked at the simplest model, with a constant number of children, we guessed that it could explain 30-44% of the fall in fertility. That number is a <strong>strict upper bound</strong> on what the current model could explain.</p>

<p>What we really want to know, to answer the original question, is how <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>b</mi><mo>∗</mo></msup><mo stretchy="false">(</mo><mi>s</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">b^*(s)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6887em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mbin mtight">∗</span></span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">s</span><span class="mclose">)</span></span></span></span> itself depends on <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi></mrow><annotation encoding="application/x-tex">s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span></span></span></span>. To do this, we need to get a little bit more into the relative magnitude of the cost per birth <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi></mrow><annotation encoding="application/x-tex">p</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span></span></span></span> and the additional cost <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>q</mi></mrow><annotation encoding="application/x-tex">q</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span></span> per surviving child. As Doepke writes,</p>

<blockquote>
  <p>If a major fraction of the total cost of children accrues for every birth, fertility [i.e. <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mi>b</mi><mo>∗</mo></msup><mo stretchy="false">(</mo><mi>s</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">b^*(s)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6887em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mbin mtight">∗</span></span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">s</span><span class="mclose">)</span></span></span></span>] would tend to increase with the survival probability; the opposite holds if children are expensive only after surviving infancy<sup id="fnref:aside-3" role="doc-noteref"><a href="#fn:aside-3" class="footnote" rel="footnote">9</a></sup>.</p>
</blockquote>

<p>This tells us that falling mortality could actually cause fertility to <em>increase</em> rather than decrease.<sup id="fnref:p_q" role="doc-noteref"><a href="#fn:p_q" class="footnote" rel="footnote">10</a></sup></p>

<p>To go further, we need to plug in actual values for the model parameters. Doepke does this, using numbers that reflect the child mortality situation of England in 1861 and 1951, but also what seem to be some pretty arbitrary assumptions about the parent’s preferences (the shape of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>u</mi></mrow><annotation encoding="application/x-tex">u</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">u</span></span></span></span> and the value of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>ϵ</mi></mrow><annotation encoding="application/x-tex">\epsilon</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">ϵ</span></span></span></span>).</p>

<p>With these assumptions, he finds that “the total fertility rate falls from 5.0 (the calibrated target) to 4.2 when mortality rates are lowered to the 1951 level”<sup id="fnref:quote-context-2" role="doc-noteref"><a href="#fn:quote-context-2" class="footnote" rel="footnote">11</a></sup>, a 16% decrease. This represents is <strong>28%</strong> of the actually observed fall in fertility to 2.1.</p>

<h3 id="extensions-of-barro-becker-model">Extensions of Barro-Becker model</h3>
<p>The paper then considers various extensions of the basic Barro-Becker model to see if they could explain the large decrease in fertility that we observe.</p>

<p>For example, it has been hypothesized that when there is <em>uncertainty</em> about whether a child will survive (hitherto absent from the models), parents want to avoid the possibility of ending up with zero surviving children. They therefore have many children as a precautionary measure. Declining mortality (which reduces uncertainty since survival rates are thankfully greater than 0.5) would have a strong negative impacts on births.</p>

<p>However, Doepke also considers a third model, that incorporates not only stochastic mortality but also sequential fertility choice, where parents may condition their fertility decisions on the observed survival of children that were born previously. The sequential aspect reduces the uncertainty that parents face over the number of surviving children they will end up with.</p>

<p>The stochastic and sequential models make no clear-cut predictions based on theory alone. Using the England numbers, however, Doepke finds a robust conclusion. In the stochastic+sequential model, for almost all reasonable parameter values, the expected number of surviving children still increases with <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi></mrow><annotation encoding="application/x-tex">s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span></span></span></span> (my emphasis):</p>

<blockquote>
  <p>To illustrate this point, let us consider the extreme case [where] utility from consumption is close to linear, while risk aversion with regards to the number of surviving children is high. … [W]hen we move (with the same parameters) to the more realistic sequential model, where parents can replace children who die early, … despite the high risk aversion with regards to the number of children, total fertility drops only to 4.0, and <strong>net fertility rises</strong> to 3.9, just as with the benchmark parameters. … Thus, in the sequential setup the conclusion that mortality decline raises net fertility is robust to different preference specifications, even if we deliberately emphasize the precautionary motive for hoarding children.</p>
</blockquote>

<p>So even here, the fall in mortality would only explain 35% of the actually observed change in fertility. It seems that the ability to “replace” children who did not survive in the sequential model is enough to make its predictions pretty similar to the simple Barro-Becker model.</p>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:quote-context" role="doc-endnote">
      <p>The quote in context on Our World in Data’s <a href="https://ourworldindata.org/child-mortality#when-more-infants-survive-fertility-goes-down">child mortality page</a>: “the causal link between infant [&lt;1 year old] survival and fertility is established in both directions: Firstly, increasing infant survival reduces the parents’ demand for children. And secondly, a decreasing fertility allows the parents to devote more attention and resources to their children.” <a href="#fnref:quote-context" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:aside-1" role="doc-endnote">
      <p>As an aside, my impression is that if you asked an average educated person “Why do women in developing countries have more children?”, their first idea would be: “because child mortality is higher”. It’s almost a trope, and I feel that it’s often mentioned pretty glibly, without actually thinking about the decisions and trade-offs faced by the people concerned. That’s just an aside though – the theory clearly has prima facie plausibility, and is also cited in serious places like academia and Our World in Data. It deserves closer examination. <a href="#fnref:aside-1" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:over-5-data" role="doc-endnote">
      <p>It should be possible to conduct the Africa analysis for different ages using <a href="http://ghdx.healthdata.org/gbd-results-tool">IMHE</a>’s more granular data, but it’s a bit more work. (There appears to be no direct data on deaths <em>per birth</em> as opposed to per capita, and data on fertility is contained in a different dataset from the main Global Burden of Disease data.) <a href="#fnref:over-5-data" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:file" role="doc-endnote">
      <p>All things decay. Should this Google Sheets spreadsheet become inaccessible, you can download <a href="/assets/files/fertility-mortality.xlsx">this <code class="language-plaintext highlighter-rouge">.xlsx</code> copy</a> which is stored together with this blog. <a href="#fnref:file" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:aside-99" role="doc-endnote">
      <p>In this light, we can see that the constant model is not really compatible with parents viewing additional surviving children as a (normal) good. Nor of course is it compatible with viewing children as a bad, for then parents would choose to have 0 children. Instead, it could for example be used to represent parents aiming for a socially normative number of surviving children. <a href="#fnref:aside-99" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:uf" role="doc-endnote">
      <p>I collapse Doepke’s <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>β</mi></mrow><annotation encoding="application/x-tex">\beta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.05278em;">β</span></span></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>V</mi></mrow><annotation encoding="application/x-tex">V</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.22222em;">V</span></span></span></span> into a single constant <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>V</mi></mrow><annotation encoding="application/x-tex">V</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.22222em;">V</span></span></span></span>, since they can be treated as such in Model A, the only model that I will present mathematically in this post. <a href="#fnref:uf" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:uc" role="doc-endnote">
      <p>Its actual expression, that I omit from the main presentation for simplicity, is <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>u</mi><mo stretchy="false">(</mo><mi>c</mi><mo stretchy="false">)</mo><mo>=</mo><mfrac><msup><mi>c</mi><mrow><mn>1</mn><mo>−</mo><mi>σ</mi></mrow></msup><mrow><mn>1</mn><mo>−</mo><mi>σ</mi></mrow></mfrac></mrow><annotation encoding="application/x-tex">u(c)=\frac{c^{1-\sigma}}{1-\sigma}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">u</span><span class="mopen">(</span><span class="mord mathnormal">c</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.4213em;vertical-align:-0.4033em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0179em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mbin mtight">−</span><span class="mord mathnormal mtight" style="margin-right:0.03588em;">σ</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathnormal mtight">c</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8913em;"><span style="top:-2.931em;margin-right:0.0714em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mbin mtight">−</span><span class="mord mathnormal mtight" style="margin-right:0.03588em;">σ</span></span></span></span></span></span></span></span></span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.4033em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span>, the constant relative risk-aversion utility function. <a href="#fnref:uc" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:aside-2" role="doc-endnote">
      <p>There is nothing in the model that compels us to call <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi></mrow><annotation encoding="application/x-tex">p</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span></span></span></span> the “cost per birth”, this is merely for ease of exposition. The model itself only assumes that there are two periods for each child: in the first period, costing <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi></mrow><annotation encoding="application/x-tex">p</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span></span></span></span> to start, children face a mortality risk; and in the second period, those who survived the first face zero mortality risk and cost <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>q</mi></mrow><annotation encoding="application/x-tex">q</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span></span>. <a href="#fnref:aside-2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:aside-3" role="doc-endnote">
      <p>Once again, Doepke calls the model’s early period “infancy”, but this is not inherent in the model. <a href="#fnref:aside-3" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:p_q" role="doc-endnote">
      <p>It’s difficult to speculate about the relative magnitude of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi></mrow><annotation encoding="application/x-tex">p</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span></span></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>q</mi></mrow><annotation encoding="application/x-tex">q</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span></span></span></span>, especially if, departing from Doepke, we make the early period of the model, say, the first 5 years of life. If the first period is only infancy, it seems plausible to me that <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>q</mi><mo>≫</mo><mi>p</mi></mrow><annotation encoding="application/x-tex">q \gg p</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7335em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">≫</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">p</span></span></span></span>, but then we also fail to capture any deaths after infancy. On the other hand, extending the early period to 5 incorrectly assumes that parents get no utility from children before they reach the age of 5. <a href="#fnref:p_q" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:quote-context-2" role="doc-endnote">

      <p>The following additional context may be helpful to understand this quote:</p>
      <blockquote>
        <p>The survival parameters are chosen to correspond to the situation in England in 1861 . According to Perston et al. (1972) the infant mortality rate (death rate until first birthday) was <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>16</mn><mi mathvariant="normal">%</mi></mrow><annotation encoding="application/x-tex">16 \%</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8056em;vertical-align:-0.0556em;"></span><span class="mord">16%</span></span></span></span>, while the child mortality rate (death rate between first and fifth birthday) was <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>13</mn><mi mathvariant="normal">%</mi></mrow><annotation encoding="application/x-tex">13 \%</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8056em;vertical-align:-0.0556em;"></span><span class="mord">13%</span></span></span></span>. Accordingly, I set <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>s</mi><mi>i</mi></msub><mo>=</mo><mn>0.84</mn></mrow><annotation encoding="application/x-tex">s_{i}=0.84</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.5806em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal">s</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0.84</span></span></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>s</mi><mi>y</mi></msub><mo>=</mo><mn>0.87</mn></mrow><annotation encoding="application/x-tex">s_{y}=0.87</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7167em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord mathnormal">s</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.03588em;">y</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0.87</span></span></span></span> in the sequential model, and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><mo>=</mo><msub><mi>s</mi><mi>i</mi></msub><msub><mi>s</mi><mi>y</mi></msub><mo>=</mo><mn>0.73</mn></mrow><annotation encoding="application/x-tex">s=s_{i} s_{y}=0.73</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7167em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord mathnormal">s</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3117em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mord"><span class="mord mathnormal">s</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.1514em;"><span style="top:-2.55em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.03588em;">y</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">0.73</span></span></span></span> in the other models. Finally, the altruism factor <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>β</mi></mrow><annotation encoding="application/x-tex">\beta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.05278em;">β</span></span></span></span> is set in each model to match the total fertility rate, which was <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>4.9</mn></mrow><annotation encoding="application/x-tex">4.9</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">4.9</span></span></span></span> in 1861 (Chenais 1992). Since fertility choice is discrete in Models B and C, I chose a total fertility rate of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>5.0</mn></mrow><annotation encoding="application/x-tex">5.0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">5.0</span></span></span></span> as the target.</p>

        <p>Each model is thus calibrated to reproduce the relationship of fertility and infant and child mortality in 1861 . I now examine how fertility adjusts when mortality rates fall to the level observed in 1951 , which is <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>3</mn><mi mathvariant="normal">%</mi></mrow><annotation encoding="application/x-tex">3 \%</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8056em;vertical-align:-0.0556em;"></span><span class="mord">3%</span></span></span></span> for infant mortality and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0.5</mn><mi mathvariant="normal">%</mi></mrow><annotation encoding="application/x-tex">0.5 \%</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8056em;vertical-align:-0.0556em;"></span><span class="mord">0.5%</span></span></span></span> for child mortality. The results for fertility can be compared to the observed total fertility rate of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2.1</mn></mrow><annotation encoding="application/x-tex">2.1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">2.1</span></span></span></span> in 1951 .</p>

        <p>In Model A (Barro-Becker with continuous fertility choice), the total fertility rate falls from <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>5.0</mn></mrow><annotation encoding="application/x-tex">5.0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">5.0</span></span></span></span> (the calibrated target) to <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>4.2</mn></mrow><annotation encoding="application/x-tex">4.2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">4.2</span></span></span></span> when mortality rates are lowered to the 1951 level. The expected number of surviving children increases from <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>3.7</mn></mrow><annotation encoding="application/x-tex">3.7</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">3.7</span></span></span></span> to <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>4.0</mn></mrow><annotation encoding="application/x-tex">4.0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">4.0</span></span></span></span>. Thus, there is a small decline in total fertility, but (as was to be expected given Proposition 1) an increase in the net fertility rate.</p>
      </blockquote>
      <p><a href="#fnref:quote-context-2" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><category term="economics" /><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/ourworldindata_scatter-fertility-vs-infant-survival.png" /><media:content medium="image" url="https://bayes.net/assets/images/ourworldindata_scatter-fertility-vs-infant-survival.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">The special case of the normal likelihood function</title><link href="https://bayes.net/bayes-normal-likelihood/" rel="alternate" type="text/html" title="The special case of the normal likelihood function" /><published>2021-07-31T00:00:00+00:00</published><updated>2021-07-31T00:00:00+00:00</updated><id>https://bayes.net/bayes-normal-likelihood</id><content type="html" xml:base="https://bayes.net/bayes-normal-likelihood/"><![CDATA[<p><strong>Summary<sup id="fnref:ack" role="doc-noteref"><a href="#fn:ack" class="footnote" rel="footnote">1</a></sup></strong>: <em>The likelihood function implied by an estimate <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span> with standard deviation <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>σ</mi></mrow><annotation encoding="application/x-tex">\sigma</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">σ</span></span></span></span> is the probability density function (PDF) of a <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi>b</mi><mo separator="true">,</mo><msup><mi>σ</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\mathcal{N}(b,\sigma^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.14736em;">N</span><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">σ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>. Though this might sound intuitive, it’s actually a special case. If we don’t firmly grasp that it’s an exception, it can be confusing.</em></p>

<p>Suppose that a study has the point estimator <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> for the parameter <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi></mrow><annotation encoding="application/x-tex">\Theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span></span></span></span>. The study results are an estimate <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi><mo>=</mo><mi>b</mi></mrow><annotation encoding="application/x-tex">B=b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span> (typically a regression coefficient), and an estimated standard deviation<sup id="fnref:standard-error" role="doc-noteref"><a href="#fn:standard-error" class="footnote" rel="footnote">2</a></sup> <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mover accent="true"><mrow><mi>s</mi><mi>d</mi></mrow><mo>^</mo></mover><mo stretchy="false">(</mo><mi>B</mi><mo stretchy="false">)</mo><mo>=</mo><mi>s</mi></mrow><annotation encoding="application/x-tex">\hat{sd}(B)=s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2079em;vertical-align:-0.25em;"></span><span class="mord accent"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.9579em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">s</span><span class="mord mathnormal">d</span></span></span><span style="top:-3.2634em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.25em;"><span class="mord">^</span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span></span></span></span>.</p>

<p>In order to know how to combine this information with a prior over <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi></mrow><annotation encoding="application/x-tex">\Theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span></span></span></span> in order to update our beliefs, we need to know what is the <em>likelihood function</em> implied by the study. The likelihood function is the probability of observing the study data <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi><mo>=</mo><mi>b</mi></mrow><annotation encoding="application/x-tex">B=b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span> given different values for <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi></mrow><annotation encoding="application/x-tex">\Theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span></span></span></span>. It is formed from the probability of the observation that <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi><mo>=</mo><mi>b</mi></mrow><annotation encoding="application/x-tex">B=b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span> conditional on <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi><mo>=</mo><mi>θ</mi></mrow><annotation encoding="application/x-tex">\Theta=\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span>, but viewed and used as a function of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> only<sup id="fnref:notation" role="doc-noteref"><a href="#fn:notation" class="footnote" rel="footnote">3</a></sup>:</p>

<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="script">L</mi><mo>:</mo><mi>θ</mi><mo>↦</mo><mi>P</mi><mo stretchy="false">(</mo><mi>B</mi><mo>=</mo><mi>b</mi><mo>∣</mo><mi mathvariant="normal">Θ</mi><mo>=</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\mathcal{L}: \theta \mapsto P(B =b \mid \Theta = \theta)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7054em;vertical-align:-0.011em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∣</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span></span></span></span></span>

<p>The event “<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi><mo>=</mo><mi>b</mi></mrow><annotation encoding="application/x-tex">B=b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span>” is often shortened to just “<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span>” when the meaning is clear from context, so that the function can be more briefly written <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">L</mi><mo>:</mo><mi>θ</mi><mo>↦</mo><mi>P</mi><mo stretchy="false">(</mo><mi>b</mi><mo>∣</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\mathcal{L}: \theta \mapsto P(b \mid \theta)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7054em;vertical-align:-0.011em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∣</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span></span></span></span>.</p>

<p><strong>So, what is <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">L</mi></mrow><annotation encoding="application/x-tex">\mathcal{L}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span></span></span></span>?</strong> In a typical regression context, <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> is assumed to be approximately normally distributed around <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi></mrow><annotation encoding="application/x-tex">\Theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span></span></span></span>, due to the central limit theorem. More precisely, <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mrow><mi>B</mi><mo>−</mo><mi mathvariant="normal">Θ</mi></mrow><mrow><mi>s</mi><mi>d</mi><mo stretchy="false">(</mo><mi>B</mi><mo stretchy="false">)</mo></mrow></mfrac><mo>∼</mo><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mn>0</mn><mo separator="true">,</mo><mn>1</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\frac{B - \Theta}{sd(B)} \sim \mathcal{N}(0,1)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.3923em;vertical-align:-0.52em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8723em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">s</span><span class="mord mathnormal mtight">d</span><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.05017em;">B</span><span class="mclose mtight">)</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.05017em;">B</span><span class="mbin mtight">−</span><span class="mord mtight">Θ</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.52em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∼</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.14736em;">N</span><span class="mopen">(</span><span class="mord">0</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">1</span><span class="mclose">)</span></span></span></span>, and equivalently <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi><mo>∼</mo><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi mathvariant="normal">Θ</mi><mo separator="true">,</mo><mi>s</mi><mi>d</mi><mo stretchy="false">(</mo><mi>B</mi><msup><mo stretchy="false">)</mo><mn>2</mn></msup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">B\sim \mathcal{N}(\Theta,sd(B)^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∼</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.14736em;">N</span><span class="mopen">(</span><span class="mord">Θ</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">d</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>.</p>

<p><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><mi>d</mi><mo stretchy="false">(</mo><mi>B</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">sd(B)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">d</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mclose">)</span></span></span></span> is seldom known, and is often replaced with its estimate <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi></mrow><annotation encoding="application/x-tex">s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span></span></span></span>, allowing us to write <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi><mo>∼</mo><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi mathvariant="normal">Θ</mi><mo separator="true">,</mo><msup><mi>s</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">B\sim \mathcal{N}(\Theta,s^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∼</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.14736em;">N</span><span class="mopen">(</span><span class="mord">Θ</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">s</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>, where only the parameter <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi></mrow><annotation encoding="application/x-tex">\Theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span></span></span></span> is unknown<sup id="fnref:unknown-variance" role="doc-noteref"><a href="#fn:unknown-variance" class="footnote" rel="footnote">4</a></sup>.</p>

<p>We can plug this into the definition of the likelihood function:</p>

<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="script">L</mi><mo>:</mo><mi>θ</mi><mo>↦</mo><mi>P</mi><mo stretchy="false">(</mo><mi>b</mi><mo>∣</mo><mi>θ</mi><mo stretchy="false">)</mo><mo>=</mo><msub><mtext>PDF</mtext><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi>θ</mi><mo separator="true">,</mo><msup><mi>s</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow></msub><mo stretchy="false">(</mo><mi>b</mi><mo stretchy="false">)</mo><mo>=</mo><mfrac><mn>1</mn><mrow><mi>s</mi><msqrt><mrow><mn>2</mn><mi>π</mi></mrow></msqrt></mrow></mfrac><mi>exp</mi><mo>⁡</mo><mrow><mo fence="true">(</mo><mo>−</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><msup><mrow><mo fence="true">(</mo><mfrac><mrow><mi>b</mi><mo>−</mo><mi>θ</mi></mrow><mi>s</mi></mfrac><mo fence="true">)</mo></mrow><mn>2</mn></msup><mo fence="true">)</mo></mrow></mrow><annotation encoding="application/x-tex">\mathcal{L}: \theta \mapsto P(b\mid \theta)= \text{PDF}_{\mathcal{N}(\theta,s^2)}(b) = {\frac {1}{s\sqrt {2\pi }}}\exp \left(-{\frac {1}{2}}\left({\frac {b-\theta
    }{s
    }}\right)^{2} \right)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7054em;vertical-align:-0.011em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∣</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1052em;vertical-align:-0.3552em;"></span><span class="mord"><span class="mord text"><span class="mord">PDF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3448em;"><span style="top:-2.5198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathcal mtight" style="margin-right:0.14736em;">N</span><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.02778em;">θ</span><span class="mpunct mtight">,</span><span class="mord mtight"><span class="mord mathnormal mtight">s</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463em;"><span style="top:-2.786em;margin-right:0.0714em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.3552em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:3em;vertical-align:-1.25em;"></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3214em;"><span style="top:-2.2028em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">s</span><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9072em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord">2</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span></span></span><span style="top:-2.8672em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg xmlns="http://www.w3.org/2000/svg" width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l0 -0
c5.3,-9.3,12,-14,20,-14
H400000v40H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.1328em;"><span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.93em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">exp</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size4">(</span></span><span class="mord">−</span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3214em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">2</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner"><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size3">(</span></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3714em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">s</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size3">)</span></span></span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:1.654em;"><span style="top:-3.9029em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size4">)</span></span></span></span></span></span></span>

<p>We could just leave it at that. <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">L</mi></mrow><annotation encoding="application/x-tex">\mathcal{L}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span></span></span></span> is the function<sup id="fnref:distribution-function" role="doc-noteref"><a href="#fn:distribution-function" class="footnote" rel="footnote">5</a></sup> above, and that’s all we need to compute the posterior. But a slightly different expression for <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">L</mi></mrow><annotation encoding="application/x-tex">\mathcal{L}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span></span></span></span>  is possible. After factoring out the square,</p>

<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="script">L</mi><mo>:</mo><mi>θ</mi><mo>↦</mo><mfrac><mn>1</mn><mrow><mi>s</mi><msqrt><mrow><mn>2</mn><mi>π</mi></mrow></msqrt></mrow></mfrac><mi>exp</mi><mo>⁡</mo><mrow><mo fence="true">(</mo><mo>−</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><mfrac><mrow><mo stretchy="false">(</mo><mi>b</mi><mo>−</mo><mi>θ</mi><msup><mo stretchy="false">)</mo><mn>2</mn></msup></mrow><msup><mi>s</mi><mn>2</mn></msup></mfrac><mo fence="true">)</mo></mrow><mo separator="true">,</mo></mrow><annotation encoding="application/x-tex">\mathcal{L}: \theta \mapsto {\frac {1}{s
    {\sqrt {2\pi }}}}\exp \left(-{\frac {1}{2}} {\frac {(b-\theta)^2
    }{s^2
    }} \right),</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7054em;vertical-align:-0.011em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:2.4411em;vertical-align:-0.95em;"></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3214em;"><span style="top:-2.2028em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">s</span><span class="mord"><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9072em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord">2</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span></span></span><span style="top:-2.8672em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg xmlns="http://www.w3.org/2000/svg" width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l0 -0
c5.3,-9.3,12,-14,20,-14
H400000v40H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.1328em;"><span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.93em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">exp</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size3">(</span></span><span class="mord">−</span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3214em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">2</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.4911em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">s</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7401em;"><span style="top:-2.989em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size3">)</span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mpunct">,</span></span></span></span></span>

<p>we make use of the fact that <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi>b</mi><mo>−</mo><mi>θ</mi><msup><mo stretchy="false">)</mo><mn>2</mn></msup><mo>=</mo><mo stretchy="false">(</mo><mi>θ</mi><mo>−</mo><mi>b</mi><msup><mo stretchy="false">)</mo><mn>2</mn></msup></mrow><annotation encoding="application/x-tex">(b-\theta)^2 = (\theta-b)^2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span> to rewrite <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">L</mi></mrow><annotation encoding="application/x-tex">\mathcal{L}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span></span></span></span> with the positions of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span> flipped:</p>

<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="script">L</mi><mo>:</mo><mi>θ</mi><mo>↦</mo><mfrac><mn>1</mn><mrow><mi>s</mi><msqrt><mrow><mn>2</mn><mi>π</mi></mrow></msqrt></mrow></mfrac><mi>exp</mi><mo>⁡</mo><mrow><mo fence="true">(</mo><mo>−</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><msup><mrow><mo fence="true">(</mo><mfrac><mrow><mi>θ</mi><mo>−</mo><mi>b</mi></mrow><mi>s</mi></mfrac><mo fence="true">)</mo></mrow><mn>2</mn></msup><mo fence="true">)</mo></mrow><mi mathvariant="normal">.</mi></mrow><annotation encoding="application/x-tex">\mathcal{L}: \theta \mapsto {\frac {1}{s
    {\sqrt {2\pi }}}}\exp \left(-{\frac {1}{2}}\left({\frac {\theta-b
    }{s
    }}\right)^{2} \right).</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7054em;vertical-align:-0.011em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:3em;vertical-align:-1.25em;"></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3214em;"><span style="top:-2.2028em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">s</span><span class="mord"><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9072em;"><span class="svg-align" style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord" style="padding-left:0.833em;"><span class="mord">2</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span></span></span><span style="top:-2.8672em;"><span class="pstrut" style="height:3em;"></span><span class="hide-tail" style="min-width:0.853em;height:1.08em;"><svg xmlns="http://www.w3.org/2000/svg" width='400em' height='1.08em' viewBox='0 0 400000 1080' preserveAspectRatio='xMinYMin slice'><path d='M95,702
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l0 -0
c5.3,-9.3,12,-14,20,-14
H400000v40H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M834 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.1328em;"><span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.93em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mop">exp</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size4">(</span></span><span class="mord">−</span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3214em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">2</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">1</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="minner"><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size3">(</span></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3714em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">s</span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mord mathnormal">b</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size3">)</span></span></span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:1.654em;"><span style="top:-3.9029em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size4">)</span></span></span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">.</span></span></span></span></span>

<p>We then notice that <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">L</mi></mrow><annotation encoding="application/x-tex">\mathcal{L}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span></span></span></span> is none other than</p>

<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="script">L</mi><mo>:</mo><mi>θ</mi><mo>↦</mo><msub><mtext>PDF</mtext><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi>b</mi><mo separator="true">,</mo><msup><mi>s</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow></msub><mo stretchy="false">(</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\mathcal{L}: \theta \mapsto \text{PDF}_{\mathcal{N}(b,s^2)}(\theta)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7054em;vertical-align:-0.011em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1052em;vertical-align:-0.3552em;"></span><span class="mord"><span class="mord text"><span class="mord">PDF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3448em;"><span style="top:-2.5198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathcal mtight" style="margin-right:0.14736em;">N</span><span class="mopen mtight">(</span><span class="mord mathnormal mtight">b</span><span class="mpunct mtight">,</span><span class="mord mtight"><span class="mord mathnormal mtight">s</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463em;"><span style="top:-2.786em;margin-right:0.0714em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.3552em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span></span></span></span></span>

<p>So, for all <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span> and for all <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span>, <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">L</mi><mo>:</mo><mi>θ</mi><mo>↦</mo><msub><mtext>PDF</mtext><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi>θ</mi><mo separator="true">,</mo><msup><mi>s</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow></msub><mo stretchy="false">(</mo><mi>b</mi><mo stretchy="false">)</mo><mo>=</mo><msub><mtext>PDF</mtext><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi>b</mi><mo separator="true">,</mo><msup><mi>s</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow></msub><mo stretchy="false">(</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\mathcal{L}: \theta \mapsto \text{PDF}_{\mathcal{N}(\theta,s^2)}(b) = \text{PDF}_{\mathcal{N}(b,s^2)}(\theta)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7054em;vertical-align:-0.011em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1052em;vertical-align:-0.3552em;"></span><span class="mord"><span class="mord text"><span class="mord">PDF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3448em;"><span style="top:-2.5198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathcal mtight" style="margin-right:0.14736em;">N</span><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.02778em;">θ</span><span class="mpunct mtight">,</span><span class="mord mtight"><span class="mord mathnormal mtight">s</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463em;"><span style="top:-2.786em;margin-right:0.0714em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.3552em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1052em;vertical-align:-0.3552em;"></span><span class="mord"><span class="mord text"><span class="mord">PDF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3448em;"><span style="top:-2.5198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathcal mtight" style="margin-right:0.14736em;">N</span><span class="mopen mtight">(</span><span class="mord mathnormal mtight">b</span><span class="mpunct mtight">,</span><span class="mord mtight"><span class="mord mathnormal mtight">s</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463em;"><span style="top:-2.786em;margin-right:0.0714em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.3552em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span></span></span></span>.</p>

<p>The key thing to realise is that this is a special case due to the fact that the functional form of the normal PDF is invariant to substituting <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> for each other. For many other distributions of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span>, we cannot apply this procedure.</p>

<p>This special case is worth commenting upon because it has personally lead me astray in the past. I often encountered the case where <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> is normally distributed, and I used the equality above without deriving it and understanding where it comes from. It just had a vaguely intuitive ring to it. I would occasionally slip into thinking it was a more general rule, which always resulted in painful confusion.</p>

<p>To understand the result, let us first illustrate it with a simple numerical example. Suppose we observe an Athenian man <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi><mo>=</mo><mn>200</mn></mrow><annotation encoding="application/x-tex">b=200</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">200</span></span></span></span> cm tall. For all <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span>, the likelihood of this observation if Athenian men’s heights followed an <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi>θ</mi><mo separator="true">,</mo><mn>10</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\mathcal{N}(\theta,10)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.14736em;">N</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">10</span><span class="mclose">)</span></span></span></span> is the same number as the density of observing an Athenian <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> cm tall if Athenian men’s heights followed a <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mn>200</mn><mo separator="true">,</mo><mn>10</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\mathcal{N}(200,10)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.14736em;">N</span><span class="mopen">(</span><span class="mord">200</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">10</span><span class="mclose">)</span></span></span></span><sup id="fnref:neg" role="doc-noteref"><a href="#fn:neg" class="footnote" rel="footnote">6</a></sup>.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/density-likelihood-400-459f91fa1.webp 400w, /generated/_posts/../assets/images/density-likelihood-600-459f91fa1.webp 600w, /generated/_posts/../assets/images/density-likelihood-800-459f91fa1.webp 800w, /generated/_posts/../assets/images/density-likelihood-1000-459f91fa1.webp 1000w, /generated/_posts/../assets/images/density-likelihood-1500-459f91fa1.webp 1500w, /generated/_posts/../assets/images/density-likelihood-1501-459f91fa1.webp 1501w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/density-likelihood-400-459f91fa1.jpeg 400w, /generated/_posts/../assets/images/density-likelihood-600-459f91fa1.jpeg 600w, /generated/_posts/../assets/images/density-likelihood-800-459f91fa1.jpeg 800w, /generated/_posts/../assets/images/density-likelihood-1000-459f91fa1.jpeg 1000w, /generated/_posts/../assets/images/density-likelihood-1500-459f91fa1.jpeg 1500w, /generated/_posts/../assets/images/density-likelihood-1501-459f91fa1.jpeg 1501w" type="image/jpeg" /><img alt="" src="/generated/_posts/../assets/images/density-likelihood-800-459f91fa1.png" width="1501" height="588" /></picture>

<p><em>Graphical representation of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mtext>PDF</mtext><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi>θ</mi><mo separator="true">,</mo><mn>10</mn><mo stretchy="false">)</mo></mrow></msub><mo stretchy="false">(</mo><mn>200</mn><mo stretchy="false">)</mo><mo>=</mo><msub><mtext>PDF</mtext><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mn>200</mn><mo separator="true">,</mo><mn>10</mn><mo stretchy="false">)</mo></mrow></msub><mo stretchy="false">(</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\text{PDF}_{\mathcal{N}(\theta,10)}(200) = \text{PDF}_{\mathcal{N}(200,10)}(\theta)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.1052em;vertical-align:-0.3552em;"></span><span class="mord"><span class="mord text"><span class="mord">PDF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3448em;"><span style="top:-2.5198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathcal mtight" style="margin-right:0.14736em;">N</span><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.02778em;">θ</span><span class="mpunct mtight">,</span><span class="mord mtight">10</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.3552em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord">200</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1052em;vertical-align:-0.3552em;"></span><span class="mord"><span class="mord text"><span class="mord">PDF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3448em;"><span style="top:-2.5198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathcal mtight" style="margin-right:0.14736em;">N</span><span class="mopen mtight">(</span><span class="mord mtight">200</span><span class="mpunct mtight">,</span><span class="mord mtight">10</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.3552em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span></span></span></span></em></p>

<p>When encountering this equivalence, you might, like me, sort of nod along. But puzzlement would be a more appropriate reaction. To compute the likelihood of our 200 cm Athenian under different <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi></mrow><annotation encoding="application/x-tex">\Theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span></span></span></span>-values, we can substitute a <em>totally different question</em>: “assuming that <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi><mo>=</mo><mn>200</mn></mrow><annotation encoding="application/x-tex">\Theta=200</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">200</span></span></span></span>, what is the probability of seeing Athenian men of different sizes?”.</p>

<p>The puzzle is, I think, best resolved by viewing it as a special case, an algebraic curiosity that only applies to some distributions. Don’t even try to build an intuition for it, because it does not generalise.</p>

<p>To help understand this better, let’s look at at a case where the procedure cannot be applied.</p>

<p>Suppose for example that <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> is binomially distributed, representing the number of successes among <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">n</span></span></span></span> independent trials with success probability <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi></mrow><annotation encoding="application/x-tex">\Theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span></span></span></span>. We’ll write <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi><mo>∼</mo><mtext>Bin</mtext><mo stretchy="false">(</mo><mi>n</mi><mo separator="true">,</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">B \sim \text{Bin}(n, \theta)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∼</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord text"><span class="mord">Bin</span></span><span class="mopen">(</span><span class="mord mathnormal">n</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span></span></span></span>.</p>

<p><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span>’s probability mass function is</p>

<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>g</mi><mo>:</mo><mi>k</mi><mo>↦</mo><msub><mtext>PMF</mtext><mrow><mtext>Bin</mtext><mo stretchy="false">(</mo><mi>n</mi><mo separator="true">,</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow></msub><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo><mo>=</mo><mrow><mo fence="true">(</mo><mfrac linethickness="0px"><mi>n</mi><mi>k</mi></mfrac><mo fence="true">)</mo></mrow><msup><mi>ϕ</mi><mi>k</mi></msup><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>ϕ</mi><msup><mo stretchy="false">)</mo><mrow><mi>n</mi><mo>−</mo><mi>k</mi></mrow></msup></mrow><annotation encoding="application/x-tex">g: k \mapsto \text{PMF}_{\text{Bin}(n, \theta)}(k) = {n \choose k} \phi^k (1-\phi)^{n-k}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.7054em;vertical-align:-0.011em;"></span><span class="mord mathnormal" style="margin-right:0.03148em;">k</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1052em;vertical-align:-0.3552em;"></span><span class="mord"><span class="mord text"><span class="mord">PMF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3448em;"><span style="top:-2.5198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">Bin</span></span><span class="mopen mtight">(</span><span class="mord mathnormal mtight">n</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.02778em;">θ</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.3552em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.03148em;">k</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:2.4em;vertical-align:-0.95em;"></span><span class="mord"><span class="mord"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size3">(</span></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.1076em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03148em;">k</span></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">n</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size3">)</span></span></span></span><span class="mord"><span class="mord mathnormal">ϕ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8991em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span></span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.1491em;vertical-align:-0.25em;"></span><span class="mord mathnormal">ϕ</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8991em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">n</span><span class="mbin mtight">−</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span></span></span></span></span></span></span></span></span></span></span></span></span>

<p>Meanwhile, the likelihood function for the observation of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span> successes is</p>

<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="script">M</mi><mo>:</mo><mi>ϕ</mi><mo>↦</mo><msub><mtext>PMF</mtext><mrow><mtext>Bin</mtext><mo stretchy="false">(</mo><mi>n</mi><mo separator="true">,</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow></msub><mo stretchy="false">(</mo><mi>b</mi><mo stretchy="false">)</mo><mo>=</mo><mrow><mo fence="true">(</mo><mfrac linethickness="0px"><mi>n</mi><mi>b</mi></mfrac><mo fence="true">)</mo></mrow><msup><mi>ϕ</mi><mi>b</mi></msup><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><mi>ϕ</mi><msup><mo stretchy="false">)</mo><mrow><mi>n</mi><mo>−</mo><mi>b</mi></mrow></msup></mrow><annotation encoding="application/x-tex">\mathcal{M}: \phi \mapsto \text{PMF}_{\text{Bin}(n, \theta)}(b) = {n \choose b} \phi^b (1-\phi)^{n-b}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">M</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">ϕ</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.1052em;vertical-align:-0.3552em;"></span><span class="mord"><span class="mord text"><span class="mord">PMF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3448em;"><span style="top:-2.5198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord text mtight"><span class="mord mtight">Bin</span></span><span class="mopen mtight">(</span><span class="mord mathnormal mtight">n</span><span class="mpunct mtight">,</span><span class="mord mathnormal mtight" style="margin-right:0.02778em;">θ</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.3552em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:2.4em;vertical-align:-0.95em;"></span><span class="mord"><span class="mord"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size3">(</span></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.1076em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">b</span></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">n</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.686em;"><span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size3">)</span></span></span></span><span class="mord"><span class="mord mathnormal">ϕ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8991em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">b</span></span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.1491em;vertical-align:-0.25em;"></span><span class="mord mathnormal">ϕ</span><span class="mclose"><span class="mclose">)</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8991em;"><span style="top:-3.113em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">n</span><span class="mbin mtight">−</span><span class="mord mathnormal mtight">b</span></span></span></span></span></span></span></span></span></span></span></span></span>

<p>To attempt to take the PMF <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>g</mi></mrow><annotation encoding="application/x-tex">g</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span></span></span></span>, set its parameter <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> equal to <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span>, and obtain the likelihood function would not just give incorrect values, it would be a domain error. Regardless of how we set its parameters, <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>g</mi></mrow><annotation encoding="application/x-tex">g</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span></span></span></span> could never be equal to the likelihood function <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">M</mi></mrow><annotation encoding="application/x-tex">\mathcal{M}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">M</span></span></span></span>, because <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>g</mi></mrow><annotation encoding="application/x-tex">g</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span></span></span></span> is defined on  <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">{</mo><mn>0</mn><mo separator="true">,</mo><mn>1</mn><mo separator="true">,</mo><mi mathvariant="normal">.</mi><mi mathvariant="normal">.</mi><mi mathvariant="normal">.</mi><mo separator="true">,</mo><mi>n</mi><mo stretchy="false">}</mo></mrow><annotation encoding="application/x-tex">\{0,1,...,n\}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">{</span><span class="mord">0</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">...</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">n</span><span class="mclose">}</span></span></span></span>, whereas  <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">M</mi></mrow><annotation encoding="application/x-tex">\mathcal{M}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">M</span></span></span></span> is defined on <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">[</mo><mn>0</mn><mo separator="true">,</mo><mn>1</mn><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">[0,1]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">[</span><span class="mord">0</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">1</span><span class="mclose">]</span></span></span></span>.</p>

<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-400-917a2fcfd.webp 400w, /generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-600-917a2fcfd.webp 600w, /generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-800-917a2fcfd.webp 800w, /generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-1000-917a2fcfd.webp 1000w, /generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-1201-917a2fcfd.webp 1201w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-400-917a2fcfd.jpeg 400w, /generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-600-917a2fcfd.jpeg 600w, /generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-800-917a2fcfd.jpeg 800w, /generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-1000-917a2fcfd.jpeg 1000w, /generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-1201-917a2fcfd.jpeg 1201w" type="image/jpeg" /><img alt="img" src="/generated/_posts/../assets/images/LikelihoodFunctionAfterHHT-800-917a2fcfd.png" width="1201" height="900" /></picture>

<p><em>The likelihood function <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">Q</mi><mo>:</mo><msub><mi>P</mi><mi>H</mi></msub><mo>↦</mo><msubsup><mi>P</mi><mi>H</mi><mn>2</mn></msubsup><mo stretchy="false">(</mo><mn>1</mn><mo>−</mo><msub><mi>P</mi><mi>H</mi></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\mathcal{Q}: P_H \mapsto P_H^2(1-P_H)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7805em;vertical-align:-0.0972em;"></span><span class="mord mathcal">Q</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.8333em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3283em;"><span style="top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.08125em;">H</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">↦</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0894em;vertical-align:-0.2753em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-2.4247em;margin-left:-0.1389em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.08125em;">H</span></span></span><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2753em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord">1</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3283em;"><span style="top:-2.55em;margin-left:-0.1389em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight" style="margin-right:0.08125em;">H</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span> for the binomial probability of a biased coin landing heads-up, given that we have observed <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">{</mo><mi>H</mi><mi>e</mi><mi>a</mi><mi>d</mi><mi>s</mi><mo separator="true">,</mo><mi>H</mi><mi>e</mi><mi>a</mi><mi>d</mi><mi>s</mi><mo separator="true">,</mo><mi>T</mi><mi>a</mi><mi>i</mi><mi>l</mi><mi>s</mi><mo stretchy="false">}</mo></mrow><annotation encoding="application/x-tex">\{Heads, Heads, Tails\}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">{</span><span class="mord mathnormal">He</span><span class="mord mathnormal">a</span><span class="mord mathnormal">d</span><span class="mord mathnormal">s</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">He</span><span class="mord mathnormal">a</span><span class="mord mathnormal">d</span><span class="mord mathnormal">s</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">T</span><span class="mord mathnormal">ai</span><span class="mord mathnormal" style="margin-right:0.01968em;">l</span><span class="mord mathnormal">s</span><span class="mclose">}</span></span></span></span>. It is defined on <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">[</mo><mn>0</mn><mo separator="true">,</mo><mn>1</mn><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">[0,1]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">[</span><span class="mord">0</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord">1</span><span class="mclose">]</span></span></span></span>. (The constant factor <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo fence="true">(</mo><mfrac linethickness="0px"><mn>3</mn><mn>2</mn></mfrac><mo fence="true">)</mo></mrow><annotation encoding="application/x-tex">3 \choose 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2451em;vertical-align:-0.35em;"></span><span class="mord"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size1">(</span></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8951em;"><span style="top:-2.355em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span><span style="top:-3.144em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">3</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose delimcenter" style="top:0em;"><span class="delimsizing size1">)</span></span></span></span></span></span> is omitted, a common practice with likelihood functions, because these constant factors have no meaning and make no difference to the posterior distribution.)</em></p>

<p>It’s hopefully now quite intuitive that the case where <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> is normally distributed was a special case.<sup id="fnref:simple" role="doc-noteref"><a href="#fn:simple" class="footnote" rel="footnote">7</a></sup></p>

<p>Let’s recapitulate.</p>

<p>The likelihood function is the probability of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi><mo>∣</mo><mi>θ</mi></mrow><annotation encoding="application/x-tex">b\mid\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">b</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∣</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> viewed as a function of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> only. It is absolutely not a density of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span>.</p>

<p>In the special case where <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> is normally distributed, we have the confusing ability of being able to express this function as if it were the density of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> under a distribution that depends on <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span>.</p>

<p>I think it’s best to think of that ability as an algebraic coincidence, due to the functional form of the normal PDF. We should think of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">L</mi></mrow><annotation encoding="application/x-tex">\mathcal{L}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathcal">L</span></span></span></span> in the case where <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> is normally distributed as just another likelihood function.</p>

<p>Finally, I’d love to know if there is some way to view this special case as enlightening rather than just a confusing exception.</p>

<p>I believe that to say that a <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mtext>PDF</mtext><mrow><mi>θ</mi><mo separator="true">,</mo><mi mathvariant="normal">Γ</mi></mrow></msub><mo stretchy="false">(</mo><mi>b</mi><mo stretchy="false">)</mo><mo>=</mo><msub><mtext>PDF</mtext><mrow><mi>b</mi><mo separator="true">,</mo><mi mathvariant="normal">Γ</mi></mrow></msub><mo stretchy="false">(</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\text{PDF}_{\theta,\Gamma}(b)=\text{PDF}_{b,\Gamma}(\theta)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.0361em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord text"><span class="mord">PDF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361em;"><span style="top:-2.55em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.02778em;">θ</span><span class="mpunct mtight">,</span><span class="mord mtight">Γ</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">b</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0361em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord text"><span class="mord">PDF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361em;"><span style="top:-2.55em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">b</span><span class="mpunct mtight">,</span><span class="mord mtight">Γ</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span></span></span></span> (where <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mtext>PDF</mtext><mrow><mi>ψ</mi><mo separator="true">,</mo><mi mathvariant="normal">Γ</mi></mrow></msub></mrow><annotation encoding="application/x-tex">\text{PDF}_{\psi,\Gamma}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.9694em;vertical-align:-0.2861em;"></span><span class="mord"><span class="mord text"><span class="mord">PDF</span></span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3361em;"><span style="top:-2.55em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.03588em;">ψ</span><span class="mpunct mtight">,</span><span class="mord mtight">Γ</span></span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:0.2861em;"><span></span></span></span></span></span></span></span></span></span> denotes the PDF of a distribution with one parameter <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>ψ</mi></mrow><annotation encoding="application/x-tex">\psi</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8889em;vertical-align:-0.1944em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">ψ</span></span></span></span> that we wish to single out and a vector <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Γ</mi></mrow><annotation encoding="application/x-tex">\Gamma</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Γ</span></span></span></span> of other parameters), is equivalent to saying that the PDF is <em>symmetric around its singled-out parameter</em>. For example, a <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="script">N</mi><mo stretchy="false">(</mo><mi>μ</mi><mo separator="true">,</mo><msup><mi>σ</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\mathcal{N}(\mu,\sigma^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord mathcal" style="margin-right:0.14736em;">N</span><span class="mopen">(</span><span class="mord mathnormal">μ</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.03588em;">σ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span> is symmetric around its parameter <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>μ</mi></mrow><annotation encoding="application/x-tex">\mu</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.1944em;"></span><span class="mord mathnormal">μ</span></span></span></span>. But this hasn’t seemed insightful to me. Please write to me if you know an answer to this.</p>
<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:ack" role="doc-endnote">
      <p>Thanks to Gavin Leech and Ben West for feedback on a previous versions of this post. <a href="#fnref:ack" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:standard-error" role="doc-endnote">
      <p>I do not use the confusing term ‘standard error’, which I believe should mean <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><mi>d</mi><mo stretchy="false">(</mo><mi>B</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">sd(B)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">d</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mclose">)</span></span></span></span> but is often also used to also denote its estimate <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi></mrow><annotation encoding="application/x-tex">s</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.4306em;"></span><span class="mord mathnormal">s</span></span></span></span>. <a href="#fnref:standard-error" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:notation" role="doc-endnote">
      <p>I use uppercase letters <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi></mrow><annotation encoding="application/x-tex">\Theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span></span></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> to denote random variables, and lower case <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>b</mi></mrow><annotation encoding="application/x-tex">b</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal">b</span></span></span></span> for particular values (realizations) these random variables could take. <a href="#fnref:notation" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:unknown-variance" role="doc-endnote">
      <p>A more sophisticated approach would be to let <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><mi>d</mi><mo stretchy="false">(</mo><mi>B</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">sd(B)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">d</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mclose">)</span></span></span></span> be another unknown parameter over which we form a prior; we would then update our beliefs jointly about <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Θ</mi></mrow><annotation encoding="application/x-tex">\Theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord">Θ</span></span></span></span> and <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>s</mi><mi>d</mi><mo stretchy="false">(</mo><mi>B</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">sd(B)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal">s</span><span class="mord mathnormal">d</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mclose">)</span></span></span></span>. See for example <a href="https://sci-hub.se/10.1002/9781118593165.ch17">Bolstad &amp; Curran (2016), Chapter 17, “Bayesian Inference for Normal with Unknown Mean and Variance”</a>. <a href="#fnref:unknown-variance" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:distribution-function" role="doc-endnote">
      <p>I don’t like the term “<a href="https://www.google.com/search?q=%22likelihood+distribution%22">likelihood distribution</a>”, I prefer “likelihood function”. In formal parlance, mathematical <a href="https://en.wikipedia.org/wiki/Distribution_(mathematics)">distributions</a> are a generalization of functions, so it’s arguably technically correct to call any likelihood function a likelihood distribution. But in many contexts, “distribution” is merely used as short for “probability distribution”. So “likelihood distribution” runs the risk of making us think of “likelihood <em>probability</em> distribution” – but the likelihood function is not generally a probability distribution. <a href="#fnref:distribution-function" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:neg" role="doc-endnote">
      <p>We are here ignoring any inadequacies of the <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi><mo>∼</mo><mi>N</mi><mo stretchy="false">(</mo><mi mathvariant="normal">Θ</mi><mo separator="true">,</mo><msup><mi>s</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">B\sim N(\Theta,s^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∼</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1.0641em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.10903em;">N</span><span class="mopen">(</span><span class="mord">Θ</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord"><span class="mord mathnormal">s</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span> assumption, including but not limited to the fact that one cannot observe men with negative heights. <a href="#fnref:neg" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:simple" role="doc-endnote">

      <p>Another simple reminder that the procedure couldn’t possibly work in general is that in general the likelihood function is not even a PDF at all. For example, a broken thermometer that always gives the temperature as 20 degrees has <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>P</mi><mo stretchy="false">(</mo><mi>B</mi><mo>=</mo><mn>20</mn><mo>∣</mo><mi>θ</mi><mo stretchy="false">)</mo><mo>=</mo><mn>1</mn></mrow><annotation encoding="application/x-tex">P(B=20 \mid \theta) = 1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">20</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">∣</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:0.6444em;"></span><span class="mord">1</span></span></span></span> for all <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span>, which evidently does not integrate to 1 over all values of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span>.</p>

      <p>To take a different tack, the fact that the likelihood function is <a href="http://theoryandpractice.org/stats-ds-book/distributions/invariance-of-likelihood-to-reparameterizaton.html#how-does-the-likelihood-transform-to-reparameterization">invariant to reparametrization</a> also illustrates that it is not a probability density of <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>θ</mi></mrow><annotation encoding="application/x-tex">\theta</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">θ</span></span></span></span> (thanks to Gavin Leech for the link). <a href="#fnref:simple" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><category term="probability" /><summary type="html"><![CDATA[Summary1: The likelihood function implied by an estimate bbb with standard deviation σ\sigmaσ is the probability density function (PDF) of a N(b,σ2)\mathcal{N}(b,\sigma^2)N(b,σ2). Though this might sound intuitive, it’s actually a special case. If we don’t firmly grasp that it’s an exception, it can be confusing. Thanks to Gavin Leech and Ben West for feedback on a previous versions of this post. &#8617;]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/density-likelihood.png" /><media:content medium="image" url="https://bayes.net/assets/images/density-likelihood.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">How to circumvent Sci-Hub ISP block</title><link href="https://bayes.net/scihub-proxy/" rel="alternate" type="text/html" title="How to circumvent Sci-Hub ISP block" /><published>2021-05-15T00:00:00+00:00</published><updated>2021-05-15T00:00:00+00:00</updated><id>https://bayes.net/scihub-proxy</id><content type="html" xml:base="https://bayes.net/scihub-proxy/"><![CDATA[<picture><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/sci-hub-proxy-400-8148f0a75.webp 400w, /generated/_posts/../assets/images/sci-hub-proxy-600-8148f0a75.webp 600w, /generated/_posts/../assets/images/sci-hub-proxy-800-8148f0a75.webp 800w, /generated/_posts/../assets/images/sci-hub-proxy-1000-8148f0a75.webp 1000w, /generated/_posts/../assets/images/sci-hub-proxy-1500-8148f0a75.webp 1500w, /generated/_posts/../assets/images/sci-hub-proxy-2000-8148f0a75.webp 2000w" type="image/webp" /><source sizes="min(100vw, 640px)" srcset="/generated/_posts/../assets/images/sci-hub-proxy-400-8148f0a75.jpeg 400w, /generated/_posts/../assets/images/sci-hub-proxy-600-8148f0a75.jpeg 600w, /generated/_posts/../assets/images/sci-hub-proxy-800-8148f0a75.jpeg 800w, /generated/_posts/../assets/images/sci-hub-proxy-1000-8148f0a75.jpeg 1000w, /generated/_posts/../assets/images/sci-hub-proxy-1500-8148f0a75.jpeg 1500w, /generated/_posts/../assets/images/sci-hub-proxy-2000-8148f0a75.jpeg 2000w" type="image/jpeg" /><img alt="" src="/generated/_posts/../assets/images/sci-hub-proxy-800-8148f0a75.png" width="2665" height="1274" /></picture>

<p>In the UK, many internet service providers (ISPs) block <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5832410/">Sci-Hub</a>. However, a simple proxy is enough to circumvent this (you don’t even need a VPN). Routing requests through a suitable<sup id="fnref:bl" role="doc-noteref"><a href="#fn:bl" class="footnote" rel="footnote">1</a></sup> proxy lets you open Sci-Hub in your regular browser as if it weren’t blocked<sup id="fnref:reverse-lookup" role="doc-noteref"><a href="#fn:reverse-lookup" class="footnote" rel="footnote">2</a></sup>.</p>

<p>Routing all your traffic through a proxy may come with privacy and security concerns, and will slow your connection a bit. We want to use our proxy only for accessing Sci-Hub.</p>

<p>You can use extensions like <a href="https://chrome.google.com/webstore/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif">ProxySwitchy</a> to tell your browser to automatically use certain proxies, or no proxy at all, for sets of websites that you define.</p>

<p>Unfortunately, this extension, and others like it, require permissions to insert arbitrary JavaScript into <em>any</em> page you visit (the web store accurately explains that the extension can “read and change all your data on the websites you visit”). That’s likely due to insufficiently granular permission definitions by Chrome, and is not the fault of the presumably well-intentioned extension authors. But it freaks me out a little bit (<a href="https://robertheaton.com/2018/07/02/stylish-browser-extension-steals-your-internet-history/">bad things have happened</a>).</p>

<p>Luckily, we can achieve the same effect by writing our own <em>proxy auto-configuration file</em>. A proxy auto-configuration or PAC file contains just a single JavaScript function like this:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">function</span> <span class="nx">FindProxyForURL</span> <span class="p">(</span><span class="nx">url</span><span class="p">,</span> <span class="nx">host</span><span class="p">)</span> <span class="p">{</span>
  
  <span class="c1">// Sci-Hub requests</span>
  <span class="k">if</span> <span class="p">(</span><span class="nx">shExpMatch</span><span class="p">(</span><span class="nx">host</span><span class="p">,</span> <span class="dl">'</span><span class="s1">sci-hub.se</span><span class="dl">'</span><span class="p">)</span> <span class="o">||</span> <span class="nx">shExpMatch</span><span class="p">(</span><span class="nx">host</span><span class="p">,</span><span class="dl">'</span><span class="s1">*.sci-hub.se</span><span class="dl">'</span><span class="p">))</span> <span class="p">{</span>

                  <span class="c1">// Your proxy address and port number</span>
    <span class="k">return</span> <span class="dl">'</span><span class="s1">PROXY 123.456.789:9279</span><span class="dl">'</span><span class="p">;</span> 
  <span class="p">}</span>

  <span class="c1">// All other requests</span>
  <span class="k">return</span> <span class="dl">'</span><span class="s1">DIRECT</span><span class="dl">'</span><span class="p">;</span>
<span class="p">}</span>
</code></pre></div></div>

<p>We can instruct the operating system to read this file. Search for instructions on Google (<a href="https://www.google.com/search?q=proxy+auto+configuration+file+mac+os">example</a>).</p>

<p>When you use the proxy to access Sci-Hub for the first time in a browser session, the browser will ask you for the username and password to your proxy server. If you’re using Chrome, I’d recommend saving the credentials into the browser’s password manager to avoid having to enter them again.<sup id="fnref:save-password" role="doc-noteref"><a href="#fn:save-password" class="footnote" rel="footnote">3</a></sup></p>

<p>There are many free proxies on the Internet, but I find that using the services of an actual for-profit proxy company is well worth it, for the greater speed and reliability. Currently <a href="https://www.webshare.io/proxy-server?referral_code=1uknewljmt9y">webshare.io</a> (referral link) offers 1 GB per month free, which is quite a lot of Sci-Hub PDFs. After that you can get 250 GB for $2.99 per month.<sup id="fnref:webshare" role="doc-noteref"><a href="#fn:webshare" class="footnote" rel="footnote">4</a></sup></p>

<h3 id="step-by-step-instructions">Step by step instructions</h3>
<ol>
  <li><a href="https://www.webshare.io/?referral_code=1uknewljmt9y">Create an account on webshare.io</a> (referral link)</li>
  <li>Choose a proxy from your list, and copy its address and port number into your PAC file, following the pattern above.</li>
  <li>Set your operating system to read its proxy settings from this PAC file<sup id="fnref:proxyWIN" role="doc-noteref"><a href="#fn:proxyWIN" class="footnote" rel="footnote">5</a></sup>. Instructions for this are easy to Google (<a href="https://www.google.com/search?q=proxy+auto+configuration+file+mac+os">example</a>).</li>
  <li>Open Sci-Hub in your browser. Enter your proxy username and password and optionally save these credentials in the browser. You can find the credentials in your webshare.io account.</li>
  <li>Don’t forget to only use Sci-Hub to look at really old papers that have lapsed into the public domain :)</li>
</ol>

<div class="footnotes" role="doc-endnotes">
  <ol>
    <li id="fn:bl" role="doc-endnote">
      <p>Obviously, the proxy must not itself be on a network that blocks Sci-Hub. I have not come across any proxy that blocks Sci-Hub in this way. <a href="#fnref:bl" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:reverse-lookup" role="doc-endnote">
      <p>Changing your DNS resolver to a public one <a href="https://developers.google.com/speed/public-dns/">like Google’s</a> instead of your ISP’s is not sufficient as of 2021, for two ISPs I’ve tested, and I suspect for all UK ISPs that implement blocking. (Many people believe changing the DNS resolver is sufficient. Probably ISPs used to implement simple DNS level blocking and have recently upped their game.) My guess is that instead of merely blocking the request to resolve <code class="language-plaintext highlighter-rouge">sci-hub.se</code> at the DNS resolver level, the ISPs are also doing a <a href="https://en.wikipedia.org/wiki/Reverse_DNS_lookup">reverse lookup</a> on every requested IP address to check whether it corresponds to a blacklisted domain. <a href="#fnref:reverse-lookup" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:save-password" role="doc-endnote">
      <p>You want to use the Chrome password manager because third-party password managers such as 1Password are not able to auto-fill credentials when logging in to a proxy server (as opposed to logging into a webpage). Note that if you have a third-party password manager extension installed this will disable the browser setting “Offer to save passwords”. I recommend that you temporarily disable your password manager extension, log in to your proxy server, save the password into Chrome, and then enable the extension again. <a href="#fnref:save-password" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:webshare" role="doc-endnote">
      <p>Their home page exemplifies a dark pattern by not showing the pricing by the GB; it just says you get ‘up to unlimited’ bandwidth. You’ll be able to see the actual pricing after you create an account. <a href="#fnref:webshare" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
    <li id="fn:proxyWIN" role="doc-endnote">
      <p>One gotcha is that Windows 10 <a href="https://docs.microsoft.com/en-us/troubleshoot/browsers/cannot-read-pac-file">forces you</a> to call your PAC file from a web server; it cannot be a local file (??!). To work around this, you can upload your file as a <a href="https://gist.github.com/">Gist</a> and link to the <code class="language-plaintext highlighter-rouge">/raw</code>. <a href="#fnref:proxyWIN" class="reversefootnote" role="doc-backlink">&#8617;</a></p>
    </li>
  </ol>
</div>]]></content><author><name></name></author><category term="how to" /><summary type="html"><![CDATA[]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bayes.net/assets/images/sci-hub-proxy.png" /><media:content medium="image" url="https://bayes.net/assets/images/sci-hub-proxy.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry></feed>