Archive for LaTeX

math that jaX [on the ‘Og]

Posted in Linux, pictures, University life with tags , , , , , , , , , , , on November 4, 2026 by xi'an

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].
\]

Tidy up, Claude!

Posted in Linux, Mountains, pictures, Statistics, Travel, University life with tags , , , , , , , , , , , , , , , , , on September 27, 2026 by xi'an

Nothing out of the ordinary there, but after years of procrastination at failing to update my publication webpage, following a wreckage by the default web composer on Ubuntu (and yours truly obviously!), I took advantage of the extra energy gained by my altitude night at the 5th station to ask Claude to update this page, with it replying it preferred to start from scratch (and from my LaTeX vita files). The only drawback is that many of the links introduced in the earlier version were not retrieved by the AI, despite my repeated request. On the plus side, trawling for missing entries and unpublished arXiv oldies but goldies, as well as adding mountain pictures (from the ‘Og!) proved much easier than the manual-by-keyboard approach. And I got an extra bonus in updating my LaTeX publication file and by creating the corresponding bibTeX file, all now available on my github page.

ChatGPT’ed Monte Carlo exam

Posted in Books, Kids, R, Statistics, University life with tags , , , , , , , , , , on January 22, 2026 by xi'an

This semester I was teaching a graduate course on Monte Carlo methods at Paris Dauphine and I decided to experiment how helpful ChatGPT would prove in writing the final exam. Given my earlier poor impressions, I did not have great expectations and ended up definitely impressed! In total it took me about as long as if I had written the exam by myself, since I went through many iterations, but the outcome was well-suited for my students (or at least for what I expected from my students). The starting point was providing ChatGPT with the articles of Giles on multi-level Monte Carlo and of Jacob et al on unbiased MCMC, and the instruction to turn them into a two-hour exam. Iterations were necessary to break the questions into enough items and to reach the level of mathematical formalism I wanted. Plus add extra questions with R coding. And given the booklet format of the exam, I had to work on the LaTeX formatting (if not on the solution sheet, which spotted a missing assumption in one of my questions). Still a positive experiment I am likely to repeat for the (few) remaining exams I will have to produce!

handbook of sharing confidential data [book review]

Posted in Statistics with tags , , , , , , , , , , , , , on March 12, 2025 by xi'an

A new Chapman & Hall handbook appeared on the most current issue of confidentiality and privacy, which has been edited by Jörg Drechsler, Daniel Kifer, Jerome Reiter, and Aleksandra Slavković. The forty authors of the 18 chapters are mostly from the U.S., with a few outliers from Edinburgh (involved in two chapters on protecting the Scottish Longitudinal Study and the U.S. IRS tax data) and Tallinn (for a chapter on secure multi-party computation applications). This means a more U.S. centric focus for realistic implementations as, e.g., with the Census Bureau (which employs 25% of the authors), than those implied by EU regulations, for instance.

Overall, I enjoyed reading these chapters and would certainly use the book as a first entry to a graduate course on privacy (as opposed to some books I recently reviewed). The first two chapters are 100% formula-free and thus more surveys than informative entries to the field, imho. The following Part II on formal privacy techniques covers the expected standards of differential privacy, local vs. global design, single vs. multiple queries, consequence on learning machines and statistical procedures. Concerning Bayesian aspects, Chapter 7 about private machine learning has two paragraphs on the privacy properties of MCMC algorithms albeit not exposing clearly enough that privacy vanishes as the number of iterations grows to infinity. Chapter 8 concentrates on statistical differential privacy, much along my own perception of the requirements for a genuine statistical approach, with Bayesian aspects not sidelined. If less critical of differential privacy than I. Chapter 9 focusses on system issues, investing a dozen pages into the specifics of pseudo-random generators. Part III is about synthetic data, with some overlap between the first two chapters. (I would deem DP need not be introduced by Chapter 12.) I find the section rather superficial, mostly formula free, and lacking in the statistical impact.

As an aside, I am disappointed at the poor rendering of (mathematical) equations making me wonder which type of LaTeX, if any, was used. There are even genuine typos  that seem to result from cut and past encoding errors (see, e.g., the final accentuated c of Sklavković). The reference lists are plentiful, see e.g. the 164 entries for Chapter 7, to the point it would have made more sense to regroup them into a single bibliography. (The predictable reply being that chapters are sold separately and need their respective reference lists.)

