sample(1:6,1,replace=TRUE) draws a number from 1 to 6 equally likely in a random manner as that of tossing a dice once. Revise the Monte Carlo code of a coin toss in class to simulate the probability of getting a number 6 in one dice toss, e.g., P(getting a 6 in one toss). Assume the following three repeatition scenarions:
n <- 20
dice <- 0
for (i in 1:n) {
dice[i] <- sum(sample(1:6,1,replace=TRUE))
}
sixes <- sum(dice==6) # number of 6's rolled
pofsix <- sixes/n # probability of rolling a six
pofsix
## [1] 0.1
n <- 100
dice <- 0
for (i in 1:n) {
dice[i] <- sum(sample(1:6,1,replace=TRUE))
}
sixes <- sum(dice==6) # number of 6's rolled
pofsix <- sixes/n # probability of rolling a six
pofsix
## [1] 0.14
n <- 10000
dice <- 0
for (i in 1:n) {
dice[i] <- sum(sample(1:6,1,replace=TRUE))
}
sixes <- sum(dice==6) # number of 6's rolled
pofsix <- sixes/n # probability of rolling a six
pofsix
## [1] 0.1669
After changing replication to 10,000, we find that we come closer to the expected probability (16.6667%) at 16.75%
1.9 A sample space has four elements 1, . . . , 4 such that 1 is twice as likely as 2, which is three times as likely as 3, which is four times as likely as 4. Find the probability function.
\[\Omega\ = \omega_1 + \omega_2 + \omega_3 + \omega_4 \\ \omega_1 = 48/100 \\ \omega_2 = 24/100 \\ \omega_3 = 16/100 \\ \omega_4 = 12/100\]
work written here
1.10 A random experiment has three possible outcomes a, b, and c, with P(a) = p, P(b) = p^2, and P(c) = p.
What choice(s) of p makes this a valid probability model?
\[P(a) + P(b) + P(c) = 1 \\ p + p^2 + p = 1 \\ P^2 +2p - 1 = 0 \\ p = \frac{-2 + \sqrt{8}}{2} = 0.4142136 \\ p = \frac{-2 - \sqrt{8}}{2} = -2.414214\]
p can only be equal to 0.4142136 because -2.4 is not a valid probability.
1.21 Suppose A and B are mutually exclusive, with P(A) = 0.30 and P(B) = 0.60. Find the probability that (a) At least one of the two events occurs (b) Both of the events occur
P(A) + P(B) = 0.90
\(P(A \cup B) = 0\) Because both events are mutually exclusive they both cannot occur
\((AB)^c\)
\((A\cap\ B^c)\)