Given the following probabilities :
- Game A : coin flip (p1 = 0.49)
- Game B1 : coin flip (p2 = 0.09)
- Game B2 : coin flip (p3 = 0.74)
Given the following game :
Initial balance = 0
Runs = 100000
Heads adds 1, tails adds -1 to the balance.
Do a coin flip (p1 = 0.50) (doesn't add anything to the balance yet).
If Heads :
Then play game A
Else :
If Balance is a multiple of 3, Then play game B1
Else, play game B2
The result of this game tends to more or less 6000. That's Parrondo's Paradox.
But if I change the game by replacing this part :
Do a coin flip (p1 = 0.50) (doesn't add anything to the balance yet).
If Heads :
...
Else :
...
By :
If current_run%2:
...
Else :
...
Then the result tends to more or less -13000.
My question : why is that ?
I don't understand why since :
coin flip == heads
probability = 0.50current_run%2 == 1
frequency = 0.50
So the frequency of A, B1 and B2 games run should be the same.
A Jupyter Notebook of the Python implementation of this game can be found here : https://www.kaggle.com/tomsihap/notebook478df90ec5, and here is a shortened version :
def coinFlipEven():
return 1 if random.random() <= 0.5 else -1
def coinModulo(i):
return 1 if i%2 == 1 else -1
def coinFlipA():
return 1 if random.random() <= 0.49 else -1
def coinFlipB1():
return 1 if random.random() <= 0.09 else -1
def coinFlipB2():
return 1 if random.random() <= 0.74 else -1
n = 1000000
balance1 = 0
balance2 = 0
# Try with even coin flip
for i in range(n):
whichGame = coinFlipEven()
if whichGame == 1:
balance1 += coinFlipA()
else:
if balance1 % 3 == 0:
balance1 += coinFlipB1()
else:
balance1 += coinFlipB2()
# Try with modulo
for i in range(n):
whichGame = coinModulo(i)
if whichGame == 1:
balance2 += coinFlipA()
else:
if balance2 % 3 == 0:
balance2 += coinFlipB1()
else:
balance2 += coinFlipB2()