[Disclaimer about potential self-plagiarism: this post or an edited version of it could possibly appear in my Books Review section in CHANCE.]

Hands-On Differential Privacy [book review]

Posted in Books, R, Statistics, University life with tags , , , , , , , , , , , , , , , , , , , on October 2, 2024 by xi'an

Hands-On Differential Privacy was published just a few months ago (from September  2024!) by (the US publisher) O’Reilly, famous for its programming and technical books with animal covers! A slate pencil sea urchin in the present case. The book is indeed classical O’Reilly’s, with lots of notes, little theory (or maths!) and symbols, a loose structuring of the chapters (no section numbers) and highly detailed examples, and of course plenty of OpenDP code inserts. For instance, in the present case, a case study about the privatization of a sample average x̄ that takes about ten pages. Terrible equation rendering btw (what’s wrong with LATEX?!).  Overall, I am quickly lost in most of the chapters due to a lack of a driving narrative, facing instead a catalogue of possible scenari and procedures, appearing one after the other as in a fashion show.

Hands-On Differential Privacy is written by Ethan Cowan, Michael Shoemate, and Mayana Pereira. I came across the book during the OpenDP workshop at Harvard [that took place right after my return from the Pacific Northwest] and it is definitely linked with OpenDP, all authors being  actually involved at one stage or another in the OpenDP Team. The style of the book is once again in tune with the O’Reilly manuals, which sort of clashes with my preferences. For instance, the introduction of differential privacy (Chapter 2) is quite extensive. Chapter 3 proceeds to teach about private data transform(ation)s, stability (a rewording of Lipschitz-ianity), with code illustrations, often repeating the earlier derivation (see eg p203), while Chapter 4 is its equivalent for private mechanisms. (With the diagrams Figures 3-1 and 4-1 differing only in highlighting/bolding different functions in a privatized data processing pipeline.) Returning to differential privacy with a privacy loss parameter and to Laplace and exponential mechanisms, Chapter 5 proposes several notions of privacy, all closed under post-processing. This includes Wasserman and Zhou (2010) interpretation of privacy as hypothesis testing, except it is not exploited further than connecting type I and type II with (ε,δ) parameters. Chapter 6 concludes Part I about concepts with a series of (fearless) combinators, keeping stability and privacy. With an increasing proportion of coding excerpts which I [imho] did not find particularly helpful.

Nothing about statistical loss of information or efficiency, bias, &tc. until Chapter 8 (p199) and even then so little. Part II is about practice, with a first Chapter  7 on setting a privacy unit (e.g., a person-month) before ensuring their privacy is protected. And discussing unbounded contributions (not unbounded data!). While Chapter 8 very thinly covers statistical modelling, while remaining agnostic about the choice of statistical procedures (Bayes being solely and naïvely mentioned for classification, furthermore with data-based evaluation of the class “prior” probabilities, p211). At this stage, procedures are often only defined through spinets of code, like the private Theil-Sen estimator (pp204-205). The continuous case boils to a Normality assumption, with its pmf being defined (p212) as

\text{Pr}(x=\mu)=\frac{1}{\sqrt{2\pi\sigma}}e^{-(x-\mu)/2\sigma^2}

which contains at least three errors! Chapter 9 is the equivalent of Chapter 8 for machine learning, mostly centred on private gradient descent. And a Pytorch section (pp232-235). Completed by a light Chapter 10 on synthetic data, which does not seem to broach upon the issue of large dimension covariates, providing instead a list of GAN synthetizers.

Part III (Deploying differential privacy) is even more about practice, with Chapter 11 on privacy attacks, Chapter 12 on calibrating a privacy mechanism (co-written with Jayshree Sarathy), and good practice (like codebooks and data annotations), with the appearance of contextual integrity I discovered if not perfectly understood last year at the BIRS workshop in Kelowna. And Chapter 13 on planning a privacy project, with an 11 step checklist, most of which are quite vague [imho] and do include strategies to make the data owners confident their privacy is safe.

[Disclaimer about potential self-plagiarism: this post or an edited version will eventually appear in my Books Review section in CHANCE]