code: public static double xbarVariance(TransposeDataCollection sampleDataCollection, int populationM, double Nbar) {
          double xbarVariance = 0.0;
          
          int sampleM = sampleDataCollection.size();
          
          double mean = mean(sampleDataCollection);
          
          for(Map.Entry<Object, FlatDataCollection> entry : sampleDataCollection.entrySet()) {
              double sum = 0.0;
              Iterator<Double> it = entry.getValue().iteratorDouble();
              while(it.hasNext()) {
                  sum+=(it.next() - mean);
              }
              xbarVariance+= sum*sum/(sampleM-1);
          }
          
          xbarVariance *= (populationM-sampleM)/(populationM*sampleM*Nbar*Nbar);
          
          return xbarVariance;
      }
docs: Calculates Variance for Xbar
  
  @param sampleDataCollection
  @param populationM
  @param Nbar
  @return