Archive for puzzle

Philosophies, Puzzles and Paradoxes [book review]

Posted in Books, pictures, Statistics, Travel, University life with tags , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , on May 25, 2024 by xi'an

Yudi Pawitan and Youngjo Lee have written a book that recently caught my attention within the CRC Press list of new publications. Because philosophy, puzzles, and paradoxes are definitely of interest to me (as shown by numerous entries in the ‘Og!). The subtitle of said book is A Statistician’s Search for Truth.

Reviews of the book are already available, with for instance Andrew Gelman stating that he disagrees “with much of this book, but it’s an entertaining and thought-provoking introduction to some challenging questions” or Stephen Senn starting the foreword with “This is a remarkable book: wide-ranging, ambitious, challenging and profound but also intriguing, fascinating and original.” (Senn is also cited within the book for his discussion of our revisit of Harold Jeffreys’ Theory of Probability.) Nice cover as well (albeit I could not trace the origin of it, inside or outside the book.)

The book is made of three parts, one on the philosophical approaches to truth, scientific discovery, deduction, and induction, a second one on probability theories, with philosophical motivations, Bayesian inference, and likelihood-based inference, and a third section on paradoxes. Given that both authors are senior authors who have contributed to likelihood inference throughout their career, incl. the books In All Likelihood and Generalized Linear Models with Random Effects, the likelihood approach is somewhat privileged against other statistical resolutions towards the resolution of the paradoxes, with a defence of confidence distributions and a chapter on epistemic confidence that mostly stems from recent papers by the authors, like Pawitan et al.  (2023) and Lee and Lee (2023). I find the discussion therein somewhat unclear, esp. because the same notation Pr(.) is employed for different probability notions.

“Epistemic confidence is the objective measure of uncertainty that’s attached to single events, where the objectivity is based on a consensus of rational minds.” (p.197)

The philosophy part is following the (European) Enlightenment in producing more and more involved discussions on reason, knowledge and scientific discovery. This exploration is an easy read, as it does not delve particularly deeply in the arguments of Kant, Hume, or Popper. With the apparently unescapable mention of Gödel’s incompleteness theorem, including a sausage citation from Poincaré that reminded of that strip from Tintin in America:which, most probably, he would have applied to Ais! Several sections about pseudo-rational attempts to demonstrate the existence of Dog could have been skipped as well.

The part of probability already considers paradoxes which, like the subsequent ones are mostly the consequence of using natural (and hence ambiguous) languages instead of mathematical descriptions—incl. the statement of the Likelihood Principle. It also discusses Keynes’ logical (or imprecise) probabilities, briefly if appropriately given the pessimistic views of young Keynes on the assessment of the probability of an event. Savage is privileged enough to enjoy an entire chapter discussing his 1950’s axioms leading to the existence of a (subjective)  prior on “the states of the world”. This is followed by a chapter on Inverse probability (aka Bayesian statistics), where the authors consider Bayes’ 1763 Essay to have stayed mostly unnoticed till  the beginning of the 20th Century, which sounds a somewhat subjective judgement. (And as uncovered by Steve Stiegler, the original title of the Essay was indeed intended as a reply to Hume.) A further if short chapter is dedicated to the search for the prior distribution. Which thus gives the misguided impression that there should exist such a thing, rather than acknowledging that Bayesian statements are relative to the prior measure. The remainder of the discussion on invariant and reference priors is however mostly standard. Except when falling for the marginalisation paradox when stating that a product of improper priors implies independence on p.144.

The paradoxes examined in the final part are Allais’ (an alumni of Lycée Lakanal!), and Ellsberg’s, avatars of the Saint Petersburg paradox and referring to failing to adhere to rational decision-making and not in the least to statistics. Conjunction and inclusion “fallacious fallacies”, which are central to Kahneman’s Thinking fast and slow bestseller, and attributed to reasoning in terms of likelihood rather than of probability (without accounting for multiple testing on p.228). A whole if short chapter on the Monty Hall and three prisoners paradoxes, another predictable occurrence in a book on reasoning paradoxes. Again mostly a matter of poor wording, plus relying on the choice of an underlying probability model, for which the authors again follow a likelihood approach, the number of the prize door or of the freed prisoner being the parameter. Kyburg’s (very weak) lottery paradox and related forensic paradoxes, concluding with the rejection of judgements based solely on probability reasoning. Hempel’s paradox of the ravens, a priori unrelated with statistical evidence, but turned into one by squeezing in some sampling models. Finishing with the (envelope) exchange paradox, where the authors refuse to put a prior on the unknown parameter but end up with a solution equivalent to adopting a Jeffreys prior.

