## a very quick Riddle

Posted in Books, Kids, pictures, R with tags , , , , , , on January 22, 2020 by xi'an

A very quick Riddler’s riddle last week with the question

Find the (integer) fraction with the smallest (integer) denominator strictly located between 1/2020 and 1/2019.

and the brute force resolution

```for (t in (2020*2019):2021){
a=ceiling(t/2020)
if (a*2019<t) sol=c(a,t)}
```

leading to 2/4039 as the target. Note that

$\dfrac{2}{4039}=\dfrac{1}{\dfrac{2020+2019}{2}}$

## Couplings and Monte Carlo [advanced graduate course at Dauphine by Pierre Jacob]

Posted in Kids, pictures, Statistics, Travel with tags , , , , , , on January 20, 2020 by xi'an

As a visiting professor at Paris-Dauphine next month, Pierre Jacob will give a series of lectures on coupling and Monte Carlo. Next month on Feb. 12, 25, 26, 27, at Université Paris-Dauphine, all starting at 13:45 (room yet to be announced). Attendance is open to all and material will be made available on the lecture webpage.

## my first parkrun [19:56,3/87,78.8%]

Posted in Kids, Running, Travel, pictures with tags , , , , , , , , , on January 19, 2020 by xi'an

This morning, I had my first parkrun race in Gainesville, before heading back to Paris. (Thanks to Florence Forbes who pointed out this initiative to me.) Which reminded me of the race I ran in Helsinki a few years ago. Without the “self-transcendance” topping…! While the route was very urban, it was a fun opportunity to run a race with a few other runners. My time of 19.56 is not my best by far but, excuses, excuses, I was not feeling too well and the temperature was quite high (21⁰) and I finished in the first three runners, just seconds behind two young fellows who looked like they were still in high school.  (I am now holding the record of that race for my age group as well!) Anyway, this is a great way to join races when travelling and not worry about registration, certificates, &tc.

Parkrun also provides an age-grade adjusted ranking (78.8%), which is interesting but statistically puzzling as this is the ratio of one’s time over the fastest time (ever?) in the age x gender category. Given that fastest times are extreme, this depends on one individual and hence has a high variability. Especially in higher (meaning older!) veteran categories. A quantile in the empirical distribution would sound better. I came across this somewhat statistical analysis of the grade,

## Le Monde puzzle [#1127]

Posted in Books, Kids, R, Statistics with tags , , , , on January 17, 2020 by xi'an

A permutation challenge as Le weekly Monde current mathematical puzzle:

When considering all games between 20 teams, of which 3 games have not yet been played, wins bring 3 points, losses 0 points, and draws 1 point (each). If the sum of all points over all teams and all games is 516, was is the largest possible number of teams with no draw in every game they played?

The run of a brute force R simulation of 187 purely random games did not produce enough acceptable tables in a reasonable time. So I instead considered that a sum of 516 over 187 games means solving 3a+2b=516 and a+b=187, leading to 142 3’s to allocate and 45 1’s. Meaning for instance this realisation of an acceptable table of game results

```games=matrix(1,20,20);diag(games)=0
while(sum(games*t(games))!=374){
games=matrix(1,20,20);diag(games)=0
games[sample((1:20^2)[games==1],3)]=0}
games=games*t(games)
games[lower.tri(games)&games]=games[lower.tri(games)&games]*
sample(c(rep(1,45),rep(3,142)))* #1's and 3'
(1-2*(runif(20*19/2-3)<.5)) #sign
games[upper.tri(games)]=-games[lower.tri(games)]
games[games==-3]=0;games=abs(games)
```

Running 10⁶ random realisations of such matrices with no constraint whatsoever provided a solution with] 915,524 tables with no no-draws, 81,851 tables with 19 teams with some draws, 2592 tables with 18 with some draws and 3 tables with 17 with some draws. However, given that 10*9=90 it seems to me that the maximum number should be 10 by allocating all 90 draw points to the same 10 teams, and 143 3’s at random in the remaining games, and I reran a simulated annealing version (what else?!), reaching a maximum 6 teams with no draws. Nowhere near 10, though!

