Let X be a discrete random variable. For each of the following cases when
- X is a Binomial distribution, X ~ Bin(n, p), n = 100; p = 0.5;
- X is a Geometric distribution, X~ Geo(p), p = 0.5,
You have to compute the TRUE and EMPIRICAL values for the mean and variance of X. For the true values, you can calculate them manually or you can first generate such a distribution with the specific parameters and then use the functions provided by the MATLAB to compute its mean and variance. For the empirical values, you first randomly generate N samples from such a distribution, and then use the mean and var functions to compute the empirical mean and variance on those samples, respectively. You have to repeat this process for 10 times and obtain the average value of the computed empirical mean and variance over the 10 repeats. Please experimented with
N = [5; 10; 50; 100; 500; 1000; 5000] and then plot a 2D figure, where x-axis denotes N and the y-axis denotes the empirical values for mean or variance. Finally, you have to add a line of the true values for the mean or variance. Please use different colors for the true and empirical values. For each case, you have to submit
1. MATLAB codes, which should be put in script _les (.m);
2. Two figures, which should be in eps format (.eps). One is for the empirical and true mean values and the other is for the empirical and true variance values.
This question belongs to MATLAB software and discusses about application of MATLAB to probability and statistics and to compute the true and empirical values of mean and variance of a random variable.
Title: Compute TRUE and EMPIRICAL values for the mean and variance of a Variable Using MATLABDownload Full Solution