Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/18/13 13:39:56 (12 years ago)
Author:
ascheibe
Message:

#1886 added test for normality and pairwise statistical testing

Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/StatisticalTestingView.cs

    r9317 r9318  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Drawing;
    2425using System.Linq;
    2526using System.Windows.Forms;
     
    159160    private void normalDistButton_Click(object sender, EventArgs e) {
    160161
     162      double val;
     163      List<double> res = new List<double>();
     164      for (int i = 0; i < data.Length; i++) {
     165        alglib.jarqueberatest(data[i], data[i].Length, out val);
     166        res.Add(val);
     167      }
     168
     169      for (int i = 0; i < res.Count(); i++) {
     170        if (res[i] < 0.1) {
     171          stringConvertibleMatrixView.DataGridView.Columns[i].DefaultCellStyle.ForeColor = Color.Red;
     172        } else {
     173          stringConvertibleMatrixView.DataGridView.Columns[i].DefaultCellStyle.ForeColor = Color.Green;
     174        }
     175      }
    161176    }
    162177
     
    168183      RebuildDataTable();
    169184    }
     185
     186    private void normalityDetails_Click(object sender, EventArgs e) {
     187      DoubleMatrix pValsMatrix = new DoubleMatrix(1, stringConvertibleMatrixView.Content.Columns);
     188      pValsMatrix.ColumnNames = stringConvertibleMatrixView.Content.ColumnNames;
     189      pValsMatrix.RowNames = new string[] { "p-Values" };
     190
     191      double val;
     192      for (int i = 0; i < data.Length; i++) {
     193        alglib.jarqueberatest(data[i], data[i].Length, out val);
     194        pValsMatrix[0, i] = val;
     195      }
     196
     197      MainFormManager.MainForm.ShowContent(pValsMatrix);
     198    }
     199
     200    private void pairwiseTestButton_Click(object sender, EventArgs e) {
     201      var selectedCells = stringConvertibleMatrixView.DataGridView.SelectedCells;
     202      if (selectedCells.Count < 1) {
     203        MessageBox.Show("Please selected one cell/column for pairwise comparision. ", "HeuristicLab", MessageBoxButtons.OK, MessageBoxIcon.Error);
     204        return;
     205      }
     206
     207      int colIndex = selectedCells[0].ColumnIndex;
     208      foreach (DataGridViewCell selC in selectedCells) {
     209        if (colIndex != selC.ColumnIndex) {
     210          MessageBox.Show("Please selected only one column for pairwise comparision. ", "HeuristicLab", MessageBoxButtons.OK, MessageBoxIcon.Error);
     211          return;
     212        }
     213      }
     214
     215      DoubleMatrix pValsMatrix = new DoubleMatrix(1, stringConvertibleMatrixView.Content.Columns);
     216      pValsMatrix.ColumnNames = stringConvertibleMatrixView.Content.ColumnNames;
     217      pValsMatrix.RowNames = new string[] { "p-Values" };
     218
     219      double bothtails;
     220      double lefttail;
     221      double righttail;
     222      for (int i = 0; i < data.Length; i++) {
     223        alglib.mannwhitneyutest(data[colIndex], data[colIndex].Length, data[i], data[i].Length, out bothtails, out lefttail, out righttail);
     224        pValsMatrix[0, i] = bothtails;
     225      }
     226
     227      MainFormManager.MainForm.ShowContent(pValsMatrix);
     228    }
     229
     230    private void infoLabel_DoubleClick(object sender, EventArgs e) {
     231      using (TextDialog dialog = new TextDialog("Description of statistical tests", toolTip1.GetToolTip(this.infoLabel), true)) {
     232        dialog.ShowDialog(this);
     233      }
     234    }
    170235  }
    171236}
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers.Views/3.3/StatisticalTestingView.designer.cs

    r9317 r9318  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.components = new System.ComponentModel.Container();
    4748      this.stringConvertibleMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
    4849      this.groupByLabel = new System.Windows.Forms.Label();
     
    5455      this.pValTextBox = new System.Windows.Forms.TextBox();
    5556      this.groupComboBox = new System.Windows.Forms.ComboBox();
     57      this.normalityDetails = new System.Windows.Forms.Button();
     58      this.pairwiseTestButton = new System.Windows.Forms.Button();
     59      this.infoLabel = new System.Windows.Forms.Label();
     60      this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
     61      this.splitContainer1 = new System.Windows.Forms.SplitContainer();
     62      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     63      this.splitContainer1.Panel1.SuspendLayout();
     64      this.splitContainer1.Panel2.SuspendLayout();
     65      this.splitContainer1.SuspendLayout();
    5666      this.SuspendLayout();
    5767      //
    5868      // stringConvertibleMatrixView
    5969      //
    60       this.stringConvertibleMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    61             | System.Windows.Forms.AnchorStyles.Left) 
     70      this.stringConvertibleMatrixView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     71            | System.Windows.Forms.AnchorStyles.Left)
    6272            | System.Windows.Forms.AnchorStyles.Right)));
    6373      this.stringConvertibleMatrixView.Caption = "StringConvertibleMatrix View";
    6474      this.stringConvertibleMatrixView.Content = null;
    65       this.stringConvertibleMatrixView.Location = new System.Drawing.Point(3, 30);
     75      this.stringConvertibleMatrixView.Location = new System.Drawing.Point(3, 38);
    6676      this.stringConvertibleMatrixView.Name = "stringConvertibleMatrixView";
    6777      this.stringConvertibleMatrixView.ReadOnly = false;
    68       this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = true;
     78      this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = false;
    6979      this.stringConvertibleMatrixView.ShowStatisticalInformation = true;
    70       this.stringConvertibleMatrixView.Size = new System.Drawing.Size(918, 438);
     80      this.stringConvertibleMatrixView.Size = new System.Drawing.Size(918, 430);
    7181      this.stringConvertibleMatrixView.TabIndex = 0;
    7282      //
     
    7484      //
    7585      this.groupByLabel.AutoSize = true;
    76       this.groupByLabel.Location = new System.Drawing.Point(400, 6);
     86      this.groupByLabel.Location = new System.Drawing.Point(3, 6);
    7787      this.groupByLabel.Name = "groupByLabel";
    7888      this.groupByLabel.Size = new System.Drawing.Size(53, 13);
     
    8393      //
    8494      this.label1.AutoSize = true;
    85       this.label1.Location = new System.Drawing.Point(5, 6);
     95      this.label1.Location = new System.Drawing.Point(3, 6);
    8696      this.label1.Name = "label1";
    8797      this.label1.Size = new System.Drawing.Size(40, 13);
     
    91101      // resultComboBox
    92102      //
     103      this.resultComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     104            | System.Windows.Forms.AnchorStyles.Right)));
    93105      this.resultComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    94106      this.resultComboBox.FormattingEnabled = true;
    95       this.resultComboBox.Location = new System.Drawing.Point(71, 3);
     107      this.resultComboBox.Location = new System.Drawing.Point(49, 3);
    96108      this.resultComboBox.Name = "resultComboBox";
    97       this.resultComboBox.Size = new System.Drawing.Size(323, 21);
     109      this.resultComboBox.Size = new System.Drawing.Size(393, 21);
    98110      this.resultComboBox.TabIndex = 5;
    99111      this.resultComboBox.SelectedValueChanged += new System.EventHandler(this.resultComboBox_SelectedValueChanged);
     
    102114      //
    103115      this.testButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    104       this.testButton.Location = new System.Drawing.Point(641, 473);
     116      this.testButton.Location = new System.Drawing.Point(610, 473);
    105117      this.testButton.Name = "testButton";
    106118      this.testButton.Size = new System.Drawing.Size(109, 23);
     
    125137      this.lblPVal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    126138      this.lblPVal.AutoSize = true;
    127       this.lblPVal.Location = new System.Drawing.Point(756, 478);
     139      this.lblPVal.Location = new System.Drawing.Point(725, 478);
    128140      this.lblPVal.Name = "lblPVal";
    129141      this.lblPVal.Size = new System.Drawing.Size(46, 13);
     
    134146      //
    135147      this.pValTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
    136       this.pValTextBox.Location = new System.Drawing.Point(808, 475);
     148      this.pValTextBox.Location = new System.Drawing.Point(777, 475);
    137149      this.pValTextBox.Name = "pValTextBox";
    138       this.pValTextBox.Size = new System.Drawing.Size(116, 20);
     150      this.pValTextBox.Size = new System.Drawing.Size(144, 20);
    139151      this.pValTextBox.TabIndex = 13;
    140152      //
    141153      // groupComboBox
    142154      //
     155      this.groupComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     156            | System.Windows.Forms.AnchorStyles.Right)));
    143157      this.groupComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    144158      this.groupComboBox.FormattingEnabled = true;
    145       this.groupComboBox.Location = new System.Drawing.Point(459, 3);
     159      this.groupComboBox.Location = new System.Drawing.Point(62, 3);
    146160      this.groupComboBox.Name = "groupComboBox";
    147       this.groupComboBox.Size = new System.Drawing.Size(462, 21);
     161      this.groupComboBox.Size = new System.Drawing.Size(377, 21);
    148162      this.groupComboBox.TabIndex = 14;
    149163      this.groupComboBox.SelectedValueChanged += new System.EventHandler(this.groupComboBox_SelectedValueChanged);
    150164      //
     165      // normalityDetails
     166      //
     167      this.normalityDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     168      this.normalityDetails.Location = new System.Drawing.Point(169, 473);
     169      this.normalityDetails.Name = "normalityDetails";
     170      this.normalityDetails.Size = new System.Drawing.Size(144, 23);
     171      this.normalityDetails.TabIndex = 15;
     172      this.normalityDetails.Text = "Show details";
     173      this.normalityDetails.UseVisualStyleBackColor = true;
     174      this.normalityDetails.Click += new System.EventHandler(this.normalityDetails_Click);
     175      //
     176      // pairwiseTestButton
     177      //
     178      this.pairwiseTestButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     179      this.pairwiseTestButton.Location = new System.Drawing.Point(472, 472);
     180      this.pairwiseTestButton.Name = "pairwiseTestButton";
     181      this.pairwiseTestButton.Size = new System.Drawing.Size(132, 23);
     182      this.pairwiseTestButton.TabIndex = 16;
     183      this.pairwiseTestButton.Text = "Pairwise comparision";
     184      this.pairwiseTestButton.UseVisualStyleBackColor = true;
     185      this.pairwiseTestButton.Click += new System.EventHandler(this.pairwiseTestButton_Click);
     186      //
     187      // infoLabel
     188      //
     189      this.infoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     190      this.infoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;
     191      this.infoLabel.Location = new System.Drawing.Point(905, 6);
     192      this.infoLabel.Name = "infoLabel";
     193      this.infoLabel.Size = new System.Drawing.Size(16, 16);
     194      this.infoLabel.TabIndex = 17;
     195      this.toolTip1.SetToolTip(this.infoLabel, "TODO: Description of features and used methods");
     196      this.infoLabel.DoubleClick += new System.EventHandler(this.infoLabel_DoubleClick);
     197      //
     198      // splitContainer1
     199      //
     200      this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     201            | System.Windows.Forms.AnchorStyles.Right)));
     202      this.splitContainer1.Location = new System.Drawing.Point(8, 3);
     203      this.splitContainer1.Name = "splitContainer1";
     204      //
     205      // splitContainer1.Panel1
     206      //
     207      this.splitContainer1.Panel1.Controls.Add(this.resultComboBox);
     208      this.splitContainer1.Panel1.Controls.Add(this.label1);
     209      //
     210      // splitContainer1.Panel2
     211      //
     212      this.splitContainer1.Panel2.Controls.Add(this.groupByLabel);
     213      this.splitContainer1.Panel2.Controls.Add(this.groupComboBox);
     214      this.splitContainer1.Size = new System.Drawing.Size(891, 29);
     215      this.splitContainer1.SplitterDistance = 445;
     216      this.splitContainer1.TabIndex = 18;
     217      //
    151218      // StatisticalTestingView
    152219      //
    153       this.Controls.Add(this.groupComboBox);
     220      this.Controls.Add(this.splitContainer1);
     221      this.Controls.Add(this.infoLabel);
     222      this.Controls.Add(this.pairwiseTestButton);
     223      this.Controls.Add(this.normalityDetails);
    154224      this.Controls.Add(this.pValTextBox);
    155225      this.Controls.Add(this.lblPVal);
    156226      this.Controls.Add(this.normalDistButton);
    157227      this.Controls.Add(this.testButton);
    158       this.Controls.Add(this.groupByLabel);
    159       this.Controls.Add(this.label1);
    160       this.Controls.Add(this.resultComboBox);
    161228      this.Controls.Add(this.stringConvertibleMatrixView);
    162229      this.Name = "StatisticalTestingView";
    163230      this.Size = new System.Drawing.Size(924, 500);
     231      this.splitContainer1.Panel1.ResumeLayout(false);
     232      this.splitContainer1.Panel1.PerformLayout();
     233      this.splitContainer1.Panel2.ResumeLayout(false);
     234      this.splitContainer1.Panel2.PerformLayout();
     235      ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
     236      this.splitContainer1.ResumeLayout(false);
    164237      this.ResumeLayout(false);
    165238      this.PerformLayout();
     
    177250    private System.Windows.Forms.TextBox pValTextBox;
    178251    private System.Windows.Forms.ComboBox groupComboBox;
     252    private System.Windows.Forms.Button normalityDetails;
     253    private System.Windows.Forms.Button pairwiseTestButton;
     254    private System.Windows.Forms.Label infoLabel;
     255    private System.Windows.Forms.ToolTip toolTip1;
     256    private System.Windows.Forms.SplitContainer splitContainer1;
    179257  }
    180258}
Note: See TracChangeset for help on using the changeset viewer.