Reference no: EM132218008
Project - The Martingale betting system is an old betting strategy from 18th century France. The strategy had the gambler double his/her bet after every loss, so that the first win would recover all previous losses plus win a profit equal to the original stake.
For example, consider a game which have you bet either red or black, where each has 50% chance of winning. The betting system is as follow, first start the game by betting amount c and after a win, always bet c dollars again in the next round. But after every loss, double the previous amount bet. So, after 2 consecutive losses, you would bet 4c and after 3 consecutive losses, the amount would be 8c and so on so forth.
In a roulette game, there are 36 numbers in addition to 0 and 00. Except 0 and 00, which are green, half the numbers are black, and half are red.
Suppose you start with $650 and playing the game by keep betting black. Preform following two simulations.
Simulation 1:
1) Using the martingale betting system and the initial betting amount is $5.
2) Stop if run out of money to continue this betting system (not enough money to place the next bet), or after 100 rounds, whichever occurs first.
3) Repeat (1) and (2) for 200 times and save the iteration number and the amount of money left for each iteration.
Simulation 2:
1) Betting $5 every round.
2) Stop if all money is lost or after 100 rounds, whichever occurs first.
3) Repeat (1) and (2) for 200 times and save the iteration number and the amount of money left for each iteration.
Build R functions for both simulation 1 and 2, that have input values m, c, n and I,
m = initial amount of money
c = amount betted to start
n = maximum number of rounds in one iteration
I = number of iterations
and output a dataset with two columns, iteration number and amount left.
For both simulations, calculate summary stats of amount left (mean, median, variance min and max) and plot histograms of the amount left.
Attachment:- Project Assignment File.rar