Variance

In the simulation programs use the following variance:


\begin{displaymath}V(x)=\sum^{k}{\frac{n_{i}\cdot (x_{i}-\overline{x})^2}{n-1}}\end{displaymath}



The exercise use this variance:

\begin{displaymath}V(x)=\sum^{k}{\frac{n_{i}\cdot (x_{i}-\overline{x})^2}{n}}\end{displaymath}



The solution is to multiply the variance of the simulation by:

\begin{displaymath}V(x)=\sum^{k}{\frac{n_{i}\cdot (x_{i}-\overline{x})^2}{n-1}}\cdot \frac{n-1}{n}\end{displaymath}



  • Statistical simulation of the variance with R-Project
    > x <- c(rep(47,1),rep(48,3),rep(49,2),rep(50,8),rep(51,3),rep(52,2)
    ,rep(53,1));
    
    > ni<- table(x);
    
    
    > n<-sum(ni)
    
    > var(x)*(n-1)/n
    
    [1] 2.1475
    



  • Statistical simulation of the variance with Mathematica
    x := Join[ConstantArray[47, 1], ConstantArray[48, 3], 
       ConstantArray[49, 2], ConstantArray[50, 8], ConstantArray[51, 3], 
       ConstantArray[52, 2], ConstantArray[53, 1]];
       
    ni := Tally [x];
    
    n := Sum[ni[[i, 2]], {i, Length[ni]}];
    
    (Variance[x] (n - 1))/n;
    
    N[%]
    
    2.1475`