Package org.jquantlib.math.distributions

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


            final double /* @Real */chi_double_prime = 2 * b / (spot * spot) - temp_chi_prime / spot - c / (spot * spot);
            greeks.delta = phi * dividendDiscount * cumNormalDist.op(phi * d1_Sk)
            + (lambda / (spot * (1 - chi)) + chi_prime / ((1 - chi)*(1 - chi))) *
            (phi * (Sk - payoff.strike()) - black_Sk) * Math.pow((spot/Sk), lambda);

            greeks.gamma = phi * dividendDiscount * normalDist.op(phi*d1_Sk) /
            (spot * Math.sqrt(variance))
            + (2 * lambda * chi_prime / (spot * (1 - chi) * (1 - chi))
                    + 2 * chi_prime * chi_prime / ((1 - chi) * (1 - chi) * (1 - chi))
                    + chi_double_prime / ((1 - chi) * (1 - chi))
                    + lambda * (1 - lambda) / (spot * spot * (1 - chi)))
View Full Code Here


        final NormalDistribution ND = new NormalDistribution();

        if (sigG > Constants.QL_EPSILON) {
            /*@Real*/ final double x_1  = (muG-Math.log(payoff.strike())+variance)/sigG;
            Nx_1 = CND.op(x_1);
            nx_1 = ND.op(x_1);
        } else {
            Nx_1 = (muG > Math.log(payoff.strike()) ? 1.0 : 0.0);
            nx_1 = 0.0;
        }
        greeks.vega = forwardPrice * riskFreeDiscount * ( (dmuG_dsig + sigG * dsigG_dsig)*Nx_1 + nx_1*dsigG_dsig );
View Full Code Here

        for(i=0; i < x.size(); i++) {
            x.set(i, xMin+h*i);
        }

        for(i = 0; i < x.size(); i++) {
            y.set(i, normal.op(x.get(i)));
        }

        for(i = 0; i < x.size(); i++) {
            yi.set(i, cum.op(x.get(i)));
        }
View Full Code Here

        final CumulativeNormalDistribution gIntegral = new CumulativeNormalDistribution(m, std);
        final NormalDistribution g = new NormalDistribution(m, std);
        /*@Real*/ double firstTerm = variance + m*m - 2.0*target*m + target*target;
        /*@Real*/ double alfa = gIntegral.op(target);
        /*@Real*/ double secondTerm = m - target;
        /*@Real*/ double beta = variance*g.op(target);
        /*@Real*/ double result = alfa*firstTerm - beta*secondTerm;
        return result/alfa;
    }

   
View Full Code Here

        /*@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

    public /*@Real*/ double gaussianAverageShortfall(/*@Real*/ double target) /* @ReadOnly */ {
      /*@Real*/ double m = mean();
      /*@Real*/ double std = 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) );
    }

}
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.