Answer the question
In order to leave comments, you need to log in
How to win by tossing a coin, knowing that the coin can be skewed, but not knowing which one and in which direction?
Asked the theoretical question of the game of tossing a coin.
The essence of the game is probably already clear to everyone. Let's say we have a set of different coins, we can distinguish each of them. We come to the organizer of the game, he gives us to choose a coin. To simplify, we can only bet on heads, and the organizer gives the odds for winning always only 2 (ie, in the case of heads, we double).
Suppose we know that coins can quite possibly be magnetized, asymmetrical, etc., i.e. the probabilities can significantly deviate from 50/50 in one direction, but we do not know for which coin and in which direction.
How to understand how to determine the probability that a certain coin will be "curve" (let's say heads falls more often, i.e. betting on this coin constantly, we will get a positive mathematical expectation), if we have a history of N flips for a coin?
UPD: We have training attempts to toss each coin, how to find the probability that the coin is skewed?
from scipy.stats import beta
import pandas as pd
import numpy as np
p = 0.6
monet = pd.DataFrame([np.random.binomial(1,p) for i in range(100)])[0]
print(f'Выборочная вероятность орла: {monet.mean()}')
a = monet.sum()
b = len(monet) - monet.sum()
apost = beta(a,b)
x = np.linspace(0,1,10000)
fig, ax = plt.subplots(figsize=(18,10))
mean = apost.mean()
std = apost.std()
ax.plot(x, apost.pdf(x), linewidth=2)
ax.grid()
ax.fill_between([mean - 3*std, mean + 3*std], 0, apost.pdf(x).max(), alpha = 0.3)
ax.fill_between([mean - 2*std, mean + 2*std], 0, apost.pdf(x).max(), alpha = 0.3)
ax.fill_between([mean - std, mean + std], 0, apost.pdf(x).max(), alpha = 0.3)
plt.xlim([mean - 4*std,mean + 4*std])
ax.vlines(1/2, 0, apost.pdf(x).max(), color = 'r', linewidth=2)
ax.vlines(monet.mean(), 0, apost.pdf(x).max(), color = 'black', linewidth=2)
Answer the question
In order to leave comments, you need to log in
To simplify, we can only bet on headsThis is not a simplification, but a complication. Maybe all coins fall tails more often, then your chances of winning in a short series of tosses will be small, and in a long series they will tend to zero.
This is already a statistic. You take a sample for each coin, calculate the "chi-square" , you get an answer with a given level of confidence: is it by chance that it falls like this or there is a deviation from a uniform distribution. If there is a deviation, then look in which direction the sample gives you a bias. Actually, you need to bet on this side, doubling each time you lose.
For example: with a probability of 60% heads, 40% tails. I put the ruble on the eagle. Lost. I bet 2 rubles. Lost. I bet 4 rubles. Lost. I bet 8 rubles. Won. Total profit 1 ruble. Since the probability of getting heads is greater, the player will end up winning more than losing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question