public static VariableStatistics getVS2() {
   VariableStatistics ret = new VariableStatistics();
   for (int i = 0; i < DATA_SET_2.length; i++) {
     double dat = DATA_SET_2[i];
     ret.add(dat);
   }
   return ret;
 }
  @Test
  public void testAdd() {

    VariableStatistics set1 = getVS1();
    VariableStatistics set2 = getVS2();

    set1.add(set2);
    Assert.assertEquals(set1.getCount(), 2 * DATA_SET_SIZE);
    Assert.assertEquals(set1.getSum(), 60, TOLERANCE);
    Assert.assertEquals(set1.getSumSquares(), 216 + 166, TOLERANCE);
    Assert.assertEquals(set1.getMean(), 5, TOLERANCE);
    double stdev = set1.getStandardDeviation();
    Assert.assertEquals(stdev, 2.61406452, TOLERANCE);

    VariableStatistics setx = new VariableStatistics(set2, set2, set2, set2);
    Assert.assertEquals(setx.getCount(), 4 * DATA_SET_SIZE);
    Assert.assertEquals(setx.getSum(), 4 * 30, TOLERANCE);
    Assert.assertEquals(setx.getSumSquares(), 4 * 216, TOLERANCE);
    Assert.assertEquals(setx.getMean(), 5, TOLERANCE);
    stdev = setx.getStandardDeviation();
    Assert.assertEquals(stdev, 3.3166, TOLERANCE);
  }