Chapter 2.

Point estimators

We can use simulations to estimate the bias and the mean square error of estimators. The average of large number of a function of a random sample estimate the expected value of that function. In the program below, 10000 replications of random sample of size 10 of a standard normal distribution are obtained. For each sample, the unbiased sample variance and the biased sample sample variance are obtained. Then, these replications are used to estimate the bias and the mean square error of each of the two estimators.

*************************
#PROGRAM
n_10
N_10000
s1_c(1:N)
s2_c(1:N)
for(i in 1:N) 
{
x_rnorm(n)
s1[i]_var(x, unbiased=T)
s2[i]_var(x, unbiased=F)
print(i)
}
s1_sort(s1)
s2_sort(s2)
bias.s1_mean(s1-1)
bias.s2_mean(s2-1)
mse.s1_mean((s1-1)**2)
mse.s2_mean((s2-1)**2)
sq.mse.s1_sqrt(mse.s1)
sq.mse.s2_sqrt(mse.s2)
summary(s1-1)
summary(s2-1)
print(c(bias.s1,mse.s1, sq.mse.s1))
print(c(bias.s2,mse.s2,sq.mse.s2))
*************************
OUTCOME OF THE PROGRAM
> summary(s1-1)
    Min. 1st Qu.   Median       Mean 3rd Qu.  Max. 
 -0.9362 -0.3475 -0.07806 -0.0004007  0.2732 3.053
> summary(s2-1)
    Min. 1st Qu.  Median    Mean 3rd Qu.  Max. 
 -0.9426 -0.4127 -0.1703 -0.1004  0.1459 2.648
> print(c(bias.s1,mse.s1, sq.mse.s1))
[1] -0.0004006553  0.2258741592  0.4752622005
> print(c(bias.s2,mse.s2,sq.mse.s2))
[1] -0.1003606  0.1930302  0.4393520
*************************

Simulations for n=10

bias mse sqrt(mse)
unbiased sample variance -0.000400 0.225874 0.475262
biased sample variance -0.100360 0.193030 0.439352

We see that the biased sample variance has a smaller mse than the unbiased sample variance. But, the improvement in the mse is not worthy compared with the loss in bias.

Comments to: Miguel A. Arcones