multiplying the bars

Posted in Kids, R with tags , , , , , , , on February 25, 2020 by xi'an

The latest Riddler makes the remark that the expression

|-1|-2|-3|

has no unique meaning (and hence value) since it could be

| -1x|-2|-3 | = 5   or   |-1| – 2x|-3| = -5

depending on the position of the multiplication sign and asks for all the possible values of

|-1|-2|…|-9|

which can be explored by a recursive R function for computing |-i|-(i+1)|…|-(i+2j)|

vol<-function(i,j){x=i
  if(j){x=c(i-(i+1)*vol(i+2,j-1),abs(i*vol(i+1,j-1)+i+2*j))
  if(j>1){for(k in 1:(j-2))
        x=c(x,vol(i,k)-(i+2*k+1)*vol(i+2*k+2,j-k-1))}}
  return(x)}

producing 40 different values for the ill-defined expression. However, this is incorrect as the product(s) hidden in the expression only involve a single term in vol(i,j)… I had another try with the decomposition of the expression vol(i,j) into a first part and a second part

prod<-function(a,b) a*b[,1]+b[,2]

val<-function(i,j){
  x=matrix(c(i,0),ncol=2)
  if(j){x=rbind(cbind(i,prod(-(i+1),val(i+2,j-1))),
          cbind(abs(prod(-i,val(i+1,j-1))-i-2*j),0))
    if(j-1){for(k in 2:(j-1)){
      pon=val(i,k-1)
      for(m in 1:dim(pon)[1])
          x=rbind(x,cbind(pon[m,1],pon[m,2]+prod(-(i+2*k-1),val(i+2*k,j-k))))}}}
  return(x)}

but it still fails to produce the right version.

unbiased MCMC with couplings [4pm, 26 Feb., Paris]

Posted in Books, pictures, Statistics, University life with tags , , , , , , , , , , , on February 24, 2020 by xi'an

On Wednesday, 26 February, Pierre Jacob (Havard U, currently visiting Paris-Dauphine) is giving a seminar on unbiased MCMC methods with couplings at AgroParisTech, bvd Claude Bernard, Paris 5ième, Room 32, at 4pm in the All about that Bayes seminar.

MCMC methods yield estimators that converge to integrals of interest in the limit of the number of iterations. This iterative asymptotic justification is not ideal; first, it stands at odds with current trends in computing hardware, with increasingly parallel architectures; secondly, the choice of “burn-in” or “warm-up” is arduous. This talk will describe recently proposed estimators that are unbiased for the expectations of interest while having a finite computing cost and a finite variance. They can thus be generated independently in parallel and averaged over. The method also provides practical upper bounds on the distance (e.g. total variation) between the marginal distribution of the chain at a finite step and its invariant distribution. The key idea is to generate “faithful” couplings of Markov chains, whereby pairs of chains coalesce after a random number of iterations. This talk will provide an overview of this line of research.

Le Monde puzzle [#1132]

Posted in Kids, R, Statistics with tags , , , , , on February 24, 2020 by xi'an

A vaguely arithmetic challenge as Le weekly Monde current mathematical puzzle:

Given two boxes containing x and 2N+1-x balls respectively. If one proceeds by repeatedly transferring half the balls from the even box to the odd box, what is the largest value of N for which the resulting sequence in one of the boxes covers all integers from 1 to 2N?

The run of a brute force R search return 2 as the solution

lm<-function(N)
fils=rep(0,2*N)
bol=c(1,2*N)
while(max(fils)<2){
    fils[bol[1]]=fils[bol[1]]+1
    bol=bol+ifelse(rep(!bol[1]%%2,2),-bol[1],bol[2])*c(1,-1)/2}
return(min(fils))}

with obvious arguments that once the sequence starts cycling all possible numbers have been visited:

> lm(2)
[1] 1
> lm(3)
[1] 0

While I cannot guess the pattern, there seems to be much larger cases when lm(N) is equal to one, as for instance 173, 174, 173, 473, 774 (and plenty in-between).

Ca’ Foscari closed due to 19nCoV scare

Posted in pictures, Travel, University life with tags , , , , , , , on February 23, 2020 by xi'an

An email from the Rettore I just received on my Ca’ Foscari account, announcing the University is closed over all its campi due to some cases of Coronavirus in the Veneto region:

Care colleghe e cari colleghi tutti, care studentesse e cari studenti,

