To Notes

IT 223 -- May 20, 2024

Review Exercises

  1. If A and B are two events, what must be true for
          P(A and B) = P(A) * P(B)
    to be true?
    Answer: A and B must be independent.
  2. If A and B are two events, what must be true for
          P(A or B) = P(A) + P(B) to be true?
    Answer: A and B must be mutually exclusive.
  3. How is the variance related to the standard deviation of a dataset or of a random variable?
    Answer: The variance is the square of the standard deviation.
  4. What is the variance of a discrete random variable?
    Answer: if P(X=xi) = pi for each i,
    Var(X) = (xi - E(X))2 * p1 + ... + (xn - E(X))2 * pn
  5. What is the expected value of a Bernoulli random variable?
    Answer: for a Bernoulli random variable, P(X = 0) = 1 - p and P(X = 1) = p. Then
    E(X) = x1 P(x1) + ... + E(X) = xn P(xn) = 0 * (1 - p) + 1 * p = p,
    so that E(X) = p.
  6. What is the variance of a Bernoulli random variable?
    Answer: Var(X) = (x1 - E(X))2 * p1 + ... + (xn - E(X))2 * pn =
          (0 - p)2 * (1 - p) + (1 - p)2 * p = p * (1 - p) * (1 - p + p) = p * (1 - p), so
          Var(X) = p * (1 - p)
  7. If S is the sum of n independent outcomes x1, ... , xn from a random variable X, what are E(S) and Var(S) in terms of E(X) and Var(X)?
    Answer: E(S) = E(X1 + ... + X1) = E(X1) + ... + E(Xn) = nE(X), so E(S) = nE(X)

Using R to Simulate Bernoulli Outcomes

  1. Use R to simulate the random outcomes from flipping a fair coin 10 times. Answer: the probability experiment is flipping a coin once; this experiment is repeated 10 times. A binomial random variable is specified number of independent outcomes from a Bernoulli random variable.
    // Here are the meanings of the R arguments:
    // n = number of times the experiment is repeated
    // size = number of Bernoulli outcomes in one experiment
    // prob = the probability of success for Bernoulli rv.
    rbinom(n=10, size=1, prob=0.5)
     [1] 1 0 0 1 1 1 1 0 0 1
    
  2. Use R to simulate 20 repetitions of flipping a coin 2 times.
    Answer: in this case, n = 20, size = 2, and prob = 0.5.
    > rbinom(n=20, size=2, prob=0.5)
    # or
    > rbinom(20, 2, 0.5)
     [1] 1 2 1 2 0 1 1 1 0 2 0 2 2 2 0 1 1 1 1 1
    
  3. Use R to simulate flipping a fair coin one million times. Repeat the experiment twice. Answer:
    > > rbinom(2, 1000000, 0.5) 
    [1] 500664 499815
    
  4. Elena Delle Donne is the best free throw shooter in WNBA history with a career average of 93.4%. Simulate 10 seasons of shooting 90 free throws per season with a success rate of 93.4%. Answer:
    > rbinom(10, 90, 0.934)
    [1] 79 82 84 87 86 81 85 86 82 87
    

The Law of Averages

The Central Limit Theorem

Factorials and Counting Combinations

Project 4

The Binomial Theorem