Index: branches/ALPS/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalysis/AlleleFrequencyAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalysis/AlleleFrequencyAnalyzer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/AlleleFrequencyAnalysis/AlleleFrequencyAnalyzer.cs	(revision 11975)
@@ -37,5 +37,5 @@
   [Item("AlleleFrequencyAnalyzer", "An operator for analyzing the frequency of alleles.")]
   [StorableClass]
-  public abstract class AlleleFrequencyAnalyzer<T> : SingleSuccessorOperator, IAnalyzer where T : class, IItem {
+  public abstract class AlleleFrequencyAnalyzer<T> : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator where T : class, IItem {
     public virtual bool EnabledByDefault {
       get { return false; }
Index: branches/ALPS/HeuristicLab.Analysis/3.3/BestScopeSolutionAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/BestScopeSolutionAnalyzer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/BestScopeSolutionAnalyzer.cs	(revision 11975)
@@ -37,5 +37,5 @@
   [Item("BestScopeSolutionAnalyzer", "An operator that extracts the scope containing the best quality.")]
   [StorableClass]
-  public class BestScopeSolutionAnalyzer : SingleSuccessorOperator, IAnalyzer {
+  public class BestScopeSolutionAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator {
 
     public virtual bool EnabledByDefault {
@@ -73,6 +73,11 @@
     [StorableHook(HookType.AfterDeserialization)]
     private void AfterDeserialization() {
+      // BackwardsCompatibility3.3
+      #region Backwards compatible code, remove with 3.4
       if (!Parameters.ContainsKey("BestSolution ResultName"))
         Parameters.Add(new FixedValueParameter<StringValue>("BestSolution ResultName", "The name of the result for storing the best solution.", new StringValue("Best Solution")));
+      if (Parameters.ContainsKey("BestSolution")) Parameters.Remove("BestSolution");
+      if (Parameters.ContainsKey("BestKnownSolution")) Parameters.Remove("BestKnownSolution");
+      #endregion
     }
     #endregion
@@ -114,5 +119,6 @@
       if (!results.ContainsKey(BestSolutionResultName)) {
         var cloner = new Cloner();
-        //avoid cloning of subscopes
+        //avoid cloning of subscopes and the results collection that the solution is put in
+        cloner.RegisterClonedObject(results, new ResultCollection());
         cloner.RegisterClonedObject(currentBestScope.SubScopes, new ScopeList());
         var solution = cloner.Clone(currentBestScope);
@@ -127,5 +133,6 @@
               || !max && qualities[i].Value < bestQuality) {
             var cloner = new Cloner();
-            //avoid cloning of subscopes
+            //avoid cloning of subscopes and the results collection that the solution is put in
+            cloner.RegisterClonedObject(results, new ResultCollection());
             cloner.RegisterClonedObject(currentBestScope.SubScopes, new ScopeList());
             var solution = cloner.Clone(currentBestScope);
Index: branches/ALPS/HeuristicLab.Analysis/3.3/DataVisualization/DataRow.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/DataVisualization/DataRow.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/DataVisualization/DataRow.cs	(revision 11975)
@@ -76,4 +76,5 @@
       this.values = new ObservableList<double>(original.values);
     }
+    public DataRow() : this("DataRow") { }
     public DataRow(string name)
       : base(name) {
@@ -116,4 +117,8 @@
       OnVisualPropertiesChanged();
     }
+    protected override void OnNameChanged() {
+      base.OnNameChanged();
+      VisualProperties.DisplayName = Name;
+    }
   }
 }
Index: branches/ALPS/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/HeuristicLab.Analysis-3.3.csproj	(revision 11975)
@@ -159,5 +159,14 @@
     <Compile Include="QualityAnalysis\QualityDistributionAnalyzer.cs" />
     <Compile Include="QualityAnalysis\ScaledQualityDifferenceAnalyzer.cs" />
+    <Compile Include="Statistics\BonferroniHolm.cs" />
+    <Compile Include="Statistics\EnumerableStatisticsExtension.cs" />
+    <Compile Include="Statistics\Fitting\ExpFitting.cs" />
+    <Compile Include="Statistics\Fitting\IFitting.cs" />
+    <Compile Include="Statistics\KruskalWallisTest.cs" />
+    <Compile Include="Statistics\Fitting\LinearLeastSquaresFitting.cs" />
+    <Compile Include="Statistics\Fitting\LogFitting.cs" />
     <Compile Include="Statistics\NormalDistribution.cs" />
+    <Compile Include="Statistics\PairwiseTest.cs" />
+    <Compile Include="Statistics\SampleSizeDetermination.cs" />
     <Compile Include="ValueAnalysis\SingleValueAnalyzer.cs" />
     <Compile Include="ValueAnalysis\MinAverageMaxValueAnalyzer.cs" />
Index: branches/ALPS/HeuristicLab.Analysis/3.3/MultiObjective/ParetoFrontAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/MultiObjective/ParetoFrontAnalyzer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/MultiObjective/ParetoFrontAnalyzer.cs	(revision 11975)
@@ -31,5 +31,5 @@
   [Item("ParetoFrontAnalyzer", "Analyzer for multiobjective problems that collects and presents the current Pareto front as double matrix as well as the solution scopes that lie on the current front.")]
   [StorableClass]
-  public abstract class ParetoFrontAnalyzer : SingleSuccessorOperator, IAnalyzer {
+  public abstract class ParetoFrontAnalyzer : SingleSuccessorOperator, IAnalyzer, IMultiObjectiveOperator {
     public virtual bool EnabledByDefault {
       get { return true; }
Index: branches/ALPS/HeuristicLab.Analysis/3.3/PopulationDiversityAnalysis/PopulationDiversityAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/PopulationDiversityAnalysis/PopulationDiversityAnalyzer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/PopulationDiversityAnalysis/PopulationDiversityAnalyzer.cs	(revision 11975)
@@ -40,5 +40,5 @@
   [Item("PopulationDiversityAnalyzer", "An operator for analyzing the solution diversity in a population.")]
   [StorableClass]
-  public abstract class PopulationDiversityAnalyzer<T> : SingleSuccessorOperator, IAnalyzer where T : class, IItem {
+  public abstract class PopulationDiversityAnalyzer<T> : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator where T : class, IItem {
     public virtual bool EnabledByDefault {
       get { return false; }
Index: branches/ALPS/HeuristicLab.Analysis/3.3/PopulationDiversityAnalysis/SingleObjectivePopulationDiversityAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/PopulationDiversityAnalysis/SingleObjectivePopulationDiversityAnalyzer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/PopulationDiversityAnalysis/SingleObjectivePopulationDiversityAnalyzer.cs	(revision 11975)
@@ -36,5 +36,5 @@
   [Item("SingleObjectivePopulationDiversityAnalyzer", "An operator for analyzing the solution diversity in a population.")]
   [StorableClass]
-  public class SingleObjectivePopulationDiversityAnalyzer : SingleSuccessorOperator, IAnalyzer, ISimilarityBasedOperator {
+  public class SingleObjectivePopulationDiversityAnalyzer : SingleSuccessorOperator, IAnalyzer, ISimilarityBasedOperator, ISingleObjectiveOperator {
     #region ISimilarityBasedOperator Members
     [Storable]
Index: branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/BestAverageWorstQualityAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/BestAverageWorstQualityAnalyzer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/BestAverageWorstQualityAnalyzer.cs	(revision 11975)
@@ -36,5 +36,5 @@
   [Item("BestAverageWorstQualityAnalyzer", "An operator which analyzes the best, average and worst quality of solutions in the scope tree.")]
   [StorableClass]
-  public sealed class BestAverageWorstQualityAnalyzer : AlgorithmOperator, IAnalyzer {
+  public sealed class BestAverageWorstQualityAnalyzer : AlgorithmOperator, IAnalyzer, ISingleObjectiveOperator {
     #region Parameter properties
     public ValueLookupParameter<BoolValue> MaximizationParameter {
Index: branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/BestAverageWorstQualityCalculator.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/BestAverageWorstQualityCalculator.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/BestAverageWorstQualityCalculator.cs	(revision 11975)
@@ -24,4 +24,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -33,5 +34,5 @@
   [Item("BestAverageWorstQualityCalculator", "An operator which calculates the best, average and worst quality of solutions in the scope tree.")]
   [StorableClass]
-  public sealed class BestAverageWorstQualityCalculator : SingleSuccessorOperator {
+  public sealed class BestAverageWorstQualityCalculator : SingleSuccessorOperator, ISingleObjectiveOperator {
     public ValueLookupParameter<BoolValue> MaximizationParameter {
       get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
Index: branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/BestQualityMemorizer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/BestQualityMemorizer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/BestQualityMemorizer.cs	(revision 11975)
@@ -24,4 +24,5 @@
 using HeuristicLab.Data;
 using HeuristicLab.Operators;
+using HeuristicLab.Optimization;
 using HeuristicLab.Parameters;
 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
@@ -33,5 +34,5 @@
   [Item("BestQualityMemorizer", "An operator that updates the best quality found so far with those qualities contained in the scope tree.")]
   [StorableClass]
-  public class BestQualityMemorizer : SingleSuccessorOperator {
+  public class BestQualityMemorizer : SingleSuccessorOperator, ISingleObjectiveOperator {
     public ValueLookupParameter<BoolValue> MaximizationParameter {
       get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
Index: branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityAnalyzer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityAnalyzer.cs	(revision 11975)
@@ -36,5 +36,5 @@
   [Item("QualityAnalyzer", "An operator which analyzes the quality of solutions in the scope tree.")]
   [StorableClass]
-  public sealed class QualityAnalyzer : AlgorithmOperator, IAnalyzer {
+  public sealed class QualityAnalyzer : AlgorithmOperator, IAnalyzer, ISingleObjectiveOperator {
     #region Parameter properties
     public ValueLookupParameter<BoolValue> MaximizationParameter {
Index: branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityDistributionAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityDistributionAnalyzer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/QualityDistributionAnalyzer.cs	(revision 11975)
@@ -32,5 +32,5 @@
   [Item("QualityDistributionAnalyzer", "Analyzes the distribution of the quality values in that it adds a Histogram of them into the result collection.")]
   [StorableClass]
-  public class QualityDistributionAnalyzer : SingleSuccessorOperator, IAnalyzer, IIterationBasedOperator {
+  public class QualityDistributionAnalyzer : SingleSuccessorOperator, IAnalyzer, IIterationBasedOperator, ISingleObjectiveOperator {
 
     #region Parameter properties
Index: branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/ScaledQualityDifferenceAnalyzer.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/ScaledQualityDifferenceAnalyzer.cs	(revision 11677)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/QualityAnalysis/ScaledQualityDifferenceAnalyzer.cs	(revision 11975)
@@ -33,5 +33,5 @@
 A value towards 0 always means that it's closer to the better fitness value, while a value towards 1 means that it's closer to the worse fitness value.")]
   [StorableClass]
-  public class ScaledQualityDifferenceAnalyzer : SingleSuccessorOperator, IAnalyzer {
+  public class ScaledQualityDifferenceAnalyzer : SingleSuccessorOperator, IAnalyzer, ISingleObjectiveOperator {
     public virtual bool EnabledByDefault {
       get { return true; }
Index: branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/BonferroniHolm.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/BonferroniHolm.cs	(revision 11975)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/BonferroniHolm.cs	(revision 11975)
@@ -0,0 +1,66 @@
+﻿#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;
+using System.Linq;
+
+namespace HeuristicLab.Analysis.Statistics {
+  public static class BonferroniHolm {
+    /// <summary>
+    /// Based on David Groppe's MATLAB implementation 
+    /// (BSD licensed, see 
+    /// http://www.mathworks.com/matlabcentral/fileexchange/28303-bonferroni-holm-correction-for-multiple-comparisons)
+    /// </summary>
+    public static double[] Calculate(double globalAlpha, double[] pValues, out bool[] h) {
+      int k = pValues.Length;
+      double[] alphaNiveau = new double[k];
+      double[] adjustedPValues = new double[k];
+      bool[] decision = new bool[k];
+      Dictionary<int, double> pValuesIndizes = new Dictionary<int, double>();
+
+      for (int i = 0; i < k; i++) {
+        pValuesIndizes.Add(i, pValues[i]);
+      }
+      var sortedPValues = pValuesIndizes.OrderBy(x => x.Value).ToArray();
+
+      for (int i = 1; i < k + 1; i++) {
+        alphaNiveau[i - 1] = globalAlpha / (k - i + 1);
+        int idx = sortedPValues[i - 1].Key;
+
+        if (i == 1) {
+          //true means reject
+          decision[idx] = sortedPValues[i - 1].Value < alphaNiveau[i - 1];
+          adjustedPValues[idx] = sortedPValues[i - 1].Value * (k - i + 1);
+        } else {
+          decision[idx] = decision[sortedPValues[i - 2].Key] && (sortedPValues[i - 1].Value < alphaNiveau[i - 1]);
+          adjustedPValues[idx] = Math.Max(adjustedPValues[sortedPValues[i - 2].Key], sortedPValues[i - 1].Value * (k - i + 1));
+        }
+        if (adjustedPValues[idx] > 1.0) {
+          adjustedPValues[idx] = 1.0;
+        }
+      }
+
+      h = decision;
+      return adjustedPValues;
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/EnumerableStatisticsExtension.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/EnumerableStatisticsExtension.cs	(revision 11975)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/EnumerableStatisticsExtension.cs	(revision 11975)
@@ -0,0 +1,48 @@
+﻿#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;
+using System.Linq;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Analysis.Statistics {
+  public static class EnumerableStatisticExtensions {
+    public static Tuple<double, double> ConfidenceIntervals(this IEnumerable<double> values, double alpha) {
+      return ConfidenceIntervals(values.ToArray(), alpha);
+    }
+
+    public static Tuple<double, double> ConfidenceIntervals(this double[] values, double alpha) {
+      double lower, upper;
+      int n = values.Length;
+      if (n <= 1) return new Tuple<double, double>(double.NaN, double.NaN);
+
+      double s = values.StandardDeviation();
+      double x = values.Average();
+      double t = alglib.invstudenttdistribution(n - 1, (1.0 - alpha) / 2.0);
+
+      lower = x + t * (s / Math.Sqrt(n));
+      upper = x - t * (s / Math.Sqrt(n));
+
+      return new Tuple<double, double>(lower, upper);
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/ExpFitting.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/ExpFitting.cs	(revision 11975)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/ExpFitting.cs	(revision 11975)
@@ -0,0 +1,97 @@
+﻿#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.Linq;
+
+namespace HeuristicLab.Analysis.Statistics {
+  public class ExpFitting : IFitting {
+    private void ExpFunc(double[] c, double[] x, ref double func, object obj) {
+      func = Math.Exp(-c[0] * Math.Pow(x[0], 2));
+    }
+
+    private double[] GetDefaultXValues(int n) {
+      var stdX = Enumerable.Range(1, n).Select(x => (double)x).ToArray();
+      return stdX;
+    }
+
+    public void Calculate(double[] dataPoints, out double p0) {
+      var stdX = GetDefaultXValues(dataPoints.Count());
+      Calculate(dataPoints, stdX, out p0);
+    }
+
+    public void Calculate(double[] y, double[] x, out double p0) {
+      if (y.Count() != x.Count()) {
+        throw new ArgumentException("The lenght of x and y needs do be equal. ");
+      }
+
+      double[] c = new double[] { 0.3 };
+      double epsf = 0;
+      double epsx = 0.000001;
+      int maxits = 0;
+      int info;
+      alglib.lsfitstate state;
+      alglib.lsfitreport rep;
+      double diffstep = 0.0001;
+      double[,] xx = new double[x.Count(), 1];
+
+      for (int i = 0; i < x.Count(); i++) {
+        xx[i, 0] = x[i];
+      }
+
+      alglib.lsfitcreatef(xx, y, c, diffstep, out state);
+      alglib.lsfitsetcond(state, epsf, epsx, maxits);
+      alglib.lsfitfit(state, ExpFunc, null, null);
+      alglib.lsfitresults(state, out info, out c, out rep);
+
+      p0 = c[0];
+    }
+
+    public DataRow CalculateFittedLine(double[] dataPoints) {
+      DataRow newRow = new DataRow();
+      double c0;
+      Calculate(dataPoints, out c0);
+      var stdX = GetDefaultXValues(dataPoints.Count());
+
+      for (int i = 0; i < stdX.Count(); i++) {
+        newRow.Values.Add(Math.Exp(-c0 * Math.Pow(stdX[i], 2)));
+      }
+
+      return newRow;
+    }
+
+    public DataRow CalculateFittedLine(double[] y, double[] x) {
+      DataRow newRow = new DataRow();
+      double c0;
+      Calculate(y, x, out c0);
+
+      for (int i = 0; i < x.Count(); i++) {
+        newRow.Values.Add(Math.Exp(-c0 * Math.Pow(x[i], 2)));
+      }
+
+      return newRow;
+    }
+
+    public override string ToString() {
+      return "Exponential Fitting";
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/IFitting.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/IFitting.cs	(revision 11975)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/IFitting.cs	(revision 11975)
@@ -0,0 +1,27 @@
+﻿#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 interface IFitting {
+    DataRow CalculateFittedLine(double[] dataPoints);
+    DataRow CalculateFittedLine(double[] y, double[] x);
+  }
+}
Index: branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/LinearLeastSquaresFitting.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/LinearLeastSquaresFitting.cs	(revision 11975)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/LinearLeastSquaresFitting.cs	(revision 11975)
@@ -0,0 +1,98 @@
+﻿#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.Linq;
+
+namespace HeuristicLab.Analysis.Statistics {
+  public class LinearLeastSquaresFitting : IFitting {
+    public void Calculate(double[] dataPoints, out double slope, out double intercept) {
+      var stdX = Enumerable.Range(0, dataPoints.Count()).Select(x => (double)x).ToArray();
+      Calculate(dataPoints, stdX, out slope, out intercept);
+    }
+
+    public void Calculate(double[] y, double[] x, out double slope, out double intercept) {
+      if (y.Count() != x.Count()) {
+        throw new ArgumentException("The lenght of x and y needs do be equal. ");
+      }
+
+      double sxy = 0.0;
+      double sxx = 0.0;
+      int n = y.Count();
+      double sy = y.Sum();
+      double sx = ((n - 1) * n) / 2.0;
+      double avgy = sy / n;
+      double avgx = sx / n;
+
+      for (int i = 0; i < n; i++) {
+        sxy += x[i] * y[i];
+        sxx += x[i] * x[i];
+      }
+
+      slope = (sxy - (n * avgx * avgy)) / (sxx - (n * avgx * avgx));
+      intercept = avgy - slope * avgx;
+    }
+
+    public double CalculateError(double[] dataPoints, double slope, double intercept) {
+      double r;
+      double avgy = dataPoints.Average();
+      double sstot = 0.0;
+      double sserr = 0.0;
+
+      for (int i = 0; i < dataPoints.Count(); i++) {
+        double y = slope * i + intercept;
+        sstot += Math.Pow(dataPoints[i] - avgy, 2);
+        sserr += Math.Pow(dataPoints[i] - y, 2);
+      }
+
+      r = 1.0 - (sserr / sstot);
+      return r;
+    }
+
+    public DataRow CalculateFittedLine(double[] y, double[] x) {
+      double slope, intercept;
+      Calculate(y, x, out slope, out intercept);
+
+      DataRow newRow = new DataRow();
+      for (int i = 0; i < x.Count(); i++) {
+        newRow.Values.Add(slope * x[i] + intercept);
+      }
+      return newRow;
+    }
+
+    public DataRow CalculateFittedLine(double[] dataPoints) {
+      DataRow newRow = new DataRow();
+      double slope, intercept;
+      Calculate(dataPoints, out slope, out intercept);
+      var stdX = Enumerable.Range(0, dataPoints.Count()).Select(x => (double)x).ToArray();
+
+      for (int i = 0; i < stdX.Count(); i++) {
+        newRow.Values.Add(slope * stdX[i] + intercept);
+      }
+
+      return newRow;
+    }
+
+    public override string ToString() {
+      return "Linear Fitting";
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/LogFitting.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/LogFitting.cs	(revision 11975)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/Fitting/LogFitting.cs	(revision 11975)
@@ -0,0 +1,98 @@
+﻿#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.Linq;
+
+namespace HeuristicLab.Analysis.Statistics {
+  public class LogFitting : IFitting {
+    private void LogFunc(double[] c, double[] x, ref double func, object obj) {
+      func = c[0] * Math.Exp(c[1] / x[0]);
+    }
+
+    private double[] GetDefaultXValues(int n) {
+      var stdX = Enumerable.Range(1, n).Select(x => (double)x).ToArray();
+      return stdX;
+    }
+
+    public void Calculate(double[] dataPoints, out double p0, out double p1) {
+      var stdX = GetDefaultXValues(dataPoints.Count());
+      Calculate(dataPoints, stdX, out p0, out p1);
+    }
+
+    public void Calculate(double[] y, double[] x, out double p0, out double p1) {
+      if (y.Count() != x.Count()) {
+        throw new ArgumentException("The lenght of x and y needs do be equal. ");
+      }
+
+      double[] c = new double[] { 0.3, 0.3 };
+      double epsf = 0;
+      double epsx = 0.000001;
+      int maxits = 0;
+      int info;
+      alglib.lsfitstate state;
+      alglib.lsfitreport rep;
+      double diffstep = 0.0001;
+      double[,] xx = new double[x.Count(), 1];
+
+      for (int i = 0; i < x.Count(); i++) {
+        xx[i, 0] = x[i];
+      }
+
+      alglib.lsfitcreatef(xx, y, c, diffstep, out state);
+      alglib.lsfitsetcond(state, epsf, epsx, maxits);
+      alglib.lsfitfit(state, LogFunc, null, null);
+      alglib.lsfitresults(state, out info, out c, out rep);
+
+      p0 = c[0];
+      p1 = c[1];
+    }
+
+    public DataRow CalculateFittedLine(double[] dataPoints) {
+      DataRow newRow = new DataRow();
+      double c0, c1;
+      Calculate(dataPoints, out c0, out c1);
+      var stdX = GetDefaultXValues(dataPoints.Count());
+
+      for (int i = 0; i < stdX.Count(); i++) {
+        newRow.Values.Add(c0 * Math.Exp(c1 / stdX[i]));
+      }
+
+      return newRow;
+    }
+
+    public DataRow CalculateFittedLine(double[] y, double[] x) {
+      DataRow newRow = new DataRow();
+      double c0, c1;
+      Calculate(y, x, out c0, out c1);
+
+      for (int i = 0; i < x.Count(); i++) {
+        newRow.Values.Add(c0 * Math.Exp(c1 / x[i]));
+      }
+
+      return newRow;
+    }
+
+    public override string ToString() {
+      return "Logarithmic Fitting";
+    }
+  }
+}
Index: branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/KruskalWallisTest.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/KruskalWallisTest.cs	(revision 11975)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/KruskalWallisTest.cs	(revision 11975)
@@ -0,0 +1,151 @@
+﻿#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;
+using HeuristicLab.Common;
+
+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.IsAlmost(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.IsAlmost(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/ALPS/HeuristicLab.Analysis/3.3/Statistics/PairwiseTest.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/PairwiseTest.cs	(revision 11975)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/PairwiseTest.cs	(revision 11975)
@@ -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/ALPS/HeuristicLab.Analysis/3.3/Statistics/SampleSizeDetermination.cs
===================================================================
--- branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/SampleSizeDetermination.cs	(revision 11975)
+++ branches/ALPS/HeuristicLab.Analysis/3.3/Statistics/SampleSizeDetermination.cs	(revision 11975)
@@ -0,0 +1,95 @@
+﻿#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.Linq;
+using HeuristicLab.Common;
+
+namespace HeuristicLab.Analysis.Statistics {
+  public static class SampleSizeDetermination {
+    /// <summary>
+    /// Determines for a given sample the required sample size as described in 
+    /// Göran Kauermann, Helmut Küchenhoff: Stichproben: Methoden und praktische Umsetzung mit R, section 2.27. 
+    /// </summary>
+    /// <param name="samples">The pilot sample.</param>
+    /// <param name="conf">Confidence Interval.</param>
+    /// <returns>Number of required samples for the given confidence interval. </returns>
+    public static int DetermineSampleSizeByEstimatingMean(double[] samples, double conf = 0.95) {
+      if (conf < 0.0 || conf > 1.0) throw new ArgumentException("The confidence interval must be between zero and one.");
+
+      var confInterval = samples.ConfidenceIntervals(conf);
+      double e = (confInterval.Item2 - confInterval.Item1) / 2;
+      double s = samples.StandardDeviation();
+      double z = alglib.invnormaldistribution((conf + 1) / 2);
+      double n = samples.Count();
+
+      double result = Math.Pow(s, 2) / ((Math.Pow(e, 2) / Math.Pow(z, 2)) + (Math.Pow(s, 2) / n));
+
+      result = Math.Ceiling(result);
+      if (result > int.MaxValue)
+        return int.MaxValue;
+      else
+        return (int)result;
+    }
+
+    /// <summary>
+    /// Calculates Cohen's d.
+    /// </summary>
+    /// <returns>Cohen's d. 
+    /// d = 0.2 means small effect
+    /// d = 0.5 means medium effect
+    /// d = 0.8 means big effect
+    /// According to Wikipedia this means: "A lower Cohen's d indicates a necessity of larger sample sizes, and vice versa."
+    /// </returns>
+    public static double CalculateCohensD(double[] d1, double[] d2) {
+      double x1, x2, s1, s2;
+
+      x1 = d1.Average();
+      x2 = d2.Average();
+      s1 = d1.Variance();
+      s2 = d2.Variance();
+
+      return Math.Abs(x1 - x2) / Math.Sqrt((s1 + s2) / 2);
+    }
+
+    /// <summary>
+    /// Calculates Hedges' g. 
+    /// Hedges' g works like Cohen's d but corrects for bias. 
+    /// </summary>
+    /// <returns>Hedges' g</returns>
+    public static double CalculateHedgesG(double[] d1, double[] d2) {
+      double x1, x2, s1, s2, n1, n2, s, g, c;
+
+      x1 = d1.Average();
+      x2 = d2.Average();
+      s1 = d1.Variance();
+      s2 = d2.Variance();
+      n1 = d1.Count();
+      n2 = d2.Count();
+
+      s = Math.Sqrt(((n1 - 1) * s1 + (n2 - 1) * s2) / (n1 + n2 - 2));
+      g = Math.Abs(x1 - x2) / s;
+      c = (1 - (3 / (4 * (n1 + n2) - 9))) * g;
+
+      return c;
+    }
+  }
+}
