[11702] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[17181] | 3 | * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[11702] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System;
|
---|
| 23 | using HeuristicLab.Analysis.Statistics;
|
---|
| 24 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
| 25 |
|
---|
[11705] | 26 | namespace HeuristicLab.Analysis.Tests {
|
---|
[11702] | 27 | [TestClass]
|
---|
| 28 | public class EffectSizeUnitTests {
|
---|
| 29 | private readonly double[] x = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 1.5, 0.3 };
|
---|
| 30 | private readonly double[] y = new double[] { 1.0, 3.0, 10.0, 4.0, 2.5, 6.0, 7.5, 8.0, 1.5, 0.5 };
|
---|
| 31 | private readonly double[] z = new double[] { 45.0, 0.3, 12.0, 45.0, 68.0, 79.0, 10.0, 87.0, 84.0, 1.0 };
|
---|
| 32 |
|
---|
| 33 | [TestMethod]
|
---|
[11941] | 34 | [TestCategory("Analysis.Statistics")]
|
---|
| 35 | [TestProperty("Time", "short")]
|
---|
[11702] | 36 | public void CohensdTest1() {
|
---|
| 37 | //compared to R lsr package/cohenD(..)
|
---|
| 38 | var result = SampleSizeDetermination.CalculateCohensD(x, y);
|
---|
| 39 | Assert.AreEqual(0.2074003, Math.Round(result, 7));
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | [TestMethod]
|
---|
[11941] | 43 | [TestCategory("Analysis.Statistics")]
|
---|
| 44 | [TestProperty("Time", "short")]
|
---|
[11702] | 45 | public void CohensdTest2() {
|
---|
| 46 | //compared to R lsr package/cohenD(..)
|
---|
| 47 | var result = SampleSizeDetermination.CalculateCohensD(x, z);
|
---|
| 48 | Assert.AreEqual(1.57424, Math.Round(result, 5));
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | [TestMethod]
|
---|
[11941] | 52 | [TestCategory("Analysis.Statistics")]
|
---|
| 53 | [TestProperty("Time", "short")]
|
---|
[11702] | 54 | public void HedgesGTest1() {
|
---|
| 55 | //compared to R effsize package/cohen.d(..,hedges.correction=TRUE)
|
---|
| 56 | var result = SampleSizeDetermination.CalculateHedgesG(x, y);
|
---|
| 57 | Assert.AreEqual(0.1986369, Math.Round(result, 7));
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | [TestMethod]
|
---|
[11941] | 61 | [TestCategory("Analysis.Statistics")]
|
---|
| 62 | [TestProperty("Time", "short")]
|
---|
[11702] | 63 | public void HedgesGTest2() {
|
---|
| 64 | //compared to R effsize package/cohen.d(..,hedges.correction=TRUE)
|
---|
| 65 | var result = SampleSizeDetermination.CalculateHedgesG(x, z);
|
---|
| 66 | Assert.AreEqual(1.507722, Math.Round(result, 6));
|
---|
| 67 | }
|
---|
| 68 | }
|
---|
| 69 | }
|
---|