示例#1
0
 public void StatisticsTestExpectedValue() {
     Vector v1 = Vector.ParseFrom("2, 4, 4, 4, 5, 5, 7, 9");
     VectorMath S = new VectorMath(v1);
     
     Complex mActual = S.ExpectedValue();
     Complex mExpected = 5;
     Assert.AreEqual(mExpected, mActual);
 }
示例#2
0
        public void StatisticsTestCovariance() {
            Vector v1 = Vector.ParseFrom("1, 3, 7, 5, 6, 4");
            Vector v2 = Vector.ParseFrom("2, 7, 3, 2, 5, 1");

            Complex mActual = new VectorMath(v1).SampleCovariance(v2);
            Complex mExpected = 4.0/15;
            Assert.AreEqual(mExpected, mActual);
        }
示例#3
0
        public void StatisticsTestCorrelation() {
            Vector v1 = Vector.ParseFrom("1, 3, 7, 5, 6, 4");
            Vector v2 = Vector.ParseFrom("2, 7, 3, 2, 5, 1");

            Complex mActual = new VectorMath(v1).SampleCorrelation(v2);
            Complex mExpected = Math.Sqrt(2.0/665);
            Assert.AreEqual(mExpected, mActual);
        }
示例#4
0
 public void StatisticsTestVariance() {
     Vector v1 = Vector.ParseFrom("2, 4, 4, 4, 5, 5, 7, 9");
     VectorMath S = new VectorMath(v1);
     
     Complex mActual = S.PopulationVariance();
     Complex mExpected = 4;
     Assert.AreEqual(mExpected, mActual);
 }