Archive for R
ECMLE on CRAN
Posted in R, Statistics, University life with tags Bayesian model comparison, CRAN, ECMLE package, elliptical covering, github, HPD region, marginal likelihood, normalising constant, R, R package, statistical evidence on March 27, 2026 by xi'anChatGPT’ed Monte Carlo exam
Posted in Books, Kids, R, Statistics, University life with tags AI, ChatGPT, final exam, graduate course, LaTeX, LLM, Monte Carlo Statistical Methods, multilevel Monte Carlo, R, unbiased MCMC, Université Paris Dauphine on January 22, 2026 by xi'anThis 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!
fAIrst contAIct
Posted in Books, Kids, pictures, Statistics, University life with tags ChatGPT, coding, debugging, discipline, master project, plagiarism, Python, R, teaching, Université Paris Dauphine, University of Warwick on November 12, 2025 by xi'an
This semester, I—as a teacher—came across two cases of heavily reliance on AI by master students, mostly for coding purposes, to which I had rather surprisingly not been exposed before. (Except for this plagiarised thesis two years ago that essentially rewrote existing papers with synonyms and for which we had to get to the disciplinary committee!) One project made a massive advance within two days, with hundreds of lines of beautiful python code, and reasonable output, but with my student unable to explain the code or the method behind… And anther case homeworks involving coding came back with extremely clean codes as well. Meaning they could not be graded and we had to switch to another type of evaluation. Oh well, welcome ol’me into the new age (just for a few years!)
Nature snipets [17 April 2025]
Posted in Books, Kids, University life with tags deep learning, Deep Mind, Google, gradient descent, machine learning, Microsoft Research, Nature, NSF, pattern recognition, R, random forests, reinforcement learning, Trump administration on June 25, 2025 by xi'an
From the Nature 17 April Issue:
- the “usual” wishful tribunes with no implementation spreadsheet (incentivizing bug tech companies to make the digital world safer, make quantum tech sustainable and ethical)
- Trump’s bull-in-a-China-shop attitude towards science and academia (US pullback from Antarctica, NSF halving PhD fellowships in 2025, reflecting on how the US became a science superpower, till Trump administration wreaked havoc, with a comparison of how US and UK sciences differ, starting during WW II and seing for the US a $200 billion funding from US governmental research agencies)
- top-cited papers (in the 21st century and overall) including many machine-learning and statistics newcomers, with the top 21st century pretender being an IEEE CVPR 2016 conference paper by Kaiming He, Xiangyu Zhang, Shaoqing Ren & Jian Sun from Microsoft, Deep residual learning for image recognition, plus a 2015 Nature paper by Le Cun, Bengio and Hinton, Deep learning, a 2017 NeurIPS paper by mostly Google researchers, Vaswani et al., Attention is all you need, and… Leo Breiman’s 2001 Random forests. The article goes on given reasons why AI is so over-represented in the list, one being the huge number of conference publications and hence reference opportunities, as well as the practice of the culture of posting preprints (even though this complicates the task of scientometricians. The most highly cited paper in the scientific literature remains Lowry et al.’s 1951 Protein measurement with the Folin phenol reagent, in the Journal of Biological Chemistry, with 1996 generalized gradient approximations made simple (Physical Review Letters) by Perdew et al. coming fourth. With a mention that R does not come up in the list because there is no single paper or book to cite.
- a machine-learning paper on Mastering diverse control tasks through world models, by Danijar et al. (mostly from GoogleDeepMind), which highlighted achievement is collecting diamonds in Minecraft (!). But more fundamentally improving reinforced learning towards robustness in the task handled. The model is an encoder-decoder structure, with three intermediary random predictor functions
- a supportive review of the book More Everything Forever: AI Overlords, Space Empires, and Silicon Valley’s Crusade to Control the Fate of Humanity by Adam Becker (despite the endless title!), written before Elon Musk took over the DOGE (for a while).
THAMES for mixtures, a reply from the authors
Posted in Books, pictures, R, Statistics, University life with tags allocations, Ben Aaronovitch, bridge sampling, CRAN, harmonic mean estimator, label switching, London, marginal likelihood, marginal likelihood identity, MCMC, R, response, Rivers of London, Thames, unbiasedness on June 23, 2025 by xi'an
[Here is a reply to my comments on THAMES sent by the first author of the paper, Martin Metodiev. The above replica of the cover of Rivers of London is obviously unrelated with the reply or the original blog, beyond presenting a fantasy map of the Thames!]
Thank you for your review of our article! Adapting your previous work in this field has been a pleasure. Before I respond to your comments, I would like to emphasize that the simplicity of our estimator lies in its simple analytic expression (a truncated harmonic mean of reciprocal unnormalized posterior density values). Indeed, our package “thamesmix” (recently submitted to CRAN!) has a function to compute the marginal likelihood of any mixture model. This function requires only two parameters: the unnormalized log-posterior function (the logarithm of the prior plus the log-likelihood) and the MCMC simulations from the posterior.
Regarding your main comments:
1. “the evacuation of earlier methods as not simple or not universal enough is rather disingenuous. For instance, software that do not return (latent) allocation vectors can easily be post-processed.”
I could not find an example of post-process simulations on top of MCMC outputs applied to compute these methods. It sounds really interesting, and I would be happy to cite it. Is there a reference that you can recommend?
In any case, the point still stands. Most estimators which we cite with regards to this point do not just need allocation samplers, but also the analytic expressions of the distribution of the allocation vectors or the distribution of the data conditional on these allocation vectors that come with them. I do not think that a closed form of this distribution is available in general.
2.“the handling of the label switching issue—the reason why Larry Wasserman saw mixtures at the same magnitude of evil as tequila!—is problematic for several reasons.”
The fact that our estimator is invariant to label-switching is indeed the core of our method. The simple Gibbs sampler gets stuck in one mode, and this is why the classical version of bridge sampling is biased by a factor of G! in the simulation setting. As you point out, this is successfully resolved when using fully symmetric bridge sampling in the experiment section. However, the computation cost of this fully symmetric estimator rises super-exponentially with G, so I do not see how it could be evaluated for G=15, where the number of symmetric modes is equal to 15! (over one trillion). One of the main points of our article is that the symmetric THAMES can be evaluated in a feasible amount of time, even in such a high-dimensional multivariate setting.
3. “the (legitimate) purpose of using marginal likelihoods for selecting the number G of components is weakened by the intrusion of alternate proposals to assess G from the data”
I would like to point out that these alternate proposals do not in any way impact the definition of the THAMES. It is the simple definition given in Equation (5). They are only used to speed up the computation.
4. “several mentions are made of the other estimators being biased, which is indeed the case for bridge sampling (if not necessarily for importance sampling), but not necessarily a central issue”
The problem that we see with the classical, non-symmetric bridge sampling method in the setting of mixture models is not simply that it is biased. The problem is that the bias is persistent and often roughly equal to the factor of G! when the MCMC sampler failed to switch between modes. We have not had this experience with the THAMES: it converged even when the MCMC was stuck.

