Changeset 4143
- Timestamp:
- 08/04/10 14:21:47 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.3/RunCollectionVariableImpactView.cs
r4124 r4143 92 92 .ToList(); 93 93 94 List<string> statictics = new List<string> { "Median Rank", " pValue", "Mean", "StdDev",};94 List<string> statictics = new List<string> { "Median Rank", "Mean", "StdDev", "pValue" }; 95 95 List<string> columnNames = runsWithVariables.Select(r => r.Name).ToList(); 96 96 columnNames.AddRange(statictics); … … 120 120 .ToList(); 121 121 if (variableImpactsOverRuns.Count() > 0) { 122 // reference median is the worst median rank 123 double referenceMedian = (from impacts in variableRanks 124 let med = impacts.Median() 125 orderby med 126 select med) 127 .Last(); 122 // the variable with the worst median impact value is chosen as the reference variable 123 // this is problematic if all variables are relevant, however works often in practice 124 List<double> referenceImpacts = (from impacts in variableImpactsOverRuns 125 let avg = impacts.Median() 126 orderby avg 127 select impacts) 128 .First(); 128 129 // for all variables 129 130 for (int row = 0; row < variableImpactsOverRuns.Count; row++) { 131 // median rank 130 132 matrix[row, runs] = variableRanks[row].Median(); 133 // also show mean and std.dev. of relative variable impacts to indicate the relative difference in impacts of variables 134 matrix[row, runs + 1] = variableImpactsOverRuns[row].Average(); 135 matrix[row, runs + 2] = variableImpactsOverRuns[row].StandardDeviation(); 131 136 132 // check if the median of the ranks is significantly different to the reference median rank133 137 double leftTail = 0; double rightTail = 0; double bothTails = 0; 134 double[] ranksArray = variableRanks[row].ToArray(); 135 136 // wilcoxon signed rank test is used because the ranks of two variables in a single run are not independent 137 alglib.wsr.wilcoxonsignedranktest(ranksArray, ranksArray.Length, referenceMedian, ref bothTails, ref leftTail, ref rightTail); 138 matrix[row, runs + 1] = bothTails; 139 140 // also show mean and std.dev. of relative variable impacts to indicate the relative difference in impacts of variables 141 matrix[row, runs + 2] = variableImpactsOverRuns[row].Average(); 142 matrix[row, runs + 3] = variableImpactsOverRuns[row].StandardDeviation(); 143 138 // calc differences of impacts for current variable and reference variable 139 double[] z = new double[referenceImpacts.Count]; 140 for (int i = 0; i < z.Length; i++) { 141 z[i] = variableImpactsOverRuns[row][i] - referenceImpacts[i]; 142 } 143 // wilcoxon signed rank test is used because the impact values of two variables in a single run are not independent 144 alglib.wsr.wilcoxonsignedranktest(z, z.Length, 0, ref bothTails, ref leftTail, ref rightTail); 145 matrix[row, runs + 3] = bothTails; 144 146 } 145 147 }
Note: See TracChangeset
for help on using the changeset viewer.