Dated : 19th of May, 2022
Experiment: Picking a ball at random from an urn, containing 4 blue balls and 5 red balls.
Probability of Blue ball: 4/9 = 0.44 Probability of Red ball: 5/9 = 0.55
We will first evaluate probability of probability of selecting a red or blue ball described above using Monte Carlo simulations.
There are two steps: generate a large number of observations and count the number of red balls.
These two steps can be written in a single loop usually.
We run the simulation multiple times to see what probability estimate is obtained each time.
We see that the estimate of RED ball is close to 0.55447 whereas the estimate of BLUE ball is 0.44655 which are significantly close to the theoretical values of the probabilities which are 0.55 and 0.44 respectively.
Click here to visit the Collab File.