code: public static double mean(TransposeDataCollection sampleDataCollection, AssociativeArray populationNh) {
          double populationN = Descriptives.sum(populationNh.toFlatDataCollection());
          
          if(populationN<=0) {
              throw new IllegalArgumentException("The populationN parameter must be positive.");
          }
          
          double mean = 0.0;
          
          for(Map.Entry<Object, FlatDataCollection> entry : sampleDataCollection.entrySet()) {
              Object strata = entry.getKey();
              Integer strataPopulation = ((Number)populationNh.get(strata)).intValue();
          
              if(strataPopulation==null) {
                  throw new IllegalArgumentException("Invalid strata population size.");
              }
              
              mean += strataPopulation*SimpleRandomSampling.mean(entry.getValue())/populationN;
          }
          
          return mean;
      }
docs: Calculate the mean from the sample
  
  @param sampleDataCollection
  @param populationNh
  @return