MATH 351 Homework 05
Due at the end of class on 2024-03-11.
In this homework we will simulate random variables, each of which is from the same distribution you worked with in Homework 02, let's call this distribution . Convergence in probability dictates that the mean of arbitrary continuous functions of the random variables converges in probability (not smoothly) to the expectation . You should use only one for-loop, of length , for this entire assignment.
- Generate random variables from your
distribution with fixed parameters, similar to Homeworks
02 and 03. Store these data in a variable named
x
. - Create at least two, maybe three if you have more than
one chosen parameter from part 1., instances of the class
OnlineMoments()
. Each instance should have a variable name appropriate for the expectation it's going to be tracking: mean and variance, first parameter, (maybe second parameter). - For , set up a for-loop that does the following each iteration:
- update each instance of
OnlineMoments()
-- what you update with will vary, the mean and variance are updated with simply each data point, but to update your parameters you need to use the function of the mean and variance you developed in Homework 02; - store the th mean, variance, and estimate of your parameter(s);
- update each instance of
- Make one convergence in probability plot for each of the stored estimates: mean, variance, and estimated parameter(s). On each plot you should draw in a horizontal, dashed black line the true value you are trying to estimate.
- Write out code as a Text cell the explains what calculations are going on in the code. As an example, here's what you all should have for the mean