Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views-3.3.csproj
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views-3.3.csproj	(revision 9316)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views-3.3.csproj	(revision 9317)
@@ -119,4 +119,10 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="StatisticalTestingView.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="StatisticalTestingView.designer.cs">
+      <DependentUpon>StatisticalTestingView.cs</DependentUpon>
+    </Compile>
     <Compile Include="KruskalWallis.cs" />
     <Compile Include="ResultCorrelationView.cs">
Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/StatisticalTestingView.cs
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/StatisticalTestingView.cs	(revision 9317)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/StatisticalTestingView.cs	(revision 9317)
@@ -0,0 +1,171 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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 System.Windows.Forms;
+using HeuristicLab.Analysis.AlgorithmBehavior.Analyzers;
+using HeuristicLab.Core.Views;
+using HeuristicLab.Data;
+using HeuristicLab.MainForm;
+using HeuristicLab.Optimization;
+
+namespace HeuristicLab.Analysis.AlgorithmBehavior.Views {
+  [View("Statistical Testing View")]
+  [Content(typeof(RunCollection), false)]
+  public sealed partial class StatisticalTestingView : ItemView {
+    private double[][] data;
+
+    public StatisticalTestingView() {
+      InitializeComponent();
+    }
+
+    public new RunCollection Content {
+      get { return (RunCollection)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public override bool ReadOnly {
+      get { return true; }
+      set { /*not needed because results are always readonly */}
+    }
+
+    protected override void OnContentChanged() {
+      base.OnContentChanged();
+
+      if (Content != null) {
+        UpdateResultComboBox();
+        UpdateGroupsComboBox();
+        RebuildDataTable();
+      }
+    }
+
+    #region events
+    protected override void RegisterContentEvents() {
+      base.RegisterContentEvents();
+    }
+
+    protected override void DeregisterContentEvents() {
+      base.DeregisterContentEvents();
+    }
+    #endregion
+
+
+    private void UpdateGroupsComboBox() {
+      groupComboBox.Items.Clear();
+
+      var parameters = (from run in Content
+                        from param in run.Parameters
+                        select param.Key).Distinct().ToArray();
+
+      foreach (var p in parameters) {
+        var variations = (from run in Content
+                          where run.Parameters.ContainsKey(p) &&
+                          (run.Parameters[p] is IntValue || run.Parameters[p] is DoubleValue ||
+                          run.Parameters[p] is StringValue || run.Parameters[p] is BoolValue)
+                          select ((dynamic)run.Parameters[p]).Value).Distinct();
+
+        if (variations.Count() > 1) {
+          groupComboBox.Items.Add(p);
+        }
+      }
+      if (groupComboBox.Items.Count > 0) groupComboBox.SelectedItem = groupComboBox.Items[0];
+    }
+
+    private string[] GetColumnNames(IEnumerable<IRun> runs) {
+      string parameterName = (string)groupComboBox.SelectedItem;
+      var r = runs.Where(x => x.Parameters.ContainsKey(parameterName));
+      return r.Select(x => ((dynamic)x.Parameters[parameterName]).Value).Distinct().Select(x => (string)x.ToString()).ToArray();
+    }
+
+    private void UpdateResultComboBox() {
+      resultComboBox.Items.Clear();
+      var results = (from run in Content
+                     from result in run.Results
+                     where result.Value is IntValue || result.Value is DoubleValue
+                     select result.Key).Distinct().ToArray();
+
+      resultComboBox.Items.AddRange(results);
+      if (resultComboBox.Items.Count > 0) resultComboBox.SelectedItem = resultComboBox.Items[0];
+    }
+
+    private void RebuildDataTable() {
+      string parameterName = (string)groupComboBox.SelectedItem;
+      if (parameterName != null) {
+        string resultName = (string)resultComboBox.SelectedItem;
+
+        var runs = Content.Where(x => x.Results.ContainsKey(resultName) && x.Visible);
+        var columnNames = GetColumnNames(runs);
+        var groups = GetGroups(columnNames, runs);
+        data = new double[columnNames.Count()][];
+
+        DoubleMatrix dt = new DoubleMatrix(groups.Select(x => x.Count()).Max(), columnNames.Count());
+        dt.ColumnNames = columnNames;
+
+        int i = 0;
+        int j = 0;
+        foreach (string columnName in columnNames) {
+          j = 0;
+          data[i] = new double[groups[i].Count()];
+          foreach (IRun run in groups[i]) {
+            dt[j, i] = (double)((dynamic)run.Results[resultName]).Value;
+            data[i][j] = dt[j, i];
+            j++;
+          }
+          i++;
+        }
+
+        stringConvertibleMatrixView.Content = dt;
+      }
+    }
+
+    private List<RunCollection> GetGroups(string[] columnNames, IEnumerable<IRun> runs) {
+      List<RunCollection> runCols = new List<RunCollection>();
+      string parameterName = (string)groupComboBox.SelectedItem;
+
+      foreach (string cn in columnNames) {
+        var tmpRuns = runs.Where(x => ((string)((dynamic)x.Parameters[parameterName]).Value.ToString()) == cn);
+        runCols.Add(new RunCollection(tmpRuns));
+      }
+
+      return runCols;
+    }
+
+    private void testButton_Click(object sender, EventArgs e) {
+      double pval = KruskalWallis.Test(data);
+      pValTextBox.Text = pval.ToString();
+    }
+
+
+    private void normalDistButton_Click(object sender, EventArgs e) {
+
+    }
+
+    private void resultComboBox_SelectedValueChanged(object sender, EventArgs e) {
+      RebuildDataTable();
+    }
+
+    private void groupComboBox_SelectedValueChanged(object sender, EventArgs e) {
+      RebuildDataTable();
+    }
+  }
+}
Index: /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/StatisticalTestingView.designer.cs
===================================================================
--- /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/StatisticalTestingView.designer.cs	(revision 9317)
+++ /branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/StatisticalTestingView.designer.cs	(revision 9317)
@@ -0,0 +1,180 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2012 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.AlgorithmBehavior.Views {
+  partial class StatisticalTestingView {
+    /// <summary>
+    /// Required designer variable.
+    /// </summary>
+    private System.ComponentModel.IContainer components = null;
+
+    /// <summary>
+    /// Clean up any resources being used.
+    /// </summary>
+    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+    protected override void Dispose(bool disposing) {
+      if (disposing && (components != null)) {
+        components.Dispose();
+      }
+      base.Dispose(disposing);
+    }
+
+    #region Windows Form Designer generated code
+
+    /// <summary>
+    /// Required method for Designer support - do not modify
+    /// the contents of this method with the code editor.
+    /// </summary>
+    private void InitializeComponent() {
+      this.stringConvertibleMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
+      this.groupByLabel = new System.Windows.Forms.Label();
+      this.label1 = new System.Windows.Forms.Label();
+      this.resultComboBox = new System.Windows.Forms.ComboBox();
+      this.testButton = new System.Windows.Forms.Button();
+      this.normalDistButton = new System.Windows.Forms.Button();
+      this.lblPVal = new System.Windows.Forms.Label();
+      this.pValTextBox = new System.Windows.Forms.TextBox();
+      this.groupComboBox = new System.Windows.Forms.ComboBox();
+      this.SuspendLayout();
+      // 
+      // stringConvertibleMatrixView
+      // 
+      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, 30);
+      this.stringConvertibleMatrixView.Name = "stringConvertibleMatrixView";
+      this.stringConvertibleMatrixView.ReadOnly = false;
+      this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = true;
+      this.stringConvertibleMatrixView.ShowStatisticalInformation = true;
+      this.stringConvertibleMatrixView.Size = new System.Drawing.Size(918, 438);
+      this.stringConvertibleMatrixView.TabIndex = 0;
+      // 
+      // groupByLabel
+      // 
+      this.groupByLabel.AutoSize = true;
+      this.groupByLabel.Location = new System.Drawing.Point(400, 6);
+      this.groupByLabel.Name = "groupByLabel";
+      this.groupByLabel.Size = new System.Drawing.Size(53, 13);
+      this.groupByLabel.TabIndex = 7;
+      this.groupByLabel.Text = "Group by:";
+      // 
+      // label1
+      // 
+      this.label1.AutoSize = true;
+      this.label1.Location = new System.Drawing.Point(5, 6);
+      this.label1.Name = "label1";
+      this.label1.Size = new System.Drawing.Size(40, 13);
+      this.label1.TabIndex = 6;
+      this.label1.Text = "Result:";
+      // 
+      // resultComboBox
+      // 
+      this.resultComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+      this.resultComboBox.FormattingEnabled = true;
+      this.resultComboBox.Location = new System.Drawing.Point(71, 3);
+      this.resultComboBox.Name = "resultComboBox";
+      this.resultComboBox.Size = new System.Drawing.Size(323, 21);
+      this.resultComboBox.TabIndex = 5;
+      this.resultComboBox.SelectedValueChanged += new System.EventHandler(this.resultComboBox_SelectedValueChanged);
+      // 
+      // testButton
+      // 
+      this.testButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+      this.testButton.Location = new System.Drawing.Point(641, 473);
+      this.testButton.Name = "testButton";
+      this.testButton.Size = new System.Drawing.Size(109, 23);
+      this.testButton.TabIndex = 9;
+      this.testButton.Text = "Test";
+      this.testButton.UseVisualStyleBackColor = true;
+      this.testButton.Click += new System.EventHandler(this.testButton_Click);
+      // 
+      // normalDistButton
+      // 
+      this.normalDistButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+      this.normalDistButton.Location = new System.Drawing.Point(8, 473);
+      this.normalDistButton.Name = "normalDistButton";
+      this.normalDistButton.Size = new System.Drawing.Size(155, 23);
+      this.normalDistButton.TabIndex = 11;
+      this.normalDistButton.Text = "Check for Normal Distribution";
+      this.normalDistButton.UseVisualStyleBackColor = true;
+      this.normalDistButton.Click += new System.EventHandler(this.normalDistButton_Click);
+      // 
+      // lblPVal
+      // 
+      this.lblPVal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+      this.lblPVal.AutoSize = true;
+      this.lblPVal.Location = new System.Drawing.Point(756, 478);
+      this.lblPVal.Name = "lblPVal";
+      this.lblPVal.Size = new System.Drawing.Size(46, 13);
+      this.lblPVal.TabIndex = 12;
+      this.lblPVal.Text = "p-Value:";
+      // 
+      // pValTextBox
+      // 
+      this.pValTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+      this.pValTextBox.Location = new System.Drawing.Point(808, 475);
+      this.pValTextBox.Name = "pValTextBox";
+      this.pValTextBox.Size = new System.Drawing.Size(116, 20);
+      this.pValTextBox.TabIndex = 13;
+      // 
+      // groupComboBox
+      // 
+      this.groupComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+      this.groupComboBox.FormattingEnabled = true;
+      this.groupComboBox.Location = new System.Drawing.Point(459, 3);
+      this.groupComboBox.Name = "groupComboBox";
+      this.groupComboBox.Size = new System.Drawing.Size(462, 21);
+      this.groupComboBox.TabIndex = 14;
+      this.groupComboBox.SelectedValueChanged += new System.EventHandler(this.groupComboBox_SelectedValueChanged);
+      // 
+      // StatisticalTestingView
+      // 
+      this.Controls.Add(this.groupComboBox);
+      this.Controls.Add(this.pValTextBox);
+      this.Controls.Add(this.lblPVal);
+      this.Controls.Add(this.normalDistButton);
+      this.Controls.Add(this.testButton);
+      this.Controls.Add(this.groupByLabel);
+      this.Controls.Add(this.label1);
+      this.Controls.Add(this.resultComboBox);
+      this.Controls.Add(this.stringConvertibleMatrixView);
+      this.Name = "StatisticalTestingView";
+      this.Size = new System.Drawing.Size(924, 500);
+      this.ResumeLayout(false);
+      this.PerformLayout();
+
+    }
+    #endregion
+
+    private HeuristicLab.Data.Views.StringConvertibleMatrixView stringConvertibleMatrixView;
+    private System.Windows.Forms.Label groupByLabel;
+    private System.Windows.Forms.Label label1;
+    private System.Windows.Forms.ComboBox resultComboBox;
+    private System.Windows.Forms.Button testButton;
+    private System.Windows.Forms.Button normalDistButton;
+    private System.Windows.Forms.Label lblPVal;
+    private System.Windows.Forms.TextBox pValTextBox;
+    private System.Windows.Forms.ComboBox groupComboBox;
+  }
+}
