Throughout, set \(R = 1001\) and use both \(N = 14\) and \(N = 258\) in separate runs.

  1. Assume the population is Gamma, with \(\alpha, \beta > 0\) of your choice.

    1. Pre-allocate an array of size \(R\).

    2. In a for loop of length \(R\),

      • generate \(N\) Gamma random variables. Use the function \(\texttt{numpy.random.gamma}(\alpha, \beta, N)\).
      • estimate the population mean, using the array of random variables just generated. Store the estimate into the \(r\)th element of your pre-allocated array.
    3. Estimate the population mean using the array of sample means.

    4. Estimate the population standard deviation of the array of sample means.

    5. Explain, in complete English sentences, what the standard deviation of the sample mean is telling us.

    6. Make a plot density plot using the array of sample means.

    7. Repeat steps a. through e. using the other sample size, overlaying the two density plots on each other. Use the color and label arguments of bp.density() to differentiate the two density curves on the same plot. Call bp.legend() after your done plotting.

    8. Explain, in complete English sentences, why your two density curves look different.

  2. Assume the population is Binomial, with \(K\) an integer and \(p \in (0, 1)\) of your choice.
    1. Pre-allocate an array of length \(R\).

    2. In a for loop of size \(R\),

      • generate \(N\) Binomial random variables. Use the function \(\texttt{numpy.random.binomial}(K, p, N)\).
      • estimate the population standard deviation, using the array of random variables just generated. Store the estimate into the \(r\)th element of your pre-allocated array.
    3. Estimate the population mean using the array of sample standard deviations.

    4. Estimate the population standard deviation of the array of sample standard deviations.

    5. Explain, in complete English sentences, what the standard deviation of the sample standard deviations is telling us.

    6. Make a plot density plot using the array of sample standard deviations.

    7. Repeat steps a. through e. using the other sample size, overlaying the two density plots on each other. Use the color and label arguments of bp.density() to differentiate the two density curves on the same plot. Call bp.legend() after your done plotting.

    8. Explain, in complete English sentences, why your two density curves look different.

  3. Challenge. Assume the population is Normal, with \(\mu\) a real number and \(\sigma > 0\) of your choice.
    1. Pre-allocate an array of size \(R\).

    2. In a for loop of length \(R\),

      • generate \(N\) Normal random variables. Use the function \(\texttt{numpy.random.normal}(\mu, \sigma, N)\).
      • use Scipy’s function minimize to estimate the population mean, using the array of random variables just generated. Store the estimate into the \(r\)th element of your pre-allocated array.
    3. Estimate the population mean using the array of sample means.

    4. Estimate the population standard deviation of the array of sample means.

    5. Explain, in complete English sentences, what the standard deviation of the sample means is telling us.

    6. Make a plot density plot using the array of sample means.

    7. Repeat steps a. through e. using the other sample size, overlaying the two density plots on each other. Use the color and label arguments of bp.density() to differentiate the two density curves on the same plot. Call bp.legend() after your done plotting.

    8. Explain, in complete English sentences, why your two density curves look different.

  4. Double secret extra challenge. Assume the population is Normal, with \(\mu\) a real number and \(\sigma > 0\) of your choice.
    1. Pre-allocate an array of size \((R, 2)\).

    2. In a for loop of length \(R\),

      • generate \(N\) Normal random variables. Use the function \(\texttt{numpy.random.normal}(\mu, \sigma, N)\).
      • use Scipy’s function minimize to estimate the population mean and standard deviation, using the array of random variables just generated. Store the estimates into the \(r\)th row of your pre-allocated array.
    3. Explain why your pre-allocated array needs dimensions \((R, 2)\). Try to use new statistical words.

    4. Estimate the population mean of each column within your array of sample statistics. Hint: use the argument axis within the function np.mean(). Some Googling/reading potentially required.

    5. Estimate the population standard deviation of each column within your array of sample statistics. Hint: use the argument axis within the function np.std(). Some Googling/reading potentially required.

    6. Explain, in complete English sentences, what the standard deviation of each of the sample statistics is telling us.

    7. Make an appropriate plot for each of the statistics. Give your plots titles with bp.title() and axis labels bp.labels() to differentiate your plots.