Changeset 9389 for branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs
- Timestamp:
- 04/22/13 16:57:03 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs
r9353 r9389 57 57 UpdateResultComboBox(); 58 58 UpdateGroupsComboBox(); 59 FillCompComboBox(); 59 60 RebuildDataTable(); 60 61 } … … 126 127 resultComboBox.Items.AddRange(results); 127 128 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 } 128 143 } 129 144 … … 170 185 } 171 186 187 private void ResetUI() { 188 normalityLabel.Image = null; 189 groupCompLabel.Image = null; 190 pValTextBox.Text = string.Empty; 191 equalDistsTextBox.Text = string.Empty; 192 } 193 172 194 private void testButton_Click(object sender, EventArgs e) { 173 195 double pval = KruskalWallis.Test(data); 174 196 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 } 175 202 } 176 203 … … 187 214 if (res[i] < 0.1) { 188 215 stringConvertibleMatrixView.DataGridView.Columns[i].DefaultCellStyle.ForeColor = Color.Red; 216 normalityLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Warning; 189 217 } else { 190 218 stringConvertibleMatrixView.DataGridView.Columns[i].DefaultCellStyle.ForeColor = Color.Green; 219 normalityLabel.Image = HeuristicLab.Analysis.Statistics.Resources.Default; 191 220 } 192 221 } … … 195 224 private void resultComboBox_SelectedValueChanged(object sender, EventArgs e) { 196 225 RebuildDataTable(); 197 pValTextBox.Text = string.Empty;226 ResetUI(); 198 227 } 199 228 200 229 private void groupComboBox_SelectedValueChanged(object sender, EventArgs e) { 230 FillCompComboBox(); 201 231 RebuildDataTable(); 202 pValTextBox.Text = string.Empty;232 ResetUI(); 203 233 } 204 234 … … 218 248 219 249 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++; 232 258 } 233 259 … … 267 293 boxplotView.Show(); 268 294 } 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 } 269 324 } 270 325 }
Note: See TracChangeset
for help on using the changeset viewer.