In conclusion, this attempt at connecting statistical inference and philosophy, probability concepts and rational decision making, paradoxes and modelling, within a single book is academically sound and overall enjoyable, if not outstanding or remarkable as it does not constitute a radical move away from existing analyses of those classical paradoxes. Furthermore, I find the paradoxes overwhelmingly distant from genuine statistical settings and involving a rather stretched notion of data. Still, methinks I will keep this book in my bookcase, rather than leaving it for the taking in the department coffee room!

As I was completing the book and getting towards writing this book review, I also noticed a two page blurb in Significance (May 2024 issue) written by the authors on their book. (which happens rather frequently with this magazine). Unsurprisingly, the contents provd mostly extracted from the preface and introduction With a nice ravens picture (in conjunction with the raven paradox).

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

optimal Gaussian zorbing

Posted in Books, Kids, R, Statistics with tags , , , , , , on August 30, 2022 by xi'an

A zorbing puzzle from the Riddler: cover the plane with four non-intersecting disks of radius one towards getting the highest probability (under the standard bivariate Normal distribution).

As I could not see a simple connection between the disks and the standard Normal, beyond the probability of a disk being given by a non-central chi-square cdf (with two degrees of freedom), I (once again) tried a random search by simulated annealing, which ended up with a configuration like the above, never above 0.777 using a pedestrian R code like

for(t in 1:1e6){# move the disk centres
 Ap=A+vemp*rnorm(2)
 Bp=B+vemp*rnorm(2)
 while(dist(rbind(Ap,Bp))<2)Bp=B+vemp*rnorm(2)
 Cp=C+vemp*rnorm(2)
 while(min(dist(rbind(Ap,Bp,Cp)))<2)Cp=C+vemp*rnorm(2)
 Dp=D+vemp*rnorm(2)
 while(min(dist(rbind(Ap,Bp,Cp,Dp)))<2)Dp=D+vemp*rnorm(2)
 #coverage probability
 pp=pchisq(1,df=2,ncp=Ap%*%Ap)+pchisq(1,df=2,ncp=Bp%*%Bp)+
    pchisq(1,df=2,ncp=Cp%*%Cp)+pchisq(1,df=2,ncp=Dp%*%Dp)
 #simulated annealing step
 if(log(runif(1))<(pp-p)/sqrt(temp)){
   A=Bp;B=Cp;C=Dp;D=Ap;p=pp
   if (sol$val<p) sol=list(val=pp,pos=rbind(A,B,C,D))}
 temp=temp*.9999}

I also tried a simpler configuration where all disk centres were equidistant from a reference centre, but this led to a lower “optimal” probability. I was looking forward the discussion of the puzzle, to discover if anything less brute-force was possible! But there was no deeper argument there beyond the elimination of other “natural” configurations (and missing the non-central χ² connection!). Among these options, having two disks tangent at (0,0) were optimal. But the illustration was much nicer:

bean bag win

Posted in Books, Kids, pictures, R with tags , , , , on May 19, 2021 by xi'an

A quick riddle from The Riddler, where a multiple step game sees a probability of a 3 point increase of .4 and a probability of a 1 point increase of .3 with a first strategy (A), versus a probability of a 3 point increase of .4 and a probability of a 1 point increase of .3 with a second strategy (B), and a sure miss third strategy (C). The goal is to optimise the probability of hitting exactly 3 points after 4 steps.

The optimal strategy is to follow A while the score is zero, C when the score is 3, and B otherwise. The corresponding winning probability is 0.8548, as checked by the following code

win=function(n=1,s=0){
  if(n==4)return((s==3)+.4*(!s)+.8*(s==2))
  else{return(max(c(
    .4*win(n+1,s+3)+.3*win(n+1,s+1)+.3*win(n+1,s),
    .1*win(n+1,s+3)+.8*win(n+1,s+1)+.1*win(n+1,s),
    win(n+1,s))))}}

poems that solve puzzles [book review]

Posted in Books, Kids, University life with tags , , , , , , , , , , , , , , , , , , on January 7, 2021 by xi'an

Upon request, I received this book from Oxford University Press for review. Poems that Solve Puzzles is a nice title and its cover is quite to my linking (for once!). The author is Chris Bleakley, Head of the School of Computer Science at UCD.

