Suppose you play a game. The rule is simple. You draw a random number from Norma
ID: 3210144 • Letter: S
Question
Suppose you play a game. The rule is simple.
You draw a random number from Normal distribution (mean=0 and standard deviation=10).
Then, if the random number is greater than 0, you get $11.
If the random number is less than or equal to 0, you loose $10.
For simplicity, let's say that you play this game 3 times. Also, let's assume that the result of the game turned out to be
+11 -10 and 11.
In this case, the average gain/loss can be computed as (11-10+11)/3 = $4.00
Use R simulaiton to help.
Following the same procedure, what would be the average gain/loss if you played this game for 1,000,000 times?
Explanation / Answer
%%% Matlab R code %%%
clc;
clear all;
close all;
format long
N=1000000;
sum=0;
for n=1:N
r= 10*randn(1);
if ( r>0)
sum=sum+11;
else
sum=sum-10;
end
end
sum=sum/N;
if sum >0
fprintf('Avarage gain = $%f ',sum)
else
fprintf('Avarage loss = $%f ',sum)
end
OUTPUT:
Avarage gain = $0.499433
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.