Accord.Statistics.Links.ProbitLinkFunction.Derivative2 C# (CSharp) 메소드

Derivative2() 공개 메소드

First derivative of the Inverse function expressed in terms of it's output.
The first derivative of the identity link function in terms of y = f(x) is given by f'(y) = exp(c - x * x * 0.5) in which c = -log(sqrt(2*π) and x =
public Derivative2 ( double y ) : double
y double The reverse transformed value.
리턴 double
        public double Derivative2(double y)
        {
            double x = Normal.Inverse(y);
            return Math.Exp(lnconstant - x * x * 0.5);
        }

Usage Example

예제 #1
0
        public void DerivativeTest()
        {
            ProbitLinkFunction target = new ProbitLinkFunction();

            double[] expected = 
            {
                0.398942, 0.396953, 0.391043, 0.381388, 0.36827, 0.352065,
                0.333225, 0.312254, 0.289692, 0.266085, 0.241971
            };

            for (int i = 0; i < 11; i++)
            {
                double x = i / 10.0;
                double y = target.Inverse(x);

                double d1 = target.Derivative(x);
                double d2 = target.Derivative2(y);

                Assert.AreEqual(expected[i], d1, 1e-5);
                Assert.AreEqual(expected[i], d2, 1e-5);

                Assert.IsFalse(Double.IsNaN(d1));
                Assert.IsFalse(Double.IsNaN(d2));
            }
        }