Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/HeuristicLab.Analysis.Statistics-3.3.csproj
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/HeuristicLab.Analysis.Statistics-3.3.csproj	(revision 11691)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/HeuristicLab.Analysis.Statistics-3.3.csproj	(revision 11692)
@@ -146,5 +146,5 @@
       <DependentUpon>StatisticalTestingView.cs</DependentUpon>
     </Compile>
-    <Compile Include="KruskalWallis.cs" />
+    <Compile Include="KruskalWallisTest.cs" />
     <Compile Include="CorrelationView.cs">
       <SubType>UserControl</SubType>
@@ -161,5 +161,5 @@
     <Compile Include="Plugin.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="TTest.cs" />
+    <Compile Include="PairwiseTest.cs" />
   </ItemGroup>
   <ItemGroup>
Index: anches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/KruskalWallis.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/KruskalWallis.cs	(revision 11691)
+++ 	(revision )
@@ -1,150 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-
-namespace HeuristicLab.Analysis.Statistics {
-  public static class KruskalWallis {
-    /// <summary>
-    /// Performs the Kruskal-Wallis test and returns the p-Value. 
-    /// (source based on R's kruskal.test(), GNU GPL)
-    /// </summary>
-    public static double Test(double[][] data) {
-      double[] g;
-      double[] x = FlattenArray(data, out g);
-      int n = x.Length;
-      int parameter = data.Length - 1;
-
-      int[] r = Rank(x);
-      double[][] ties = CountDuplicates(x);
-      double statistic = CalculateStatistic(r, g);
-      double tiesCorrection = CalculateTiesCorrection(ties);
-      statistic = ((12 * statistic / (n * (n + 1)) - 3 * (n + 1)) /
-                  (1 - tiesCorrection / (Math.Pow(n, 3) - n)));
-
-      return alglib.chisquarecdistribution(parameter, statistic);
-    }
-
-    private static double CalculateStatistic(int[] r, double[] g) {
-      double result = 0.0;
-      double lastG = g[0];
-      double curSum = 0.0;
-      int cnt = 0;
-      for (int i = 0; i < r.Length; i++) {
-        if (lastG == g[i]) {
-          curSum += r[i];
-          cnt++;
-        } else {
-          double sum = Math.Pow(curSum, 2);
-          sum /= cnt;
-          result += sum;
-
-          lastG = g[i];
-          curSum = r[i];
-          cnt = 1;
-        }
-      }
-
-      double lastSum = Math.Pow(curSum, 2);
-      lastSum /= cnt;
-      result += lastSum;
-
-      return result;
-    }
-
-    private static double CalculateTiesCorrection(double[][] ties) {
-      double sum = 0.0;
-      for (int i = 0; i < ties[1].Length; i++) {
-        double tic = Math.Pow(ties[1][i], 3) - ties[1][i];
-        sum += tic;
-      }
-      return sum;
-    }
-
-    private static double[] FlattenArray(double[][] x, out double[] indizes) {
-      int compLenght = 0;
-      for (int i = 0; i < x.Length; i++) {
-        compLenght += x[i].Length;
-      }
-
-      double[] result = new double[compLenght];
-      indizes = new double[compLenght];
-
-      int resultPos = 0;
-      for (int i = 0; i < x.Length; i++) {
-        Array.Copy(x[i], 0, result, resultPos, x[i].Length);
-
-        for (int j = resultPos; j < resultPos + x[i].Length; j++) {
-          indizes[j] = i;
-        }
-        resultPos += x[i].Length;
-      }
-
-      return result;
-    }
-
-    private static double[][] CountDuplicates(double[] x) {
-      List<double> number = new List<double>();
-      List<double> cnt = new List<double>();
-      double[] sortedX = new double[x.Length];
-
-      Array.Copy(x, sortedX, x.Length);
-      Array.Sort(sortedX);
-
-      double last = x[0];
-      number.Add(x[0]);
-      cnt.Add(1);
-
-      for (int i = 1; i < x.Length; i++) {
-        if (last != x[i]) {
-          number.Add(x[i]);
-          last = x[i];
-          cnt.Add(1);
-        } else {
-          cnt[cnt.Count - 1] += 1;
-        }
-      }
-
-      double[][] result = new double[2][];
-      result[0] = number.ToArray();
-      result[1] = cnt.ToArray();
-
-      return result;
-    }
-
-    private static int[] Rank(double[] x) {
-      double[] keys = new double[x.Length];
-      int[] items = new int[x.Length];
-      int[] ranks = new int[x.Length];
-
-      Array.Copy(x, keys, x.Length);
-      for (int i = 0; i < x.Length; i++) items[i] = i;
-
-      Array.Sort(keys, items);
-
-      for (int i = 0; i < x.Length; i++) {
-        ranks[items[i]] = i + 1;
-      }
-      return ranks;
-    }
-  }
-}
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/KruskalWallisTest.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/KruskalWallisTest.cs	(revision 11692)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/KruskalWallisTest.cs	(revision 11692)
@@ -0,0 +1,150 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+
+namespace HeuristicLab.Analysis.Statistics {
+  public static class KruskalWallisTest {
+    /// <summary>
+    /// Performs the Kruskal-Wallis test and returns the p-Value. 
+    /// (source based on R's kruskal.test(), GNU GPL)
+    /// </summary>
+    public static double Test(double[][] data) {
+      double[] g;
+      double[] x = FlattenArray(data, out g);
+      int n = x.Length;
+      int parameter = data.Length - 1;
+
+      int[] r = Rank(x);
+      double[][] ties = CountDuplicates(x);
+      double statistic = CalculateStatistic(r, g);
+      double tiesCorrection = CalculateTiesCorrection(ties);
+      statistic = ((12 * statistic / (n * (n + 1)) - 3 * (n + 1)) /
+                  (1 - tiesCorrection / (Math.Pow(n, 3) - n)));
+
+      return alglib.chisquarecdistribution(parameter, statistic);
+    }
+
+    private static double CalculateStatistic(int[] r, double[] g) {
+      double result = 0.0;
+      double lastG = g[0];
+      double curSum = 0.0;
+      int cnt = 0;
+      for (int i = 0; i < r.Length; i++) {
+        if (lastG == g[i]) {
+          curSum += r[i];
+          cnt++;
+        } else {
+          double sum = Math.Pow(curSum, 2);
+          sum /= cnt;
+          result += sum;
+
+          lastG = g[i];
+          curSum = r[i];
+          cnt = 1;
+        }
+      }
+
+      double lastSum = Math.Pow(curSum, 2);
+      lastSum /= cnt;
+      result += lastSum;
+
+      return result;
+    }
+
+    private static double CalculateTiesCorrection(double[][] ties) {
+      double sum = 0.0;
+      for (int i = 0; i < ties[1].Length; i++) {
+        double tic = Math.Pow(ties[1][i], 3) - ties[1][i];
+        sum += tic;
+      }
+      return sum;
+    }
+
+    private static double[] FlattenArray(double[][] x, out double[] indizes) {
+      int compLenght = 0;
+      for (int i = 0; i < x.Length; i++) {
+        compLenght += x[i].Length;
+      }
+
+      double[] result = new double[compLenght];
+      indizes = new double[compLenght];
+
+      int resultPos = 0;
+      for (int i = 0; i < x.Length; i++) {
+        Array.Copy(x[i], 0, result, resultPos, x[i].Length);
+
+        for (int j = resultPos; j < resultPos + x[i].Length; j++) {
+          indizes[j] = i;
+        }
+        resultPos += x[i].Length;
+      }
+
+      return result;
+    }
+
+    private static double[][] CountDuplicates(double[] x) {
+      List<double> number = new List<double>();
+      List<double> cnt = new List<double>();
+      double[] sortedX = new double[x.Length];
+
+      Array.Copy(x, sortedX, x.Length);
+      Array.Sort(sortedX);
+
+      double last = x[0];
+      number.Add(x[0]);
+      cnt.Add(1);
+
+      for (int i = 1; i < x.Length; i++) {
+        if (last != x[i]) {
+          number.Add(x[i]);
+          last = x[i];
+          cnt.Add(1);
+        } else {
+          cnt[cnt.Count - 1] += 1;
+        }
+      }
+
+      double[][] result = new double[2][];
+      result[0] = number.ToArray();
+      result[1] = cnt.ToArray();
+
+      return result;
+    }
+
+    private static int[] Rank(double[] x) {
+      double[] keys = new double[x.Length];
+      int[] items = new int[x.Length];
+      int[] ranks = new int[x.Length];
+
+      Array.Copy(x, keys, x.Length);
+      for (int i = 0; i < x.Length; i++) items[i] = i;
+
+      Array.Sort(keys, items);
+
+      for (int i = 0; i < x.Length; i++) {
+        ranks[items[i]] = i + 1;
+      }
+      return ranks;
+    }
+  }
+}
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/PairwiseTest.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/PairwiseTest.cs	(revision 11692)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/PairwiseTest.cs	(revision 11692)
@@ -0,0 +1,37 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+
+namespace HeuristicLab.Analysis.Statistics {
+  public class PairwiseTest {
+    public static double TTest(double[] group1, double[] group2) {
+      double left, right, both;
+      alglib.unequalvariancettest(group1, group1.Length, group2, group2.Length, out both, out left, out right);
+      return both;
+    }
+
+    public static double MannWhitneyUTest(double[] group1, double[] group2) {
+      double mwuBothtails, mwuLefttail, mwuRighttail;
+      alglib.mannwhitneyutest(group1, group1.Length, group2, group2.Length, out mwuBothtails, out mwuLefttail, out mwuRighttail);
+      return mwuBothtails;
+    }
+  }
+}
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs	(revision 11691)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs	(revision 11692)
@@ -85,5 +85,5 @@
       s2 = d2.Variance();
 
