Case 1: best value of beta= 1.8 (for details see section ‘Experimental results and Discussion’)

Case 2: best value of beta =2 (for details see section ‘Experimental results and Discussion’) 2. Write a report with the following sections

Problem: A typical problem for any gambler is to know how to maximize his/her fortune from a series of plays. In other words, gambler tries to find the number of plays that will give him the highest outcome or expected value of all possible ones. In this assignment, based on Monte Carlo Simulation and probability distributions, it is required to find the value of beta that will maximize the expected value of the gambler’s fortune. The formula for the computation of the fortune is as follows: Yn=maxXi – c*n.

Xi is the outcome received by the player from the series of plays. Xi, i > 1; (X1, X2, X3…..Xn) c= cost per play n = number of plays

Let’s start with the first case.

Case A

Gambler has an exponential probability distribution function and the cost of each of his play is equal to 0.2

Graph1: Graphically expected value is distributed as follows:

Case B: Cost per play is c = 0:1 and Xn is a discrete random variable obeying Poisson distribution:

P(x = k) =1/ek! for k = 0, 1, 2, , , , ,

Graph2: Graphically expected value is distributed as follows:

Method: The method to calculate the best value of Beta was based on Monte Carlo Simulation. In other words, specified numbers of random variables were generated for each beta by using matlab built-in functions: exprnd and poissrnd. These random variables represented simulated payoff per each game. Next step was to play the game until one of the random variables exceeds our beta. This point is critical as game is stopped and payoff is fixed. For example, we have beta of 2.0 and random variables: 0.5, 0.2, 1.0, 5, 0.8 … . In this case, total number of game is 4 and payoff is 6.7(0.5+0.2+1+5). So, the same process is performed for each beta. In our cases, beta ranged from 0 to 6 because numbers higher than 6 provides lower payoff due to decrease in probability of variables as number increases. The latter pattern can be observed on Graphs 1 and 2. In other words, out best value of beta is on range from 1 to 4 due to above reason.

Returning to above example, we have beta equal to 2, number of games are 4 and payoff is 6.7. Nextly, the payoff is calculated as 6.7 minus 0.2 (0.1 for Poisson) multiplied to 4 and we get 5.9. But this is maximum payoff while expected value is 6.7 multiplied to probability of beta 2.0 which equals to 0.1353. The latter calculation gives expected value of 0.907. The above method described applies to Poisson distribution except it has factorial of 1,2,3, 4,5 ….

Code:

Case A function[ExpectedValue] = BestBeta(b); % input parameter for Expected Value

n=1000; % 'n' number of random variables s = exprnd(1,1000); % generation of variables distributed exponentially with mean 1 x = s(1,:); % since above function generates varables of 1000x1000, to test function, first row was selected as random variables k = 1; % 'k' determines number of rounds which starts with the first above random variable while k<n % 'while' condition means that gambler plays games untill 'k' is lower than total number of variables if x(k)>b % 'if' condition stops the game when random variable exceeds beta break % 'break' exits from loop so that it executes 'if' condition end % the end of 'if' condition k = k+1; % this command computes number of games until 'while' becomes false y = sum(x(1:(k)))-0.2*k; % this is formula to compute Payoff end % end of loop 'while'

ExpectedValue = (1/exp(b))*y; % output parameter of Expected value Case B function[ExpectedValue] = BestBetaPoi(b); % input parameter for Expected Value

n=1000; % 'n' number of random variables s = poissrnd(1,1000); %…