public void IsPassingChiSquaredTest_GivenObservedSetExpectedSetAndAlfa_ReturnsFalse() { ChiSquared chi = new ChiSquared(); // #1, #2, #3, #4, #5, #6 double[] observedSet = { 22, 24, 38, 30, 46, 44 }; double[] expectedSet = { 34, 34, 34, 34, 34, 34 }; double alfa = 0.01; var result = chi.IsPassingChiSquaredTest(observedSet, expectedSet, alfa); Assert.IsFalse(result); }
public void IsPassingChiSquaredTest_WhenObservedAndExpectedSetsAreSame_Throws() { ChiSquared chi = new ChiSquared(); // #1,#2,#3,#4,#5,#6 double[] observedSet = { 1, 1, 1, 1, 1, 1 }; double[] expectedSet = { 1, 1, 1, 1, 1, 1 }; double alfa = 0.01; TestDelegate result = () => chi.IsPassingChiSquaredTest(observedSet, expectedSet, alfa); Assert.Throws <ArgumentException>(result); }
public void IsPassingChiSquaredTest_GivenObservedSetExpectedSetAndAlfa_ReturnsTrue() { ChiSquared chi = new ChiSquared(); // #1, #2, #3, #4, #5, #6 double[] observedSet = { 43, 39, 42, 37, 41, 44 }; double[] expectedSet = { 41, 41, 41, 41, 41, 41 }; double alfa = 0.01; var result = chi.IsPassingChiSquaredTest(observedSet, expectedSet, alfa); Assert.IsTrue(result); }
public void GetRandomNumber_ChiSquaredTestWith12000Tries_ReturnsTrue() { var randomizer = new Randomizer(); var chiSquared = new ChiSquared(); var observedResults = new double[6]; var expectedResults = new double[] { 2000, 2000, 2000, 2000, 2000, 2000 }; var alfa = 0.01; // very restricted for (int i = 0; i < 12000; i++) { var indexToIncrement = randomizer.GetRandomNumber(1, 6) - 1; observedResults[indexToIncrement]++; } var result = chiSquared.IsPassingChiSquaredTest(observedResults, expectedResults, alfa); Assert.IsTrue(result); }