//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testObject()
        public virtual void testObject()
        {
            assertEquals(DIST.Degrees, DOF, 0);
            assertEquals(DIST.NonCentrality, NON_CENTRALITY, 0);
            NonCentralChiSquaredDistribution other = new NonCentralChiSquaredDistribution(DOF, NON_CENTRALITY);

            assertEquals(DIST, other);
            assertEquals(DIST.GetHashCode(), other.GetHashCode());
            other = new NonCentralChiSquaredDistribution(DOF + 1, NON_CENTRALITY);
            assertFalse(other.Equals(DIST));
            other = new NonCentralChiSquaredDistribution(DOF, NON_CENTRALITY + 1);
            assertFalse(other.Equals(DIST));
        }
        /// <summary>
        /// Numbers computed from R
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void debugTest()
        public virtual void debugTest()
        {
            const double dof           = 3.666;
            const double nonCentrality = 75;
            const double x             = 13.89;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final NonCentralChiSquaredDistribution chiSq1 = new NonCentralChiSquaredDistribution(dof, nonCentrality);
            NonCentralChiSquaredDistribution chiSq1 = new NonCentralChiSquaredDistribution(dof, nonCentrality);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double y1 = Math.log(chiSq1.getCDF(x));
            double y1 = Math.Log(chiSq1.getCDF(x));

            assertEquals(-15.92129, y1, 1e-5);
        }
コード例 #3
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            NonCentralChiSquaredDistribution other = (NonCentralChiSquaredDistribution)obj;

            if (System.BitConverter.DoubleToInt64Bits(_dofOverTwo) != Double.doubleToLongBits(other._dofOverTwo))
            {
                return(false);
            }
            return(System.BitConverter.DoubleToInt64Bits(_lambdaOverTwo) == Double.doubleToLongBits(other._lambdaOverTwo));
        }
        /// <summary>
        /// Numbers computed from R
        /// </summary>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testLargeValues()
        public virtual void testLargeValues()
        {
            double x       = 123;
            double dof     = 6.4;
            double nonCent = 100.34;
            NonCentralChiSquaredDistribution dist = new NonCentralChiSquaredDistribution(dof, nonCent);

            assertEquals(0.7930769, dist.getCDF(x), 1e-6);

            x       = 455.038;
            dof     = 12;
            nonCent = 444.44;

            dist = new NonCentralChiSquaredDistribution(dof, nonCent);
            assertEquals(0.4961805, dist.getCDF(x), 1e-6);

            x       = 999400;
            dof     = 500;
            nonCent = 1000000;
            dist    = new NonCentralChiSquaredDistribution(dof, nonCent);
            assertEquals(0.2913029, dist.getCDF(x), 1e-6);
        }