R code:
n<-10000
samp<-c()
a<-0
for(a in 1:n)
samp<-c(samp,sum(sample(c(1:6),2,replace = T)))
hist(x = samp)
#observed probability
table(samp)/n
#exact probability
rbind(2:12,c(1:6,5:1)/36)
# yes they are matching verified
OUTPUT
> source('~/.active-rstudio-document', echo=TRUE)
> n<-10000
> samp<-c()
> a<-0
> for(a in 1:n)
+ samp<-c(samp,sum(sample(c(1:6),2,replace = T)))
> hist(x = samp)
> #observed probability
> table(samp)/n
samp
2 3 4 5 6 7 8 9 10 11 12
0.0297 0.0566 0.0818 0.1111 0.1407 0.1638 0.1389 0.1081 0.0840
0.0576 0.0277
> #exact probability
> rbind(2:12,c(1:6,5:1)/36)
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 2.00000000 3.00000000 4.00000000 5.0000000 6.0000000 7.0000000
8.0000000
[2,] 0.02777778 0.05555556 0.08333333 0.1111111 0.1388889 0.1666667
0.1388889
[,8] [,9] [,10] [,11]
[1,] 9.0000000 10.00000000 11.00000000 12.00000000
[2,] 0.1111111 0.08333333 0.05555556 0.02777778
> # yes they are matching verified
3 a) Suppose that we wish to generate observations from the discrete distribution with probability mass...
Suppose that we wish to generate observations from the discrete distribution 3 a) Suppose that we wish to generate observations from the discrete distribution with probability mass function 2)+1 20 x=1,2, 3, 4, 5 Clearly describe the algorithm to do this and give the random numbers corresponding to the following uniform(0,1) sample. 0.5197 0.1790 0.9994 0.6873 0.7294 0.5791 0.0361 0.2581 0.0026 0.8213 NB: Do not use R for this part of the question. two numbers rolled. Write an R function...
3. Use the probability generating function Px)(s) to find (a) E[X(10)] (b) VarX(10)] (c) P(X(5)-2) . ( 4.2 Probability Generating Functions The probability generating function (PGF) is a useful tool for dealing with discrete random variables taking values 0,1, 2, Its particular strength is that it gives us an easy way of characterizing the distribution of X +Y when X and Y are independent In general it is difficult to find the distribution of a sum using the traditional probability...
Write a C++ game that plays Craps. Craps is a game played with a pair of dice. The shooter (the player with the dice) rolls a pair of dice and the number of spots showing on the two upward faces are added up. If the opening roll (called the ‘come out roll’) is a 7 or 11, the shooter wins the game. If the opening roll results in a 2 (snake eyes), 3 or 12 (box cars), the shooter loses,...
c-f on this page We were unable to transcribe this imagee) Deseribe the probabuiity histogram (symmetry, shape, center And the mean of this discrete random variable, Х. (Reminden This is asking you to find the mean or a random variable. .not a sample mean.) Show your 二つ、 e) Find the standard deviation of the random variable, X. (Reminder: This is asking you to find the standard deviation of a random variable...not a sample standard deviation.) Keep EXACT fractions throughout the...
Assignment Specifications We are going to use the Monte Carlo Method to determine the probability of scoring outcomes of a single turn in a game called Pig. Your Task For this assignment you will simulate a given number of hold?at?N turns of a game called Pig, and report the estimated probabilities of the possible scoring outcomes. You are NOT implementing the game of Pig, only a single turn of this game. The value of N will be acquired via user...
part C (b) Consider the experiment on pp. 149-156 of the online notes tossing a coin three times). Consider the following discrete random variable: Y = 2[number of H-3[number of T). (For example, Y (HHT) = 2.2-3.1=1, while Y (TTH) = 2.1-3.2 = -4.) Repeat the analysis found on pp. 149-156. That is, (i) find the range of values of Y: (ii) find the value of Y(s) for each s ES: (iii) find the outcomes in the events A -Y...
Please, I need help with program c++. This is a chutes and ladders program. The code must be a novel code to the specifications of the problem statement. Thank you very much. Assignment Overview This program will implement a variation of the game “chutes and ladders” or “snakes and ladders:” https://en.wikipedia.org/wiki/Snakes_and_Ladders#Gameplay. Just like in the original game, landing on certain squares will jump the player ahead or behind. In this case, you are trying to reach to bottom of the...