Variance of the marginal distributions

  • Statistical simulation of the Variance of the marginal distributions de x and y with R-Project

    x1<- c(rep(15,4),rep(20,3),rep(25,1),rep(15,1),rep(20,4),rep(25,7));
    y1<- c(rep(5,4),rep(5,3),rep(5,1),rep(10,1),rep(10,4),rep(10,7));
    x2<- (x1-15)/5;
    y2<- (y1-5)/5;
    ni<- table(x1);
    n<-sum(ni);
    vx1 <-var(x1)*(n-1)/n
    vx1
    [1] 15.6875
    
    vy1 <-var(y1)*(n-1)/n
    vy1
    [1] 6
    
    vx2 <-var(x2)*(n-1)/n
    vx2
    [1] 0.6275
    
    vy2 <-var(y2)*(n-1)/n
    vy2
    [1] 0.24
    
    vy2*5^2
    [1] 6
    
    vx2*5^2
    [1] 15.6875
    
    



  • Statistical simulation of the Variance of the marginal distributions of x and y with Mathematica

    x1 := Join[ConstantArray[15,4],ConstantArray[20,3], 
       ConstantArray[25,1],ConstantArray[15,1],ConstantArray[20,4], 
       ConstantArray[25,7]];
    
    y1 := Join[ConstantArray[5,4],ConstantArray[5,3], 
       ConstantArray[5,1],ConstantArray[10,1],ConstantArray[10,4], 
       ConstantArray[15,7]];    
    
    x2:=(x1-15)/5;
    y2:=(y1-5)/5; 
       
    ni := Tally [x1];
    
    n := Sum[ni[[i, 2]], {i, Length[ni]}];
    
    vx1:=(Variance[x1] (n - 1))/n;
    vx2:=(Variance[x2] (n - 1))/n;
    vy1:=(Variance[y1] (n - 1))/n;
    vy2:=(Variance[y2] (n - 1))/n;
    
    
    N[vx1]
    N[vx2]
    N[vy1]
    N[vy2]
    N[vx2 5^2]
    N[vy2 5^2]
    
    
    15.6875
    0.6275
    18.6875
    0.7475
    15.6875
    18.6875