## an elegant sampler

Posted in Books, Kids, R, University life with tags , , , , , , , on January 15, 2020 by xi'an

Following an X validated question on how to simulate a multinomial with fixed average, W. Huber produced a highly elegant and efficient resolution with the compact R code

```tabulate(sample.int((k-1)*n, s-n) %% n + 1, n) + 1
```

where k is the number of classes, n the number of draws, and s equal to n times the fixed average. The R function sample.int is an alternative to sample that seems faster. Breaking the outcome of

```sample.int((k-1)*n, s-n)
```

as nonzero positions in an n x (k-1) matrix and adding a adding a row of n 1’s leads to a simulation of integers between 1 and k by counting the 1’s in each of the n columns, which is the meaning of the above picture. Where the colour code is added after counting the number of 1’s. Since there are s 1’s in this matrix, the sum is automatically equal to s. Since the s-n positions are chosen uniformly over the n x (k-1) locations, the outcome is uniform. The rest of the R code is a brutally efficient way to translate the idea into a function. (By comparison, I brute-forced the question by suggesting a basic Metropolis algorithm.)

## Le Monde puzzle [#1120]

Posted in Books, Kids, pictures, R with tags , , , , on January 14, 2020 by xi'an

A board game as Le weekly Monde current mathematical puzzle:

11 players in a circle and 365 tokens first owned by a single player. Players with at least two tokens can either remove one token and give another one left or move two right and one left. How quickly does the game stall, how many tokens are left, and where are they?

The run of a R simulation like

```od=function(i)(i-1)%%11+1
muv<-function(bob){
if (max(bob)>1){
i=sample(rep((1:11)[bob>1],2),1)
dud=c(0,-2,1)
if((runif(1)<.5)&(bob[i]>2))dud=c(2,-3,1)
bob[c(od(i+10),i,od(i+1))]=bob[c(od(i+10),i,od(i+1))]+dud
}
bob}```

always provides a solution

```> bob
[1] 1 0 1 1 0 1 1 0 1 0 0
```

with six ones at these locations. However the time it takes to reach this frozen configuration varies, depending on the sequence of random choices.

## BAYSM 2020, Kunming, China [reposted]

Posted in Kids, Mountains, pictures, Statistics, Travel, University life with tags , , , , , , , , on January 13, 2020 by xi'an

The 5th Bayesian Young Statisticians Meeting, BAYSM2020, will take place in Kunming, China (June 26-27, 2020) as a satellite to the ISBA 2020 world meeting. BAYSM is the official conference of j-ISBA, the junior section of the International Society for Bayesian Analysis. It is intended for Ph.D. Students, M.S. Students, Post-Docs, Young and Junior researchers working in the field of Bayesian statistics, providing an opportunity to connect with the Bayesian community at large. Senior discussants will be present at each session, providing participants with hints, suggestions and comments to their work. Distinguished professors of the Bayesian community will also participate as keynote speakers, making an altogether exciting program.

Registration is now open (https://baysm2020.uconn.edu/registration) and will be available with an early bird discount until May 1, 2020. The event will be hosted at the Science Hall of Yunnan University (Kunming, China) right before ISBA 2020 world meeting. BAYSM 2020 will include social events, providing the opportunity to get to know other junior Bayesians.

Young researchers interested in giving a talk or presenting a poster are invited to submit an extended abstract by March 29, 2020. All the instructions for the abstract submission are reported at the page https://baysm2020.uconn.edu/call-dates

Thanks to the generous support of ISBA, a number of travel awards are available to support young researchers.

Keynote speakers:
Maria De Iorio
David Dunson
Sylvia Frühwirth-Schnatter
Xuanlong Nguyen
Amy Shi
Jessica Utts

Confirmed discussants:
Jingheng Cai
Li Ma
Fernando Quintana
Francesco Stingo
Anmin Tang
Yemao Xia

While the meeting is organized for and by junior Bayesians, attendance is open to anyone who may be interested. For more information, please visit the conference website: https://baysm2020.uconn.edu/