예제 #1
0
        public static double CNorm(Vector x, Matrix correlation)
        {
            Vector minus_infinity = new Vector(x.cols);

            for (int i = 0; i < x.cols; ++i)
            {
                minus_infinity[i] = -1E10;
            }

            GenzMultivariate gm = new GenzMultivariate(correlation);

            return(gm.getProb(minus_infinity, x, 2.5, 0.001, 10000));
        }
예제 #2
0
        public static void TestHarness2D()
        {
            Matrix correlation = new Matrix(2, 2);

            correlation.setIdentity();
            correlation[0, 1] = correlation[1, 0] = 0.2;
            Vector a = new Vector(2);

            a[0] = -1E10;
            a[1] = -1E10;
            Vector b = new Vector(2);

            b[0] = 0.1;
            b[1] = 0.1;
            GenzMultivariate genzmultivariate = new GenzMultivariate(correlation);

            Console.WriteLine("Prob is {0} and should be 0.323170477981", genzmultivariate.getProb(a, b, 2.5, 1E-5, 100000));
        }
예제 #3
0
        public static void TestHarness3D()
        {
            Matrix correlation = new Matrix(3, 3);

            correlation.setIdentity();
            correlation[0, 1] = correlation[1, 0] = 3.0 / 5.0;
            correlation[0, 2] = correlation[2, 0] = 1.0 / 3.0;
            correlation[1, 2] = correlation[2, 1] = 11.0 / 15.0;
            Vector a = new Vector(3);

            a[0] = -1E10;
            a[1] = -1E10;
            a[2] = -1E10;
            Vector b = new Vector(3);

            b[0] = 1.0;
            b[1] = 4.0;
            b[2] = 2.0;
            GenzMultivariate genzmultivariate = new GenzMultivariate(correlation);

            Console.WriteLine("Prob is {0} and should be 0.82798", genzmultivariate.getProb(a, b, 2.5, 1E-5, 100000));
        }