**I**t has been repeated many times on many platforms, the R (or R⁰) number is not a great summary about the COVID-19 pandemic, see eg Rossman’s warning in The Conversation, but Nature chose to stress it one more time (in its 16 Jul edition). Or twice when considering a similar piece in Nature Physics. As Boris Johnson made it a central tool of his governmental communication policy. And some mayors started asking for their own local R numbers! It is obviously tempting to turn the messy and complex reality of this planetary crisis into a single number and even a single indicator R<1, but it is unhelpful and worse, from the epidemiology models being wrong (or at least oversimplifying) to the data being wrong (i.e., incomplete, biased and late), to the predictions being wrong (except for predicting the past). Nothing outrageous from the said Nature article, pointing out diverse degrees of uncertainty and variability and stressing the need to immediately address clusters rather than using the dummy R. As an aside, the repeated use of *nowcasting* instead of *forecasting* sounds like a perfect journalist fad, given that it does not seem to be based on a different model of infection or on a different statistical technique. (There is a nowcasting package in R, though!) And a wee bit later I have been pointed out at an extended discussion of an R estimation paper on Radford Neal’s blog.

## Archive for the R Category

## the limits of R

Posted in Books, pictures, R, Statistics with tags Boris Johnson, COVID-19, epidemiology, journalism, Nature, nowcasting, pandemic, PHE, Public Health England, R, R number, R package, UK on August 10, 2020 by xi'an## MCqMC 2020 live and free and online

Posted in pictures, R, Statistics, Travel, University life with tags COVID-19, England, Markov chain Monte Carlo algorithm, MCQMC 2020, Monte Carlo methods, Monte Carlo Statistical Methods, Oxford, quasi-Monte Carlo methods, remote conference, tutorial, University of Oxford, virtual reality, webinar, youtube on July 27, 2020 by xi'an**T**he MCqMC 20202 conference that was supposed to take place in Oxford next 9-14 August has been turned into an on-line free conference since travelling remains a challenge for most of us. Tutorials and plenaries will be live with questions on Zoom, with live-streaming and recorded copies on YouTube. They will probably be during 14:00-17:00 UK time (GMT+1), 15:00-18:00 CET (GMT+2), and 9:00-12:00 ET. (Which will prove a wee bit of a challenge for West Coast and most of Asia and Australasia researchers, which is why our One World IMS-Bernoulli conference we asked plenary speakers to duplicate their talks.) All other talks will be pre-recorded by contributors and uploaded to a website, with an online Q&A discussion section for each. As a reminder here are the tutorials and plenaries:

Invited plenary speakers:

Aguêmon Yves Atchadé (Boston University)

Jing Dong (Columbia University)

Pierre L’Écuyer (Université de Montréal)

Mark Jerrum (Queen Mary University London)

Peter Kritzer (RICAM Linz)

Thomas Muller (NVIDIA)

David Pfau (Google DeepMind)

Claudia Schillings (University of Mannheim)

Mario Ullrich (JKU Linz)

Tutorials:

Fred Hickernell (IIT) — Software for Quasi-Monte Carlo Methods

Aretha Teckentrup (Edinburgh) — Markov chain Monte Carlo methods

## [The Art of] Regression and other stories

Posted in Books, R, Statistics, University life with tags Aki Vehtari, amazon associates, Americanisms, Andrew Gelman, book review, C.R. Rao, Cambridge University Press, causality, cum grano salis, cup, garden, glm, instrumental variables, Jennifer Hill, non-response, political science, R, robustness, stan_glm, US elections 2016 on July 23, 2020 by xi'an**CoI:** Andrew sent me this new book [scheduled for 23 July on amazon] of his with Jennifer Hill and Aki Vehtari. Which I read in my garden over a few sunny morns. And as Andrew and Aki are good friends on mine, this review is definitely subjective and biased! Hence to take with a spoonful of salt.

The “other stories’ in the title is a very nice touch. And a clever idea. As the construction of regression models comes as a story to tell, from gathering and checking the data, to choosing the model specifications, to analysing the output and setting the safety lines on its interpretation and usages. I added “The Art of” in my own title as the exercise sounds very much like an art and very little like a technical or even less mathematical practice. Even though the call to the resident stat_glm R function is ubiquitous.

The style itself is very story-like, very far from a mathematical statistics book as, e.g., C.R. Rao’s Linear Statistical Inference and Its *Applications**. *Or his earlier Linear Models which I got while drafted in the Navy. While this makes the “Stories” part most relevant, I also wonder how I could teach from this book to my own undergrad students without acquiring first (myself) the massive expertise represented by the opinions and advice on what is correct and what is not in constructing and analysing linear and generalised linear models. In the sense that I would find justifying or explaining opinionated sentences an amathematical challenge. On the other hand, it would make for a great remote course material, leading the students through the many chapters and letting them experiment with the code provided therein, creating new datasets and checking modelling assumptions. The debate between Bayesian and likelihood solutions is quite muted, with a recommendation for weakly informative priors superseded by the call for exploring the impact of one’s assumption. (Although the horseshoe prior makes an appearance, p.209!) The chapter on math and probability is somewhat superfluous as I hardly fathom a reader entering this book without a certain amount of math and stats background. (While the book warns about over-trusting bootstrap outcomes, I find the description in the Simulation chapter a wee bit too vague.) The final chapters about causal inference are quite impressive in their coverage but clearly require a significant amount of investment from the reader to truly ingest these 110 pages.