-      return (x1 - x2) / Math.Sqrt((s1 + s2) / 2);
+      return Math.Abs(x1 - x2) / Math.Sqrt((s1 + s2) / 2);
     }
 
@@ -104,5 +104,5 @@
 
       s = Math.Sqrt(((n1 - 1) * s1 + (n2 - 1) * s2) / (n1 + n2 - 2));
-      g = (x1 - x2) / s;
+      g = Math.Abs(x1 - x2) / s;
       c = (1 - (3 / (4 * (n1 + n2) - 9))) * g;
 
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs	(revision 11691)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs	(revision 11692)
@@ -303,5 +303,5 @@
 
     private void TestAllGroups() {
-      double pval = KruskalWallis.Test(data);
+      double pval = KruskalWallisTest.Test(data);
       pValTextBox.Text = pval.ToString();
       if (pval < significanceLevel) {
@@ -359,12 +359,7 @@
 
       double[][] newData = FilterDataForPairwiseTest(colIndex);
-
-      double mwuBothtails;
-      double mwuLefttail;
-      double mwuRighttail;
       int cnt = 0;
-
       for (int i = 0; i < newData.Length; i++) {
-        alglib.mannwhitneyutest(data[colIndex], data[colIndex].Length, newData[i], newData[i].Length, out mwuBothtails, out mwuLefttail, out mwuRighttail);
+        double mwuBothtails = PairwiseTest.MannWhitneyUTest(data[colIndex], newData[i]);
         if (mwuBothtails > significanceLevel) {
           cnt++;
@@ -435,6 +430,4 @@
 
       double mwuBothtails;
-      double mwuLefttail;
-      double mwuRighttail;
       double tTestBothTails;
       double[] mwuPValues = new double[newData.Length];
@@ -445,11 +438,8 @@
 
       for (int i = 0; i < newData.Length; i++) {
-        if (i != colIndex) {
-          alglib.mannwhitneyutest(data[colIndex], data[colIndex].Length, newData[i], newData[i].Length, out mwuBothtails,
-            out mwuLefttail, out mwuRighttail);
-          tTestBothTails = TTest.Test(data[colIndex], newData[i]);
-          mwuPValues[i] = mwuBothtails;
-          tTestPValues[i] = tTestBothTails;
-        }
+        mwuBothtails = PairwiseTest.MannWhitneyUTest(data[colIndex], newData[i]);
+        tTestBothTails = PairwiseTest.TTest(data[colIndex], newData[i]);
+        mwuPValues[i] = mwuBothtails;
+        tTestPValues[i] = tTestBothTails;
       }
 
@@ -458,12 +448,10 @@
 
       for (int i = 0; i < newData.Length; i++) {
-        if (i != colIndex) {
-          pValsMatrix[0, i] = mwuPValues[i];
-          pValsMatrix[1, i] = adjustedMwuPValues[i];
-          pValsMatrix[2, i] = tTestPValues[i];
-          pValsMatrix[3, i] = adjustedTtestPValues[i];
-          pValsMatrix[4, i] = SampleSizeDetermination.CalculateCohensD(data[colIndex], newData[i]);
-          pValsMatrix[5, i] = SampleSizeDetermination.CalculateHedgesG(data[colIndex], newData[i]);
-        }
+        pValsMatrix[0, i] = mwuPValues[i];
+        pValsMatrix[1, i] = adjustedMwuPValues[i];
+        pValsMatrix[2, i] = tTestPValues[i];
+        pValsMatrix[3, i] = adjustedTtestPValues[i];
+        pValsMatrix[4, i] = SampleSizeDetermination.CalculateCohensD(data[colIndex], newData[i]);
+        pValsMatrix[5, i] = SampleSizeDetermination.CalculateHedgesG(data[colIndex], newData[i]);
       }
 
Index: anches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/TTest.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/TTest.cs	(revision 11691)
+++ 	(revision )
@@ -1,31 +1,0 @@
-﻿#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-
-namespace HeuristicLab.Analysis.Statistics {
-  public class TTest {
-    public static double Test(double[] data1, double[] data2) {
-      double left, right, both;
-      alglib.unequalvariancettest(data1, data1.Length, data2, data2.Length, out both, out left, out right);
-      return both;
-    }
-  }
-}
Index: /branches/StatisticalTesting/Statistics.UnitTests/KruskalWallisUnitTests.cs
===================================================================
--- /branches/StatisticalTesting/Statistics.UnitTests/KruskalWallisUnitTests.cs	(revision 11691)
+++ /branches/StatisticalTesting/Statistics.UnitTests/KruskalWallisUnitTests.cs	(revision 11692)
@@ -36,5 +36,5 @@
       data[2] = new double[] { 2.8, 3.4, 3.7, 2.2, 2.0 };
 
-      Assert.AreEqual(0.68, Math.Round(KruskalWallis.Test(data), 2));
+      Assert.AreEqual(0.68, Math.Round(KruskalWallisTest.Test(data), 2));
     }
 
@@ -62,5 +62,5 @@
                               ,3605,4162,493,330,4595,2699,4457,3981,3499,1773,653,3176,134,3205,4537 };
 
-      Assert.AreEqual(0.95, Math.Round(KruskalWallis.Test(data), 2));
+      Assert.AreEqual(0.95, Math.Round(KruskalWallisTest.Test(data), 2));
     }
 
@@ -110,5 +110,5 @@
                               ,-0.947125493,2.087444922,0.271276104,-1.027604792,-0.364097727,-0.741089219};
 
-      Assert.AreEqual(0.0253, Math.Round(KruskalWallis.Test(data), 4));
+      Assert.AreEqual(0.0253, Math.Round(KruskalWallisTest.Test(data), 4));
     }
 
@@ -150,5 +150,5 @@
                               ,-0.947125493,2.087444922,0.271276104,-1.027604792,-0.364097727,-0.741089219};
 
-      var result = KruskalWallis.Test(data);
+      var result = KruskalWallisTest.Test(data);
       Assert.IsTrue(result.IsAlmost(2.2E-16));
     }
@@ -167,5 +167,5 @@
                               ,2654,4588,3363,4750,1440,1892,3629,816,4317,34,2119,3290,1758 };
 
-      Assert.AreEqual(1, Math.Round(KruskalWallis.Test(data), 2));
+      Assert.AreEqual(1, Math.Round(KruskalWallisTest.Test(data), 2));
     }
   }