abbiamo avuto ieri e oggi la notizia di diversi casi di infezione da Coronavirus 19nCoV in Veneto, una situazione che prevede misure appropriate e la massima attenzione.

Invito innanzitutto l’intera comunità accademica a seguire con grande scrupolo le prescrizioni che l’unità di crisi regionale ha emanato, ed emanerà sulla base della evoluzione del contagio. Si raccomandano in particolare le seguenti misure di prevenzione (nota OMS e linea indirizzo MUR):
• Lavare spesso le mani con acqua e sapone o gel disinfettanti
• Quando si tossisce o starnutisce, coprire la bocca e il naso con il gomito o fazzoletto usa e getta, lavandosi poi le mani
• Evitare il contatto con chiunque abbia febbre e tosse.

Riguardo alle attività accademiche, al fine di ridurre le possibilità di contagio, si dispone – secondo le indicazioni del Presidente Luca Zaia e in coordinamento con le università del Veneto –  la sospensione delle lezioni e degli esami in tutte le sedi dell’università, a Venezia, Mestre, Treviso e Roncade dal 24/02 al 29/02 compresi. Biblioteche e aule studio saranno chiuse dal 23/02 al 01/03.
Il recupero delle lezioni e degli esami verrà comunicato quanto prima sul sito web di Ca’ Foscari e sui canali di comunicazione ufficiali.
Per il personale tutto,  docente e non docente, le attività si svolgeranno regolarmente, fatte salve le ordinanze locali che vincolino la mobilità delle persone.
L’Ateneo è in continuo contatto con l’unità di crisi e con i ministeri competenti, e provvederà ad aggiornare le misure oggi vigenti sulla base dell’evoluzione della situazione.
Il Rettore
Michele Bugliesi

1917

Posted in Books, Kids, pictures, Travel with tags , , , , , , , , , , , on February 23, 2020 by xi'an

While in Chamonix, last week, I went to see a film for the first time in many months (as the latest installment of Star Wars does not count!).  As it happened, there was a English version of 1917 (and the theatre was full of English speaking spectators, in this most British of French Alpine towns!). I had no prior opinion about the film, for once, having missed my national public radio cinema critic show. The setting was rather impressive at the beginning with the crossing of the deserted “no-man’s-land” between bomb holes and decomposed cadavres, in a constant rush to save thousands from a planned massacre, but then the story stalls into an allegory that becomes almost cartoonesque, from the cut orchards to the plane running into their barn, to the eerie lighting of the ruins, to the episode with the refugee, to the fall in the river and the sad Wayfaring Stranger song (which made me think of the dwarven song in the Hobbit!) and to the anti-climactic reaction of Benedict Cumberbatch. By making the fate of so many depends on the unrealistic bravery of a single man, Mendes’ film may point out (rather cheaply) at the absurdity of it all. But it also contributes to perpetuate the myth of the hero, arriving against all odds (and then some) to save them all (if at the 13th hour). Granted, the film is effective and I was on the verge of tears by its ending, when the brother receives the bad news, but by focussing on the most unrepresentative soldier of the whole front, freely running in the (killing) fields rather than being stuck in the rotten mud for months, it missed the terrible fate of the overwhelming majority, condemned to die without redeeming heroic actions.

ISBA in Kunming postponed till 2021

Posted in Statistics with tags , , , , , , , , , , on February 22, 2020 by xi'an

The ISBA Program committee has just announced that the ISBA World Meeting 2020 in Kunming, China, is postponed until 2021, 28 June till 03 July (and the resolution of the nCoV epidemics). Which is quite unfortunate given the closeness of the meeting and the degree of preparation of the local and scientific committees, but also unavoidable given the difficulties and reluctance of traveling to China at the moment. Hopefully, the health threat will get under control (other than keeping every citizen under lock) sooner than that. Satellite meetings like BAYSM will be moved as well, in a place and on a date soon to be announced.

As an aside, I still call for the additional organisation of mirror conferences of this World meeting  to multiply the opportunities for gathering Bayesians, share results, listen to talks and decrease the amount of travelling (and potential issues with visa, funds, human right concerns, &tc.) To quote Chairman Mao, let a hundred flowers bloom, let a hundred schools of thought contend!

Les Drus [jatp]

Posted in Statistics with tags , , , , , , , , , , , on February 21, 2020 by xi'an