Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11692


Ignore:
Timestamp:
12/17/14 11:31:26 (10 years ago)
Author:
ascheibe
Message:

#2031

  • fixed a bug in Cohens d / Hedges g calculation
  • fixed calculation of pairwise tests (no more columns with only zeroes)
  • some refactoring
Location:
branches/StatisticalTesting
Files:
2 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/HeuristicLab.Analysis.Statistics-3.3.csproj

    r11671 r11692  
    146146      <DependentUpon>StatisticalTestingView.cs</DependentUpon>
    147147    </Compile>
    148     <Compile Include="KruskalWallis.cs" />
     148    <Compile Include="KruskalWallisTest.cs" />
    149149    <Compile Include="CorrelationView.cs">
    150150      <SubType>UserControl</SubType>
     
    161161    <Compile Include="Plugin.cs" />
    162162    <Compile Include="Properties\AssemblyInfo.cs" />
    163     <Compile Include="TTest.cs" />
     163    <Compile Include="PairwiseTest.cs" />
    164164  </ItemGroup>
    165165  <ItemGroup>
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs

    r11671 r11692  
    8585      s2 = d2.Variance();
    8686
    87       return (x1 - x2) / Math.Sqrt((s1 + s2) / 2);
     87      return Math.Abs(x1 - x2) / Math.Sqrt((s1 + s2) / 2);
    8888    }
    8989
     
    104104
    105105      s = Math.Sqrt(((n1 - 1) * s1 + (n2 - 1) * s2) / (n1 + n2 - 2));
    106       g = (x1 - x2) / s;
     106      g = Math.Abs(x1 - x2) / s;
    107107      c = (1 - (3 / (4 * (n1 + n2) - 9))) * g;
    108108
  • branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/StatisticalTestingView.cs

    r11691 r11692  
    303303
    304304    private void TestAllGroups() {
    305       double pval = KruskalWallis.Test(data);
     305      double pval = KruskalWallisTest.Test(data);
    306306      pValTextBox.Text = pval.ToString();
    307307      if (pval < significanceLevel) {
     
    359359
    360360      double[][] newData = FilterDataForPairwiseTest(colIndex);
    361 
    362       double mwuBothtails;
    363       double mwuLefttail;
    364       double mwuRighttail;
    365361      int cnt = 0;
    366 
    367362      for (int i = 0; i < newData.Length; i++) {
    368         alglib.mannwhitneyutest(data[colIndex], data[colIndex].Length, newData[i], newData[i].Length, out mwuBothtails, out mwuLefttail, out mwuRighttail);
     363        double mwuBothtails = PairwiseTest.MannWhitneyUTest(data[colIndex], newData[i]);
    369364        if (mwuBothtails > significanceLevel) {
    370365          cnt++;
     
    435430
    436431      double mwuBothtails;
    437       double mwuLefttail;
    438       double mwuRighttail;
    439432      double tTestBothTails;
    440433      double[] mwuPValues = new double[newData.Length];
     
    445438
    446439      for (int i = 0; i < newData.Length; i++) {
    447         if (i != colIndex) {
    448           alglib.mannwhitneyutest(data[colIndex], data[colIndex].Length, newData[i], newData[i].Length, out mwuBothtails,
    449             out mwuLefttail, out mwuRighttail);
    450           tTestBothTails = TTest.Test(data[colIndex], newData[i]);
    451           mwuPValues[i] = mwuBothtails;
    452           tTestPValues[i] = tTestBothTails;
    453         }
     440        mwuBothtails = PairwiseTest.MannWhitneyUTest(data[colIndex], newData[i]);
     441        tTestBothTails = PairwiseTest.TTest(data[colIndex], newData[i]);
     442        mwuPValues[i] = mwuBothtails;
     443        tTestPValues[i] = tTestBothTails;
    454444      }
    455445
     
    458448
    459449      for (int i = 0; i < newData.Length; i++) {
    460         if (i != colIndex) {
    461           pValsMatrix[0, i] = mwuPValues[i];
    462           pValsMatrix[1, i] = adjustedMwuPValues[i];
    463           pValsMatrix[2, i] = tTestPValues[i];
    464           pValsMatrix[3, i] = adjustedTtestPValues[i];
    465           pValsMatrix[4, i] = SampleSizeDetermination.CalculateCohensD(data[colIndex], newData[i]);
    466           pValsMatrix[5, i] = SampleSizeDetermination.CalculateHedgesG(data[colIndex], newData[i]);
    467         }
     450        pValsMatrix[0, i] = mwuPValues[i];
     451        pValsMatrix[1, i] = adjustedMwuPValues[i];
     452        pValsMatrix[2, i] = tTestPValues[i];
     453        pValsMatrix[3, i] = adjustedTtestPValues[i];
     454        pValsMatrix[4, i] = SampleSizeDetermination.CalculateCohensD(data[colIndex], newData[i]);
     455        pValsMatrix[5, i] = SampleSizeDetermination.CalculateHedgesG(data[colIndex], newData[i]);
    468456      }
    469457
  • branches/StatisticalTesting/Statistics.UnitTests/KruskalWallisUnitTests.cs

    r11375 r11692  
    3636      data[2] = new double[] { 2.8, 3.4, 3.7, 2.2, 2.0 };
    3737
    38       Assert.AreEqual(0.68, Math.Round(KruskalWallis.Test(data), 2));
     38      Assert.AreEqual(0.68, Math.Round(KruskalWallisTest.Test(data), 2));
    3939    }
    4040
     
    6262                              ,3605,4162,493,330,4595,2699,4457,3981,3499,1773,653,3176,134,3205,4537 };
    6363
    64       Assert.AreEqual(0.95, Math.Round(KruskalWallis.Test(data), 2));
     64      Assert.AreEqual(0.95, Math.Round(KruskalWallisTest.Test(data), 2));
    6565    }
    6666
     
    110110                              ,-0.947125493,2.087444922,0.271276104,-1.027604792,-0.364097727,-0.741089219};
    111111
    112       Assert.AreEqual(0.0253, Math.Round(KruskalWallis.Test(data), 4));
     112      Assert.AreEqual(0.0253, Math.Round(KruskalWallisTest.Test(data), 4));
    113113    }
    114114
     
    150150                              ,-0.947125493,2.087444922,0.271276104,-1.027604792,-0.364097727,-0.741089219};
    151151
    152       var result = KruskalWallis.Test(data);
     152      var result = KruskalWallisTest.Test(data);
    153153      Assert.IsTrue(result.IsAlmost(2.2E-16));
    154154    }
     
    167167                              ,2654,4588,3363,4750,1440,1892,3629,816,4317,34,2119,3290,1758 };
    168168
    169       Assert.AreEqual(1, Math.Round(KruskalWallis.Test(data), 2));
     169      Assert.AreEqual(1, Math.Round(KruskalWallisTest.Test(data), 2));
    170170    }
    171171  }
Note: See TracChangeset for help on using the changeset viewer.