Ejemplo n.º 1
0
 public void TestPoissonDistribution()
 {
     double[][] para =
     {
         new double[] { 11, 0, 9, 0.3405106424656610472811084, 0.1085255092982049925567724 }
     };
     for (int i = 0; i < para.Length; i++)
     {
         var tester = new DiscDistTester(para[i], delegate(double a, double b)
         {
             var ret = new PoissonDistribution(a);
             return(ret);
         }
                                         );
         tester.Test(1E-14);
     }
 }
Ejemplo n.º 2
0
 public void TestDiscreteUniformDistribution()
 {
     double[][] para =
     {
         new double[] { 1, 11, 5, 0.4545454545454545454545455, 0.09090909090909090909090909 }
     };
     for (int i = 0; i < para.Length; i++)
     {
         var tester = new DiscDistTester(para[i], delegate(double a, double b)
         {
             var ret = new DiscreteUniformDistribution((int)a, (int)b);
             return(ret);
         }
                                         );
         tester.Test(1E-14);
     }
 }
Ejemplo n.º 3
0
 public void TestBinomialDistribution()
 {
     double[][] para =
     {
         new double[] {  10,  0.75,  7, 0.4744071960449218750000000,  0.2502822875976562500000000 },
         new double[] { 100, 0.375, 40, 0.7339137587545079200156959, 0.07115992585884902329546213 }
     };
     for (int i = 0; i < para.Length; i++)
     {
         var tester = new DiscDistTester(para[i], delegate(double a, double b)
         {
             var ret = new BinomialDistribution((int)a, b);
             return(ret);
         }
                                         );
         tester.Test(1E-12);
     }
 }
Ejemplo n.º 4
0
 public void TestBernoulliDistribution()
 {
     double[][] para =
     {
         new double[] { 0.75, 0, 0, 0.2500000000000000000000000, 0.2500000000000000000000000 }
     };
     for (int i = 0; i < para.Length; i++)
     {
         var tester = new DiscDistTester(para[i], delegate(double a, double b)
         {
             var ret = new BernoulliDistribution
             {
                 Probability = a
             };
             return(ret);
         }
                                         );
         tester.Test(1E-14);
     }
 }
Ejemplo n.º 5
0
 public void TestGeometricDistribution()
 {
     double[][] para =
     {
         // note since Mathematica has variant B, you must increase the third value here by one
         new double[] { 0.125, 0, 5, 0.4870910644531250000000000, 0.07327270507812500000000000 }
     };
     for (int i = 0; i < para.Length; i++)
     {
         var tester = new DiscDistTester(para[i], delegate(double a, double b)
         {
             var ret = new GeometricDistribution
             {
                 Probability = a
             };
             return(ret);
         }
                                         );
         tester.Test(1E-14);
     }
 }
Ejemplo n.º 6
0
		public void TestPoissonDistribution()
		{
			double[][] para = {
new double[]{11, 0, 9, 0.3405106424656610472811084, 0.1085255092982049925567724}
      };
			for (int i = 0; i < para.Length; i++)
			{
				DiscDistTester tester = new DiscDistTester(para[i], delegate(double a, double b)
				{
					PoissonDistribution ret = new PoissonDistribution(a);
					return ret;
				}
					);
				tester.Test(1E-14);
			}
		}
Ejemplo n.º 7
0
		public void TestGeometricDistribution()
		{
			double[][] para = {
      // note since Mathematica has variant B, you must increase the third value here by one
new double[]{0.125, 0, 5, 0.4870910644531250000000000, 0.07327270507812500000000000}
      };
			for (int i = 0; i < para.Length; i++)
			{
				DiscDistTester tester = new DiscDistTester(para[i], delegate(double a, double b)
				{
					GeometricDistribution ret = new GeometricDistribution();
					ret.Probability = a;
					return ret;
				}
					);
				tester.Test(1E-14);
			}
		}
Ejemplo n.º 8
0
		public void TestDiscreteUniformDistribution()
		{
			double[][] para = {
new double[]{1, 11, 5, 0.4545454545454545454545455, 0.09090909090909090909090909}
      };
			for (int i = 0; i < para.Length; i++)
			{
				DiscDistTester tester = new DiscDistTester(para[i], delegate(double a, double b)
				{
					DiscreteUniformDistribution ret = new DiscreteUniformDistribution((int)a, (int)b);
					return ret;
				}
					);
				tester.Test(1E-14);
			}
		}
Ejemplo n.º 9
0
		public void TestBinomialDistribution()
		{
			double[][] para = {
new double[]{10, 0.75, 7, 0.4744071960449218750000000, 0.2502822875976562500000000},
new double[]{100, 0.375, 40, 0.7339137587545079200156959, 0.07115992585884902329546213}
      };
			for (int i = 0; i < para.Length; i++)
			{
				DiscDistTester tester = new DiscDistTester(para[i], delegate(double a, double b)
				{
					BinomialDistribution ret = new BinomialDistribution((int)a, b);
					return ret;
				}
					);
				tester.Test(1E-12);
			}
		}
Ejemplo n.º 10
0
		public void TestBernoulliDistribution()
		{
			double[][] para = {
new double[]{0.75, 0, 0, 0.2500000000000000000000000, 0.2500000000000000000000000}
      };
			for (int i = 0; i < para.Length; i++)
			{
				DiscDistTester tester = new DiscDistTester(para[i], delegate(double a, double b)
				{
					BernoulliDistribution ret = new BernoulliDistribution();
					ret.Probability = a;
					return ret;
				}
					);
				tester.Test(1E-14);
			}
		}