Archive for random walk

grass hopping on the wrong fgpt

Posted in Statistics with tags , , on May 14, 2023 by xi'an

Checking the R coding abilities of ChatGPT, I entered the latest Riddler puzzle that asks for the expected value of the stationary distribution of a slowing-down random walk over the real line when the N-th jump from x is to x±2-N. Which is ½ since the limiting distribution is uniform over (-1,1). The first proposed solution kept returning 0 due to a poor initialisation (and a wrong understanding of the puzzle):

The second attempt does not run (because there is no exact zero in the cumulated distance)and does not make sense (because the random walk has no stopping rule).  The third attempt runs (!) but again misses the point by adding the absolute jump values until a return to zero. And even pointing out the mistake to ChatGPT does not result into a fourth correct solution

random walk with renewal riddle

Posted in Books, Kids, Statistics with tags , , , on February 19, 2023 by xi'an

The Riddler of this week had a rather straightforward puzzle, which can be summarised as finding the expectation of the number of steps needed for a random walk on {1,2,…,N} to reach state 1 when starting at N, if it moves by -1 with probability p and back to N with probability (1-p). Since the return to N is a renewal, the number of steps M is equal to N-1 with probability pN-1 and to i+1+M’ with probability pi(1-p) for 0≤i≤N-2, M and M’ being iid. Hence a point fixe equation


leading to


which correctly returns p⁻¹ when N=2.

clair obscur #3 [jatp]

Posted in pictures, Travel with tags , , , , , , , on February 17, 2022 by xi'an

clair obscur #2 [jatp]

Posted in pictures, Travel with tags , , , , , , , , , on February 16, 2022 by xi'an

triple ruin

Posted in Books, Kids, pictures, R, Statistics, Wines with tags , , , , , , , , , , on December 28, 2021 by xi'an

An almost straightforward riddle from The Riddler involving a triple gambler’s ruin: Dawn competes against three players Alessandra, Berenike, and Chinue, with probabilities of winning one round ¾, ½, and ¼, respectively, until the cumulated score reaches ±15, ±30, and ±45, for the first, second, and third games. What is Dawn’s optimal sequence of adversaries?

First, a brute force R simulation shows that the optimal ordering is to play the three adversaries first weakest, third strongest and middle fair:

  for(t in 1:T)F=F+ord(p)

where I used probabilities closer to ½ to avoid estimated probabilities equal to one.

> comp(1e3)
[1] 0.051 0.038 0.183

(and I eliminated the three other probabilities by sheer symmetry). Second, checking in Feller’s bible (Vol. 1, XIV.3) for the gambler’s ruin probability, a simple comparison of the six orderings confirms this simulation.

%d bloggers like this: