Two weeks ago, I got sufficiently annoyed by the poor rendering of the base WordPress interface for \{\LaTeX\) formulas and equations to search for an easy move to ennabling MathJax. A few exchanges with Claude, ChatGPT, and Gemini later, it appeared that the solution was quite simple had been available for quite a while (!), and consisted in loading the MathJax-LaTeX plugin in my WordPress site, provided I adopted a personal version for its primary. Which is why it is now xianblog.fr instead of xianblog.wordpress.com, still operational. (I would have preferred xianblog.eu ou xianblog.world, but these suffixes were not proposed.) As a result, readers may see more math in the posts, and a renewed majority of paper discussions!
For instance, here is Claude’s lengthy rendering of the posterior median being the optimal Bayes estimator under absolute error loss:
Let \(\theta\) have posterior distribution \(\pi(\theta \mid x)\), and assume \(\mathbb{E}[\,|\theta| \mid x\,] < \infty\) so that the posterior expected absolute error \[ \rho(a) = \mathbb{E}\big[\,|\theta – a| \;\big|\; x\,\big] \] is finite for every \(a \in \mathbb{R}\). A posterior median is any \(m\) such that \[ P(\theta \le m \mid x) \ge \frac{1}{2} \quad \text{and} \quad P(\theta \ge m \mid x) \ge \frac{1}{2}. \] Claim: For every \(a \in \mathbb{R}\), \(\rho(a) \ge \rho(m)\).
Proof Case 1: \(a > m\). Compare \(|\theta – a|\) and \(|\theta – m|\) on three regions:
\[
|\theta – a| – |\theta – m| =
\begin{cases}
(a – \theta) – (m – \theta) = a – m, & \theta \le m, \\[4pt]
(a – \theta) – (\theta – m) = a + m – 2\theta, & m < \theta < a, \\[4pt]
(\theta – a) – (\theta – m) = -(a – m), & \theta \ge a.
\end{cases}
\]On the middle region, \(\theta < a\) gives \(a + m – 2\theta > a + m – 2a = -(a – m)\). So for all \(\theta\),
\[
|\theta – a| – |\theta – m| \;\ge\; (a – m)\Big[\mathbf{1}\{\theta \le m\} – \mathbf{1}\{\theta > m\}\Big].
\]Taking posterior expectations, which is allowed because both sides are bounded by \(|a – m|\):
\[
\rho(a) – \rho(m) \;\ge\; (a – m)\Big[P(\theta \le m \mid x) – P(\theta > m \mid x)\Big]
= (a – m)\Big[2\,P(\theta \le m \mid x) – 1\Big].
\]Since \(a – m > 0\) and \(P(\theta \le m \mid x) \ge \frac12\), the right-hand side is \(\ge 0\). Hence \(\rho(a) \ge \rho(m)\).
Case 2: \(a < m\). By the symmetric argument, with the roles of the left and right tails swapped,
\[
|\theta – a| – |\theta – m| \;\ge\; (m – a)\Big[\mathbf{1}\{\theta \ge m\} – \mathbf{1}\{\theta < m\}\Big], \] so \[ \rho(a) – \rho(m) \;\ge\; (m – a)\Big[2\,P(\theta \ge m \mid x) – 1\Big] \;\ge\; 0, \] using \(m – a > 0\) and \(P(\theta \ge m \mid x) \ge \frac12\).Case 3: \(a = m\). This case is trivial.
Therefore
\[
m \in \arg\min_{a \in \mathbb{R}} \; \mathbb{E}\big[\,|\theta – a| \;\big|\; x\,\big].
\]

![When trying rather sterilely [since the whole idea is that the posterior to the first sample is the prior to the second sample!] to demonstrate the update formula for the Normal-Gamma conjugate model, following a question on X validated, I found the MathJax editor more annoying than usual as lacking the ability to visualise the output while typing the LaTeX input. And went for the first time to PLMlatex, the local version of Overleaf, to compose my answer..](https://i0.wp.com/xianblog.fr/wp-content/uploads/2021/03/temp-3.png?resize=450%2C579&ssl=1)

