<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Blog on Yongkang (Evan) Li</title><link>https://yongkangli.net/blog/</link><description>Recent content in Blog on Yongkang (Evan) Li</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Fri, 20 Nov 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://yongkangli.net/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>Four ways to explore a distribution</title><link>https://yongkangli.net/blog/four-ways-to-explore-a-distribution/</link><pubDate>Fri, 20 Nov 2026 00:00:00 +0000</pubDate><guid>https://yongkangli.net/blog/four-ways-to-explore-a-distribution/</guid><description>&lt;p&gt;Markov chain Monte Carlo (MCMC) draws samples from a distribution &lt;span class="katex"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\pi&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt; that we can evaluate only up to a constant. It does this by running a Markov chain whose long-run distribution is &lt;span class="katex"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\pi&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;. The &lt;a href="https://yongkangli.net/mcmc/"&gt;MCMC playground&lt;/a&gt; lets you watch four classic samplers do this on two-dimensional targets. Here is what each one does, and what to look for.&lt;/p&gt;&#10;&lt;h2 id="random-walk-metropolis"&gt;Random-walk Metropolis&lt;/h2&gt;&#10;&lt;p&gt;From the current point &lt;span class="katex"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;x&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;, propose &lt;span class="katex"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo&gt;+&lt;/mo&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mi&gt;ε&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;y = x + \sigma \varepsilon&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt; with &lt;span class="katex"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;ε&lt;/mi&gt;&lt;mo&gt;∼&lt;/mo&gt;&lt;mi&gt;N&lt;/mi&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;mn&gt;0&lt;/mn&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;I&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\varepsilon \sim N(0, I)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;, and accept it with probability&lt;/p&gt;</description></item></channel></rss>