This project simulates flipping 1,000 fair coins 10 times each to study the behavior of the fraction of heads obtained. The experiment focuses on analyzing three specific coins across multiple runs and comparing their behavior against the Hoeffding bound.
The simulation involves the following steps:
- Flipping Coins: 1,000 fair coins are flipped independently 10 times.
- Selecting Coins:
c1: The first coin flipped.crand: A randomly chosen coin.cmin: The coin with the minimum frequency of heads (the earlier one in case of a tie).
- Calculating Fractions: For each of the three coins, calculate the fraction of heads obtained (
ν1,νrand, andνmin).
- Simulate this experiment 100,000 times to obtain distributions of
ν1,νrand, andνmin. - Plot histograms of these distributions.
- Estimate the probability
P[|ν − μ| > ε]as a function ofεand compare it with the Hoeffding bound2e^(-2ε²N).
- Visualizations include histograms for the distributions of
ν1,νrand, andνmin. - A graph comparing the empirical estimates with the Hoeffding bound for different values of
ε.
- Python 3.x
- Jupyter Notebook
- Required Python libraries:
numpy,matplotlib,seaborn
- Clone the repository:
git clone https://github.com/aliz-f/Coin-Flipping-Simulation-Analysis.git - Install the required libraries:
pip install numpy matplotlib seaborn - Open the Jupyter Notebook