“This book is for people that know algorithms are important, but have no idea what they are.”

These is the first sentence of the book and hence I am clearly falling outside the intended audience. When I asked OUP for a review copy, I was more thinking in terms of Robert Sedgewick’s Algorithms, whose first edition still sits on my shelves and which I read from first to last page when it appeared [and was part of my wife’s booklist]. This was (and is) indeed a fantastic book to learn how to build and optimise algorithms and I gain a lot from it (despite remaining a poor programmer!).

Back to poems, this one reads much more like an history of computer science for newbies than a deep entry into the “science of algorithms”, with imho too little on the algorithms themselves and their connections with computer languages and too much emphasis on the pomp and circumstances of computer science (like so-and-so got the ACM A.M. Turing Award in 19… and  retired in 19…). Beside the antique algorithms for finding primes, approximating π, and computing the (fast) Fourier transform (incl. John Tukey), the story moves quickly to the difference engine of Charles Babbage and Ada Lovelace, then to Turing’s machine, and artificial intelligence with the first checkers codes, which already included some learning aspects. Some sections on the ENIAC, John von Neumann and Stan Ulam, with the invention of Monte Carlo methods (but no word on MCMC). A bit of complexity theory (P versus NP) and then Internet, Amazon, Google, Facebook, Netflix… Finishing with neural networks (then and now), the unavoidable AlphaGo, and the incoming cryptocurrencies and quantum computers. All this makes for pleasant (if unsurprising) reading and could possibly captivate a young reader for whom computers are more than a gaming console or a more senior reader who so far stayed wary and away of computers. But I would have enjoyed much more a low-tech discussion on the construction, validation and optimisation of algorithms, namely a much soft(ware) version, as it would have made it much more distinct from the existing offer on the history of computer science.

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

not a Bernoulli factory

Posted in Books, Kids, pictures, R with tags , , , , , , , on May 20, 2020 by xi'an

A Riddler riddle I possibly misunderstood:

Four isolated persons are given four fair coins, which can be either flipped once or returned without being flipped. If all flipped coins come up heads, the team wins! Else, if any comes up tails, or if no flip at all is done, it looses. Each person is further given an independent U(0,1) realisation. What is the best strategy?

Since the players are separated, I would presume the same procedure is used by all. Meaning that a coin is tossed with probability p, ie if the uniform is less than p, and untouched otherwise. The probability of winning is then

4(1-p)³p½+6(1-p)³p½²+4(1-p)p³½³+p⁴½⁴

which is maximum for p=0.3420391, with a winning probability of 0.2848424.

And an extra puzzle for free:

solve x⌊x⌊x⌊x⌋⌋⌋=2020

Where the integral part is the integer immediately below x. Puzzle that I first fail solving by brute force, because I did not look at negative x’s… Since the fourth root of 2020 is between 6 and 7, the solution is either x=6+ε or x=-7+ε, with ε in (0,1). The puzzle then becomes either

(6+ε)⌊(6+ε)⌊(6+ε)⌊6+ε⌋⌋⌋ = (6+ε)⌊(6+ε)⌊36+6ε⌋⌋ = (6+ε)⌊(6+ε)(36+⌊6ε⌋)⌋ = 2020

where there are 6 possible integer values for ⌊6ε⌋, with only ⌊6ε⌋=5 being possible, turning the equation into

(6+ε)⌊41(6+ε)⌋ = (6+ε)(246+⌊41ε⌋) = 2020

where again only ⌊42ε⌋=40 being possible, ending up with

1716+286ε = 2020

which has no solution in (0,1). In the second case

(-7+ε)⌊(-7+ε)⌊(-7+ε)⌊-7+ε⌋⌋⌋ = (-7+ε)⌊(-7+ε)(49+⌊-7ε⌋)⌋ = 2020

shows that only ⌊-7ε⌋=-3 is possible, leading to

(-7+ε)⌊46(-7+ε))⌋ = (-7+ε) (-322+⌊46ε⌋)=2020

with only ⌊46ε⌋=17 possible, hence

2135-305ε=2020

and

ε=115/305.

A brute force simulated annealing resolution returns x=-6.622706 after 10⁸ iterations. A more interesting question is to figure out the discontinuity points of the function

ℵ(x) = x⌊x⌊x⌊x⌋⌋⌋

as they seem to be numerous:

For instance, only 854 of the first 2020 integers enjoy a solution to ℵ(x)=n.