Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -29,4 +29,5 @@
 using HeuristicLab.MainForm;
 using HeuristicLab.Optimization;
+using HeuristicLab.PluginInfrastructure;
 
 namespace HeuristicLab.Analysis.Statistics {
@@ -49,4 +50,10 @@
       InitializeComponent();
       stringConvertibleMatrixView.DataGridView.RowHeaderMouseDoubleClick += new DataGridViewCellMouseEventHandler(DataGridView_RowHeaderMouseDoubleClick);
+
+      var fittingAlgs = ApplicationManager.Manager.GetInstances<IFitting>();
+      foreach (var fit in fittingAlgs) {
+        fittingComboBox.Items.Add(fit);
+      }
+      fittingComboBox.SelectedIndex = 0;
     }
 
@@ -137,11 +144,7 @@
         DataRow row = resTable.Rows[rowName];
         var values = row.Values.ToArray();
-        double k, d;
-        LinearLeastSquaresFitting.Calculate(values, out k, out d);
-
-        DataRow newRow = new DataRow(row.Name + " Fitted Line");
-        for (int i = 0; i < values.Count(); i++) {
-          newRow.Values.Add(k * i + d);
-        }
+
+        var fittingAlg = fittingComboBox.SelectedItem as IFitting;
+        DataRow newRow = fittingAlg.CalculateFittedLine(values, row.Name + " (" + fittingAlg.ToString() + ")");
 
         if (!resTable.Rows.ContainsKey(newRow.Name))
@@ -224,6 +227,7 @@
         double percentile75 = values.Percentile(0.75);
         double k, d, r;