“One thing that can be confusing in statistics is that similar analyses can be performed in different ways.” (p.121)

Unsurprisingly, the authors warn the reader about simplistic and unquestioning usages of linear models and software, with a particularly strong warning about significance. (Remember Abandon Statistical Significance?!) And keep (rightly) arguing about the importance of fake data comparisons (although this can be overly confident at times). Great Chapter 11 on assumptions, diagnostics and model evaluation. And terrific Appendix B on 10 pieces of advice for improving one’s regression model. Although there are two or three pages on the topic, at the very end, I would have also appreciated a more balanced and constructive coverage of machine learning as it remains a form of regression, which can be evaluated by simulation of fake data and assessed by X validation, hence quite within the range of the book.

The document reads quite well, even pleasantly once one is over the shock at the limited amount of math formulas!, my only grumble being a terrible handwritten graph for building copters(Figure 1.9) and the numerous and sometimes gigantic square root symbols throughout the book. At a more meaningful level, it may feel as somewhat US centric, at least given the large fraction of examples dedicated to US elections. (Even though restating the precise predictions made by decent models on the eve of the 2016 election is worthwhile.) The Oscar for the best section title goes to “Cockroaches and the zero-inflated negative binomial model” (p.248)! But overall this is a very modern, stats centred, engaging and careful book on the most common tool of statistical modelling! More stories to come maybe?!

## le compte est bon

Posted in Books, Kids, R with tags countdown, le compte est bon, mathematical puzzle, R, The Riddler, tio.run, Try It Online on July 22, 2020 by xi'an**T**he Riddler asks how to derive 24 from (1,2,3,8), with each number appearing once and all operations (x,+,/,-,^) allowed. This reminded me of a very old TV show on French TV, called Le compte est bon!, where players were given 5 or 6 numbers and supposed to find a given total within 60 ,seconds. Unsurprisingly there is an online solver for this game, as shown above, e.g., 24=(8+3+1)x2. But it proves unable to solve the puzzle when the input is 24 and (2,3,3,4), only using 2,3 and 4, since 24=2x3x4. Introducing powers as well, since exponentiation is allowed, leads to two solutions, (4-2)³x3=(4/2)³x3=(3²-3)x4=3/(2/4)³=24… Not fun!

I however rewrote an R code to check whether 24 was indeed a possibility allowed with such combinations but could not find an easy way to identify which combination was used, although a pedestrian version eventually worked! And exhibited the slightly less predictable 4^{3/2}x3=24!

## Le Monde puzzle [#1152]

Posted in Kids, R with tags brute-force solution, Gare d'Austerlitz, Le Monde, mathematical puzzle, Paris, R, tournament on July 20, 2020 by xi'an**T**he weekly puzzle from Le Monde is a tournament classic:

An even number of teams play one another once a week with no tie allowed and have played all other teams. Four weeks into the tournament, A has won all its games, B,C, and D have won three games, the other teams have won at least one games. What is the minimum number of teams? Show an instance.

By sheer random search

tnmt=function(K=10,gamz=4){ t1=t0=matrix(1,K,K) tnmt=function(K=10,gamz=4){ tnmt=t0=matrix(0,K,K) while (!prod(apply(tnmt^2,1,sum)==4)){ tnmt=t0 for (i in 1:(K-2)){ if((a<-gamz-sum(tnmt[i,]^2))> K-i-1) break() if(a>0){ j=sample((i+1):K,a) tnmt[i,j]=sample(c(-1,1),a,rep=TRUE) tnmt[j,i]=-tnmt[i,j]}}} tnmt} chck=function(1,gamz=4){ sumz=apply(tnmt,1,sum) max(sumz)==gamz& sum(sumz==2)>2& min(sumz)>-gamz}

I found that 8 teams were not producing an acceptable game out of 10⁶ tries. Here is a solution for 9 teams:

[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] -1 -1 1 -1 [2,] -1 1 -1 -1 [3,] 1 1 1 -1 [4,] 1 1 1 -1 [5,] -1 -1 1 -1 [6,] -1 -1 -1 1 [7,] 1 -1 1 1 [8,] 1 -1 -1 -1 [9,] 1 1 1 1

where team 9 wins all four games, 7,4 and 3, win three games, and the other 4 teams win one game. Which makes sense since this is a zero sum game, with a value of 10 over the four top teams and 2(N-4)=10 if no team has two wins (adding an even number of such teams does not change the value of the game).