Distribution of \(X\) density function \(\mathbb{E}[X]\) \(\mathbb{V}[X]\) parameter bounds
Bernoulli\((p)\) \(p^x(1-p)^{1-x}\) \(p\) \(p(1 - p)\) \(0 \leq p \leq 1\)
Uniform \((a, b)\) \(\frac{1}{b-a+1}\) \(\frac{b + a}{2}\) \(\frac{(b - a + 1)^2 - 1}{12}\) \(a < b\)
Geometric\((p)\) \((1-p)^{x - 1}p\) \(\frac{1}{p}\) \(\frac{1-p}{p^2}\) \(0 < p < 1\)
  1. Generate random variables from the Bernoulli\((p)\) distribution with your choice of \(p\) and sample size \(N\).

    1. Calculate the population variace and standard deviation using the formulas in the table.

    2. Estimate the variance and standard deviation using your randomly sampled data and the functions var() and std().

  2. Generate random variables from the Uniform\((a,b)\) distribution with your choice of \(a,b\) and sample size \(N\).

    1. Calculate the population variace and standard deviation using the formulas in the table.

    2. Estimate the variance and standard deviation using your randomly sampled data and the functions var() and std().

  3. Think through and then explain why the following statements are true.

    1. For \(X \sim \text{Bernoulli}(p_x)\) and \(Y \sim \text{Bernoulli}(p_y)\), \(\mathbb{V}[Y] < \mathbb{V}[X]\) whenever \(p_x = 0.5\) and \(p_y \ne 0.5\).

    2. For \(X \sim \text{Uniform}(a_x, b_x)\) and \(Y \sim \text{Uniform}(a_y, b_y)\), \(\mathbb{V}[X] < \mathbb{V}[Y]\) whenever \(a_y < a_x\) and \(b_x < b_y\).

  4. Let \(X_1, X_2, \ldots, X_N \sim_{iid} \text{Geometric}(p)\). Calculate the maximum likelihood estimator for \(p\), \(\hat{p}\).

  5. Generate \(N\) random variables from the Geometric\((p)\) distribution with your choice of \(p\) using the function rgeom(N, p).

    1. Estimate the population mean using the function mean().

    2. Estimate \(p\) using your randomly generated data and your solution from above.

    3. Using the formula for the expected value, transform your estimate of \(p\) into a best guess of the expected value.

    4. Using the formula for the variance, transform your estimate of \(p\) into a best guess of the population variance.