In: Statistics and Probability
We have a random sample of size 10 from a normal distribution. We wish to estimate the population mean. Damjan suggests taking the average of the sample minimum and sample maximum. Allan thinks this will be a poor estimator and says we should use the sample mean instead. Do a simulation in R to compare these two estimators in terms of their bias and variance. Include a side-by-side boxplot that compares their sampling distributions.
We take 100 simulations at n=10
R-code with output-
> n=10 > sim=100 > th=2 ### Mean > cnt=0 > eps=0.1 > for(i in 1:sim) + { + x=rnorm(n,th,2.3) + Tn=(min(x)+max(x))/2 + if(abs(Tn-th)<eps) + { + cnt=cnt+1 + } + } > cnt [1] 7 > prob=cnt/sim > prob [1] 0.07 >bias= Tn -th >bias [1] 0.6669769
> n=10 > sim=100 > th=2 > cnt=0 > eps=0.1 > for(i in 1:sim) + { + x=rnorm(n,th,2.3) + Tn=mean(x) + if(abs(Tn-th)<eps) + { + cnt=cnt+1 + } + } > cnt [1] 14 > prob=cnt/sim > prob [1] 0.14
>bias= Tn -th
>bias
[1] -1.418102
_________________________________________________________________________________________
In 100 simulations to estimate mean(th), if we use estimator Tn=(min(x)+max(x))/2 then probability of estimating th (mean) is 0.07 and it's bias is 0.6669769 and if we use estimator Tn=mean(x) then probability of estimating th (mean) is 0.14 this means Tn=mean(x) is a good estimator and its bias is -1.418102 which is 0.