Examples of op()


Examples of org.jquantlib.math.distributions.CumulativeNormalDistribution.op()

        final double std = statistics.standardDeviation();
        final double variance = std * std;
        final CumulativeNormalDistribution gIntegral = new CumulativeNormalDistribution(m, std);
        final NormalDistribution g = new NormalDistribution(m, std);
        final double firstTerm = variance + m * m - 2.0 * target * m + target * target;
        final double alfa = gIntegral.op(target);
        final double secondTerm = m - target;
        final double beta = variance * g.op(target);
        final double result = alfa * firstTerm - beta * secondTerm;
        return result / alfa;
    }
View Full Code Here

Examples of org.jquantlib.math.distributions.CumulativeNormalDistribution.op()

        return -Math.min(result, 0.0);
    }

    public double gaussianShortfall(final double target) {
        final CumulativeNormalDistribution gIntegral = new CumulativeNormalDistribution(statistics.mean(), statistics.standardDeviation());
        return gIntegral.op(target);
    }

    public double gaussianAverageShortfall(final double target) {
        final double m = statistics.mean();
        final double std = statistics.standardDeviation();
View Full Code Here

Examples of org.jquantlib.math.distributions.CumulativeNormalDistribution.op()

    public double gaussianAverageShortfall(final double target) {
        final double m = statistics.mean();
        final double std = statistics.standardDeviation();
        final CumulativeNormalDistribution gIntegral = new CumulativeNormalDistribution(m, std);
        final NormalDistribution g = new NormalDistribution(m, std);
        return ((target - m) + std * std * g.op(target) / gIntegral.op(target));
    }

    /*
     * TODO: where do we need this one???????????????????????????????? //! Helper class for precomputed distributions class
     * StatsHolder { public: typedef Real value_type; StatsHolder(Real mean, Real standardDeviation) : mean_(mean),
View Full Code Here

Examples of org.jquantlib.math.distributions.CumulativeNormalDistribution.op()

                lambda = Math.sqrt( mu * mu - 2.0 * Math.log(discount) / variance);
            }
            D1 = log_H_S / stdDev + lambda * stdDev;
            D2 = D1 - 2.0 * lambda * stdDev;
            final CumulativeNormalDistribution f = new CumulativeNormalDistribution();
            cum_d1 = f.op(D1);
            cum_d2 = f.op(D2);
            n_d1 = f.derivative(D1);
            n_d2 = f.derivative(D2);
        } else {
            // TODO: not tested yet
View Full Code Here

Examples of org.jquantlib.math.distributions.CumulativePoissonDistribution.op()

        for (double mean=0.0; mean<=10.0; mean+=0.5) {
            final CumulativePoissonDistribution cdf = new CumulativePoissonDistribution(mean);

            int i = 0;
            double cumCalculated = cdf.op(i);
            double logHelper = -mean;
            double cumExpected = Math.exp(logHelper);
            double error = Math.abs(cumCalculated-cumExpected);
            if (error>1.0e-13) {
                fail("expected: " + cumExpected + "  calculated: " + cumCalculated + "  error: " + error);
View Full Code Here

Examples of org.jquantlib.math.distributions.GammaDistribution.op()

    double a = 1.0;
    final GammaDistribution gammDistribution = new GammaDistribution(a);
    for (final double[] testvalue : testvalues) {
      final double expected = testvalue[1];
      final double x = testvalue[0];
      final double computed = gammDistribution.op(x);
      // QL.info(computed); // for testing
      final double tolerance = 1.0e-15;
      if (Math.abs(expected-computed)>tolerance) {
        fail("x: " + x + " expected: " + expected + " realised: " + computed);
      }
View Full Code Here

Examples of org.jquantlib.math.distributions.InverseCumulativeNormal.op()

     */
    public double gaussianPercentile(final double percentile) {
        QL.require(percentile > 0.0 , "percentile must be > 0.0"); // QA:[RG]::verified // TODO: message
        QL.require(percentile < 1.0 , "percentile must be < 1.0"); // QA:[RG]::verified // TODO: message
        final InverseCumulativeNormal gInverse = new InverseCumulativeNormal(statistics.mean(), statistics.standardDeviation());
        return gInverse.op(percentile);
    }

    /* ! \pre percentile must be in range (0%-100%) extremes excluded */
    public double gaussianTopPercentile(final double percentile) {
        return gaussianPercentile(1.0 - percentile);
View Full Code Here

Examples of org.jquantlib.math.distributions.InverseCumulativeNormal.op()

        if (percentile >= 1.0 || percentile < 0.9)
            throw new IllegalArgumentException("percentile (" + percentile + ") out of range [0.9, 1)");
        final double m = statistics.mean();
        final double std = statistics.standardDeviation();
        final InverseCumulativeNormal gInverse = new InverseCumulativeNormal(m, std);
        final double var = gInverse.op(1.0 - percentile);
        final NormalDistribution g = new NormalDistribution(m, std);
        final double result = m - std * std * g.op(var) / (1.0 - percentile);
        // expectedShortfall must be a loss
        // this means that it has to be MIN(result, 0.0)
        // expectedShortfall must also be a positive quantity, so -MIN(*)
 
View Full Code Here

Examples of org.jquantlib.math.distributions.InverseCumulativePoisson.op()

        final InverseCumulativePoisson icp = new InverseCumulativePoisson(1.0);
        final double data[] = { 0.2, 0.5, 0.9, 0.98, 0.99, 0.999, 0.9999, 0.99995,
                0.99999, 0.999999, 0.9999999, 0.99999999 };

        for (int i = 0; i < data.length; i++) {
            if (!Closeness.isClose(icp.op(data[i]), i)) {
                fail("failed to reproduce known value for x = " + data[i]
                                                                       + "\n" + "calculated: " + data[i] + "\n" + "expected: "
                                                                       + i);
            }
        }
View Full Code Here

Examples of org.jquantlib.math.distributions.MoroInverseCumulativeNormal.op()

        for (final double[] normalTestvalue : normal_testvalues) {
            final double x_position = normalTestvalue[0];
            final double tolerance = 15.0e-3;//(Math.abs(x_position)<3.01) ? 1.0e-15: 1.0e-10;

            final double normal_expected = normalTestvalue[1];
            final double computed_normal = icn.op(x_position);
            if (Math.abs(normal_expected - computed_normal) > tolerance) {
                fail("x_position " + x_position + " normal_expected: "
                        + normal_expected + " normal_computed: "
                        + computed_normal);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.