Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/22/13 16:57:03 (11 years ago)
Author:
ascheibe
Message:

#2031 reorganized statistical testing ui

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs

    r9353 r9389  
    5757        UpdateResultComboBox();
    5858        UpdateGroupsComboBox();
     59        FillCompComboBox();
    5960        RebuildDataTable();
    6061      }
     
    126127      resultComboBox.Items.AddRange(results);
    127128      if (resultComboBox.Items.Count > 0) resultComboBox.SelectedItem = resultComboBox.Items[0];
     129    }
     130
     131    private void FillCompComboBox() {
     132      string parameterName = (string)groupComboBox.SelectedItem;
     133      if (parameterName != null) {
     134        string resultName = (string)resultComboBox.SelectedItem;
     135        if (resultName != null) {
     136          var runs = Content.Where(x => x.Results.ContainsKey(resultName) && x.Visible);
     137          var columnNames = GetColumnNames(runs).ToList();
     138          groupCompComboBox.Items.Clear();
     139          columnNames.ForEach(x => groupCompComboBox.Items.Add(x));
     140          if (groupCompComboBox.Items.Count > 0) groupCompComboBox.SelectedItem = groupCompComboBox.Items[0];
     141        }
     142      }
    128143    }
    129144
     
    170185    }
    171186
     187    private void ResetUI() {
     188      normalityLabel.Image = null;
     189      groupCompLabel.Image = null;
     190      pValTextBox.Text = string.Empty;
     191      equalDistsTextBox.Text = string.Empty;
     192    }
     193
    172194    private void testButton_Click(object sender, EventArgs e) {
    173195      double pval = KruskalWallis.Test(data);
    174196      pValTextBox.Text = pval.ToString();
     197      if (pval < 0.05) {
     198        groupCompLabel.Image = HeuristicLab.Analysis.Statistics.Resources.Default;
     199      } else {
     200        groupCompLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Warning;
     201      }
    175202    }
    176203
     
    187214        if (res[i] < 0.1) {
    188215          stringConvertibleMatrixView.DataGridView.Columns[i].DefaultCellStyle.ForeColor = Color.Red;
     216          normalityLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Warning;
    189217        } else {
    190218          stringConvertibleMatrixView.DataGridView.Columns[i].DefaultCellStyle.ForeColor = Color.Green;
     219          normalityLabel.Image = HeuristicLab.Analysis.Statistics.Resources.Default;
    191220        }
    192221      }
     
    195224    private void resultComboBox_SelectedValueChanged(object sender, EventArgs e) {
    196225      RebuildDataTable();
    197       pValTextBox.Text = string.Empty;
     226      ResetUI();
    198227    }
    199228
    200229    private void groupComboBox_SelectedValueChanged(object sender, EventArgs e) {
     230      FillCompComboBox();
    201231      RebuildDataTable();
    202       pValTextBox.Text = string.Empty;
     232      ResetUI();
    203233    }
    204234
     
    218248
    219249    private void pairwiseTestButton_Click(object sender, EventArgs e) {
    220       var selectedCells = stringConvertibleMatrixView.DataGridView.SelectedCells;
    221       if (selectedCells.Count < 1) {
    222         MessageBox.Show("Please selected one cell/column for pairwise comparision. ", "HeuristicLab", MessageBoxButtons.OK, MessageBoxIcon.Error);
    223         return;
    224       }
    225 
    226       int colIndex = selectedCells[0].ColumnIndex;
    227       foreach (DataGridViewCell selC in selectedCells) {
    228         if (colIndex != selC.ColumnIndex) {
    229           MessageBox.Show("Please selected only one column for pairwise comparision. ", "HeuristicLab", MessageBoxButtons.OK, MessageBoxIcon.Error);
    230           return;
    231         }
     250      string curItem = (string)groupCompComboBox.SelectedItem;
     251      int colIndex = 0;
     252
     253      foreach (string col in stringConvertibleMatrixView.Content.ColumnNames) {
     254        if (col == curItem) {
     255          break;
     256        }
     257        colIndex++;
    232258      }
    233259
     
    267293      boxplotView.Show();
    268294    }
     295
     296    private void pairwiseCheckDataButton_Click(object sender, EventArgs e) {
     297      string curItem = (string)groupCompComboBox.SelectedItem;
     298      int colIndex = 0;
     299
     300      foreach (string col in stringConvertibleMatrixView.Content.ColumnNames) {
     301        if (col == curItem) {
     302          break;
     303        }
     304        colIndex++;
     305      }
     306
     307      double mwuBothtails;
     308      double mwuLefttail;
     309      double mwuRighttail;
     310      int cnt = 0;
     311
     312      for (int i = 0; i < data.Length; i++) {
     313        if (i != colIndex) {
     314          alglib.mannwhitneyutest(data[colIndex], data[colIndex].Length, data[i], data[i].Length, out mwuBothtails, out mwuLefttail, out mwuRighttail);
     315          if (mwuBothtails > 0.05) {
     316            cnt++;
     317          }
     318        }
     319      }
     320
     321      double ratio = ((double)cnt) / data.Length * 100.0;
     322      equalDistsTextBox.Text = ratio.ToString() + " %";
     323    }
    269324  }
    270325}
Note: See TracChangeset for help on using the changeset viewer.