-        LinearLeastSquaresFitting.Calculate(values.ToArray(), out k, out d);
-        r = LinearLeastSquaresFitting.CalculateError(values.ToArray(), k, d);
+        LinearLeastSquaresFitting llsf = new LinearLeastSquaresFitting();
+        llsf.Calculate(values.ToArray(), out k, out d);
+        r = llsf.CalculateError(values.ToArray(), k, d);
         double lowerAvg = values.OrderBy(x => x).Take((int)(values.Count() * 0.25)).Average();
         double upperAvg = values.OrderByDescending(x => x).Take((int)(values.Count() * 0.25)).Average();
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.designer.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.designer.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.designer.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -34,27 +34,45 @@
     /// </summary>
     private void InitializeComponent() {
-      this.stringConvertibleMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
+      this.fittingComboBox = new System.Windows.Forms.ComboBox();
+      this.addValuesButton = new System.Windows.Forms.Button();
+      this.addLineToChart = new System.Windows.Forms.Button();
       this.dataRowComboBox = new System.Windows.Forms.ComboBox();
       this.label2 = new System.Windows.Forms.Label();
       this.label1 = new System.Windows.Forms.Label();
       this.dataTableComboBox = new System.Windows.Forms.ComboBox();
-      this.addLineToChart = new System.Windows.Forms.Button();
-      this.addValuesButton = new System.Windows.Forms.Button();
+      this.stringConvertibleMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
       this.SuspendLayout();
       // 
-      // stringConvertibleMatrixView
+      // fittingComboBox
       // 
-      this.stringConvertibleMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-      this.stringConvertibleMatrixView.Caption = "StringConvertibleMatrix View";
-      this.stringConvertibleMatrixView.Content = null;
-      this.stringConvertibleMatrixView.Location = new System.Drawing.Point(3, 59);
-      this.stringConvertibleMatrixView.Name = "stringConvertibleMatrixView";
-      this.stringConvertibleMatrixView.ReadOnly = true;
-      this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = true;
-      this.stringConvertibleMatrixView.ShowStatisticalInformation = true;
-      this.stringConvertibleMatrixView.Size = new System.Drawing.Size(492, 294);
-      this.stringConvertibleMatrixView.TabIndex = 0;
+      this.fittingComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+      this.fittingComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+      this.fittingComboBox.FormattingEnabled = true;
+      this.fittingComboBox.Location = new System.Drawing.Point(147, 359);
+      this.fittingComboBox.Name = "fittingComboBox";
+      this.fittingComboBox.Size = new System.Drawing.Size(200, 21);
+      this.fittingComboBox.TabIndex = 12;
+      // 
+      // addValuesButton
+      // 
+      this.addValuesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+      this.addValuesButton.Location = new System.Drawing.Point(8, 359);
+      this.addValuesButton.Name = "addValuesButton";
+      this.addValuesButton.Size = new System.Drawing.Size(133, 23);
+      this.addValuesButton.TabIndex = 10;
+      this.addValuesButton.Text = "Add Values to Results";
+      this.addValuesButton.UseVisualStyleBackColor = true;
+      this.addValuesButton.Click += new System.EventHandler(this.addValuesButton_Click);
+      // 
+      // addLineToChart
+      // 
+      this.addLineToChart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+      this.addLineToChart.Location = new System.Drawing.Point(353, 359);
+      this.addLineToChart.Name = "addLineToChart";
+      this.addLineToChart.Size = new System.Drawing.Size(133, 23);
+      this.addLineToChart.TabIndex = 9;
+      this.addLineToChart.Text = "Fit Line to Chart";
+      this.addLineToChart.UseVisualStyleBackColor = true;
+      this.addLineToChart.Click += new System.EventHandler(this.addLineToChart_Click);
       // 
       // dataRowComboBox
@@ -100,28 +118,22 @@
       this.dataTableComboBox.SelectedIndexChanged += new System.EventHandler(this.dataTableComboBox_SelectedIndexChanged);
       // 
-      // addLineToChart
+      // stringConvertibleMatrixView
       // 
-      this.addLineToChart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-      this.addLineToChart.Location = new System.Drawing.Point(353, 359);
-      this.addLineToChart.Name = "addLineToChart";
-      this.addLineToChart.Size = new System.Drawing.Size(133, 23);
-      this.addLineToChart.TabIndex = 9;
-      this.addLineToChart.Text = "Fit Line to Chart";
-      this.addLineToChart.UseVisualStyleBackColor = true;
-      this.addLineToChart.Click += new System.EventHandler(this.addLineToChart_Click);
-      // 
-      // addValuesButton
-      // 
-      this.addValuesButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-      this.addValuesButton.Location = new System.Drawing.Point(214, 359);
-      this.addValuesButton.Name = "addValuesButton";
-      this.addValuesButton.Size = new System.Drawing.Size(133, 23);
-      this.addValuesButton.TabIndex = 10;
-      this.addValuesButton.Text = "Add Values to Results";
-      this.addValuesButton.UseVisualStyleBackColor = true;
-      this.addValuesButton.Click += new System.EventHandler(this.addValuesButton_Click);
+      this.stringConvertibleMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
+            | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.stringConvertibleMatrixView.Caption = "StringConvertibleMatrix View";
+      this.stringConvertibleMatrixView.Content = null;
+      this.stringConvertibleMatrixView.Location = new System.Drawing.Point(3, 59);
+      this.stringConvertibleMatrixView.Name = "stringConvertibleMatrixView";
+      this.stringConvertibleMatrixView.ReadOnly = true;
+      this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = true;
+      this.stringConvertibleMatrixView.ShowStatisticalInformation = true;
+      this.stringConvertibleMatrixView.Size = new System.Drawing.Size(492, 294);
+      this.stringConvertibleMatrixView.TabIndex = 0;
       // 
       // ChartAnalysisView
       // 
+      this.Controls.Add(this.fittingComboBox);
       this.Controls.Add(this.addValuesButton);
       this.Controls.Add(this.addLineToChart);
@@ -146,4 +158,5 @@
     private System.Windows.Forms.Button addLineToChart;
     private System.Windows.Forms.Button addValuesButton;
+    private System.Windows.Forms.ComboBox fittingComboBox;
   }
 }
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.designer.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.designer.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/CorrelationView.designer.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ExpFitting.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ExpFitting.cs	(revision 9706)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ExpFitting.cs	(revision 9706)
@@ -0,0 +1,98 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 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 LogFunc(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, 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 };
+      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[0];
+    }
+
+    public DataRow CalculateFittedLine(double[] dataPoints, string rowName) {
+      DataRow newRow = new DataRow(rowName);
+      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(Math.Exp(-c0 * Math.Pow(stdX[i], 2)));
+      }
+
+      return newRow;
+    }
+
+    public DataRow CalculateFittedLine(double[] y, double[] x, string rowName) {
+      DataRow newRow = new DataRow(rowName);
+      double c0, c1;
+      Calculate(y, x, out c0, out c1);
+
+      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/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 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/HeuristicLab.Analysis.Statistics-3.3.csproj	(revision 9706)
@@ -114,5 +114,8 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ExpFitting.cs" />
+    <Compile Include="IFitting.cs" />
     <Compile Include="LinearLeastSquaresFitting.cs" />
+    <Compile Include="LogFitting.cs" />
     <Compile Include="Resources.Designer.cs">
       <AutoGen>True</AutoGen>
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/IFitting.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/IFitting.cs	(revision 9706)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/IFitting.cs	(revision 9706)
@@ -0,0 +1,30 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 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 {
+    void Calculate(double[] dataPoints, out double p0, out double p1);
+    void Calculate(double[] y, double[] x, out double p0, out double p1);
+
+    DataRow CalculateFittedLine(double[] dataPoints, string rowName);
+    DataRow CalculateFittedLine(double[] y, double[] x, string rowName);
+  }
+}
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/KruskalWallis.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/KruskalWallis.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/KruskalWallis.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/LinearLeastSquaresFitting.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/LinearLeastSquaresFitting.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/LinearLeastSquaresFitting.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -24,10 +24,19 @@
 
 namespace HeuristicLab.Analysis.Statistics {
-  public class LinearLeastSquaresFitting {
-    public static void Calculate(double[] dataPoints, out double a1, out double a0) {
+  public class LinearLeastSquaresFitting : IFitting {
+    public void Calculate(double[] dataPoints, out double p0, out double p1) {
+      var stdX = Enumerable.Range(0, dataPoints.Count()).Select(x => (double)x).ToArray();
+      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 sxy = 0.0;
       double sxx = 0.0;
-      int n = dataPoints.Count();
-      double sy = dataPoints.Sum();
+      int n = y.Count();
+      double sy = y.Sum();
       double sx = ((n - 1) * n) / 2;
       double avgy = sy / n;
@@ -35,13 +44,14 @@
 
       for (int i = 0; i < n; i++) {
-        sxy += i * dataPoints[i];
-        sxx += i * i;
+        sxy += x[i] * y[i];
+        sxx += x[i] * x[i];
       }
 
-      a1 = (sxy - (n * avgx * avgy)) / (sxx - (n * avgx * avgx));
-      a0 = avgy - a1 * avgx;
+      p0 = (sxy - (n * avgx * avgy)) / (sxx - (n * avgx * avgx));
+      p1 = avgy - p0 * avgx;
     }
 
-    public static double CalculateError(double[] dataPoints, double a1, double a0) {
+    //TODO: adapt or remove
+    public double CalculateError(double[] dataPoints, double a1, double a0) {
       double r = 0.0;
       double avgy = dataPoints.Average();
@@ -58,4 +68,32 @@
       return r;
     }
+
+    public DataRow CalculateFittedLine(double[] y, double[] x, string rowName) {
+      double k, d;
+      Calculate(y, x, out k, out d);
+
+      DataRow newRow = new DataRow(rowName);
+      for (int i = 0; i < x.Count(); i++) {
+        newRow.Values.Add(k * x[i] + d);
+      }
+      return newRow;
+    }
+
+    public DataRow CalculateFittedLine(double[] dataPoints, string rowName) {
+      DataRow newRow = new DataRow(rowName);
+      double c0, c1;
+      Calculate(dataPoints, out c0, out c1);
+      var stdX = Enumerable.Range(0, dataPoints.Count()).Select(x => (double)x).ToArray();
+
+      for (int i = 0; i < stdX.Count(); i++) {
+        newRow.Values.Add(c0 * stdX[i] + c1);
+      }
+
+      return newRow;
+    }
+
+    public override string ToString() {
+      return "Linear Fitting";
+    }
   }
 }
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/LogFitting.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/LogFitting.cs	(revision 9706)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/LogFitting.cs	(revision 9706)
@@ -0,0 +1,98 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 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] * System.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, string rowName) {
+      DataRow newRow = new DataRow(rowName);
+      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 * System.Math.Exp(c1 / stdX[i]));
+      }
+
+      return newRow;
+    }
+
+    public DataRow CalculateFittedLine(double[] y, double[] x, string rowName) {
+      DataRow newRow = new DataRow(rowName);
+      double c0, c1;
+      Calculate(y, x, out c0, out c1);
+
+      for (int i = 0; i < x.Count(); i++) {
+        newRow.Values.Add(c0 * System.Math.Exp(c1 / x[i]));
+      }
+
+      return newRow;
+    }
+
+    public override string ToString() {
+      return "Logarithmic Fitting";
+    }
+  }
+}
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/Plugin.cs.frame
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/Plugin.cs.frame	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/Plugin.cs.frame	(revision 9706)
@@ -1,5 +1,5 @@
 #region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/Properties/AssemblyInfo.cs.frame
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/Properties/AssemblyInfo.cs.frame	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/Properties/AssemblyInfo.cs.frame	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
@@ -32,5 +32,5 @@
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("HeuristicLab")]
-[assembly: AssemblyCopyright("(c) 2002-2012 HEAL")]
+[assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeChecker.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeChecker.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeChecker.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeChecker.designer.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeChecker.designer.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeChecker.designer.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.Designer.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.Designer.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.Designer.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.designer.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.designer.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.designer.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/TTest.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/TTest.cs	(revision 9705)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/TTest.cs	(revision 9706)
@@ -1,5 +1,5 @@
 ﻿#region License Information
 /* HeuristicLab
- * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
  *
  * This file is part of HeuristicLab.
