In: Statistics and Probability
Both Xand S2 are unbiased for the Poissonλ. Which is better? Use the following steps to answer this question using R.
a) Generate 200000 random numbers from the Poisson(λ= 2) distribution and arrange them in a matrix with 20 rows. Thus you have 10000 samples of size 20.
b) Compute the 10000 sample means and sample variances and store them in objects means and vars, respectively.
c) Compute the average of the 10000 sample means and the average of the 10000 sample variances. Report the two averages. Do they support the claim that they are unbiased for λ= 2?
d) Compute the sample variance of the 10000 sample means and the sample variance of the 10000 sample variances. Report the two variances. Which estimator of λ is preferable?
Please include r code and comments
On simulation, the average of the 10000 sample means and the average of the 10000 sample variances are 2.001235 and 2.005251 respectively. They are almost equal to 2. So they are unbiased for λ= 2.
The sample variance of the 10000 sample means and the sample variance of the 10000 sample variances are 0.1003848 and 0.5263973 respectively/ They are very different from 2. So they are not unbiased for λ= 2.
So, sample mean x̄ is the preferred estimator of λ.
R code is given below