<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Michael Ellis</title>
    <link>https://mlellis.com/blog/</link>
    <description>Writing on causal inference, Bayesian methods, machine learning, generative AI, and the engineering required to run them in production.</description>
    <language>en-us</language>
    <lastBuildDate>Wed, 12 Aug 2026 00:00:00 GMT</lastBuildDate>
    <atom:link href="https://mlellis.com/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Post formatting reference</title>
      <link>https://mlellis.com/blog/formatting-reference/</link>
      <guid isPermaLink="true">https://mlellis.com/blog/formatting-reference/</guid>
      <pubDate>Wed, 12 Aug 2026 00:00:00 GMT</pubDate>
      <description>A scaffold post showing the Markdown, code, math, and table formatting available in posts on this site. Delete or replace it before publishing for real.</description>
      <category>meta</category>
      <content:encoded><![CDATA[<p>This post exists to exercise the rendering pipeline. It is safe to delete once
you have written something real — nothing else references it.</p>
<p>Every post is an MDX file in <code>content/posts</code>. The filename becomes the URL, so
<code>content/posts/formatting-reference.mdx</code> is served at
<code>/blog/formatting-reference/</code>.</p>
<h2>Frontmatter</h2>
<p>Each file opens with a YAML block. <code>title</code>, <code>description</code>, and <code>date</code> are
required, and the build fails loudly if any is missing:</p>
<pre><code class="language-yaml">---
title: 'Post formatting reference'
description: 'One or two sentences. Used for meta tags, cards, and RSS.'
date: '2026-08-12'
tags: ['causal-inference', 'bayesian']
substackUrl: 'https://yourpub.substack.com/p/slug' # optional, added after syndicating
draft: true # optional, hides the post from builds, feeds, and sitemaps
---
</code></pre>
<p>Setting <code>draft: true</code> keeps a post visible in <code>npm run dev</code> while excluding it
from the production build, the RSS feed, and the sitemap. That is how you work
on something over several sessions without publishing it early.</p>
<h2>Code</h2>
<p>Fenced blocks are highlighted at build time, so no JavaScript ships to the
browser for syntax colouring:</p>
<pre><code class="language-python">import jax.numpy as jnp
from jax import random


def bootstrap_filter(key, observations, n_particles=1_000):
    """Minimal bootstrap particle filter."""
    particles = random.normal(key, (n_particles,))
    log_weights = jnp.zeros(n_particles)

    for y in observations:
        particles = particles + random.normal(key, particles.shape)
        log_weights += -0.5 * (y - particles) ** 2

    return particles, jnp.exp(log_weights - jnp.max(log_weights))
</code></pre>
<p>Inline code such as <code>getAllPosts()</code> uses backticks.</p>
<h2>Math</h2>
<p>Math renders with KaTeX, also at build time. Inline math like <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>θ</mi><mo>∣</mo><mi>y</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">p(\theta \mid y)</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">p</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.0278em;">θ</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.0359em;">y</span><span class="mclose">)</span></span></span></span>
sits in single dollar signs, and display math uses double:</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>p</mi><mo stretchy="false">(</mo><mi>θ</mi><mo>∣</mo><mi>y</mi><mo stretchy="false">)</mo><mo>=</mo><mfrac><mrow><mi>p</mi><mo stretchy="false">(</mo><mi>y</mi><mo>∣</mo><mi>θ</mi><mo stretchy="false">)</mo><mtext> </mtext><mi>p</mi><mo stretchy="false">(</mo><mi>θ</mi><mo stretchy="false">)</mo></mrow><mrow><mo>∫</mo><mi>p</mi><mo stretchy="false">(</mo><mi>y</mi><mo>∣</mo><mi>θ</mi><mo stretchy="false">)</mo><mtext> </mtext><mi>p</mi><mo stretchy="false">(</mo><mi>θ</mi><mo stretchy="false">)</mo><mtext> </mtext><mi>d</mi><mi>θ</mi></mrow></mfrac></mrow><annotation encoding="application/x-tex">p(\theta \mid y) = \frac{p(y \mid \theta)\,p(\theta)}{\int p(y \mid \theta)\,p(\theta)\,d\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">p</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.0278em;">θ</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.0359em;">y</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.4281em;vertical-align:-1.0011em;"></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.427em;"><span style="top:-2.305em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mop op-symbol small-op" style="margin-right:0.1945em;position:relative;top:-0.0006em;">∫</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">p</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.0359em;">y</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" style="margin-right:0.0278em;">θ</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">p</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.0278em;">θ</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">d</span><span class="mord mathnormal" style="margin-right:0.0278em;">θ</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">p</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.0359em;">y</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" style="margin-right:0.0278em;">θ</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathnormal">p</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.0278em;">θ</span><span class="mclose">)</span></span></span></span><span class="vlist-s">​</span></span><span class="vlist-r"><span class="vlist" style="height:1.0011em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span></span>
<h2>Tables and quotes</h2>
<table>
<thead>
<tr>
<th>Method</th>
<th>Handles confounding</th>
<th>Needs an instrument</th>
</tr>
</thead>
<tbody>
<tr>
<td>Randomised trial</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>Difference-in-diff</td>
<td>Under assumptions</td>
<td>No</td>
</tr>
<tr>
<td>Two-stage least sq</td>
<td>Yes</td>
<td>Yes</td>
</tr>
</tbody>
</table>
<blockquote>
<p>Blockquotes are useful for pulling out a claim you intend to argue with.</p>
</blockquote>
<p>Lists work as expected:</p>
<ol>
<li>Write the post here, in the repo.</li>
<li>Deploy, so the canonical copy is indexed first.</li>
<li>Syndicate to Substack a few days later.</li>
</ol>
<p>That ordering is the whole point of the setup — see the README for why.</p>
<p><em>Originally published at <a href="https://mlellis.com/blog/formatting-reference/">https://mlellis.com/blog/formatting-reference/</a></em></p>]]></content:encoded>
    </item>
  </channel>
</rss>