Package org.jquantlib.math.distributions

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


        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

        for (final double[] normalTestvalue : normal_testvalues) {
            final double x_position = normalTestvalue[0];
            final double tolerance = 1.0e-15;//(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: " + normal_expected);
            }
        }
View Full Code Here

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

            final double precision_expected = precisionTestvalue[1];
            final double computed_precision = icn.op(x_position);

            if (Math.abs(precision_expected-computed_precision)>tolerance) {
                fail("x_position " + x_position + " precision_expected: " + precision_expected + " precision_computed: " + computed_precision);
            }
        }
View Full Code Here

              GammaDistribution gd = new GammaDistribution(a);
              return gd.op(x);
          }
           public static double evaluateInverseCumulativeNormal(double average, double sigma, double x){
               InverseCumulativeNormal icn = new InverseCumulativeNormal(average,sigma);
               return icn.op(x);
           }



public static double evaluateNonCentralChiSquaredDistribution(double df, double x, double ncp) {
View Full Code Here

   
    public /*@Real*/ double gaussianPercentile(/*@Real*/ double percentile) /* @ReadOnly */ {
    QL.require(percentile>0.0, "percentile must be > 0.0");
    QL.require(percentile<1.0, "percentile must be < 1.0");
    final InverseCumulativeNormal gInverse = new InverseCumulativeNormal(mean(), standardDeviation());
    return gInverse.op(percentile);
  }

   
    /**
     * percentile must be in range (0%-100%) extremes excluded
View Full Code Here

    public /*@Real*/ double gaussianExpectedShortfall(/*@Real*/ double percentile) /* @ReadOnly */ {
        QL.require(percentile<1.0 && percentile>=0.9, "percentile is out of range [0.9, 1)");
        /*@Real*/ double m = this.mean();
        /*@Real*/ double std = this.standardDeviation();
        final InverseCumulativeNormal gInverse = new InverseCumulativeNormal(m, std);
        /*@Real*/ double var = gInverse.op(1.0-percentile);
        final NormalDistribution g = new NormalDistribution(m, std);
        /*@Real*/ 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(*)
        return -Math.min(result, 0.0);
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.