Package org.jquantlib.math.distributions

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


            }
            break;
        case Put:
            Q = (-(n-1.0) - Math.sqrt(((n-1.0)*(n-1.0)) + 4 * K)) / 2;
            LHS = payoff.strike() - Si;
            RHS = temp - (1 - dividendDiscount * cumNormalDist.op(-d1)) * Si / Q;
            bi = -dividendDiscount * cumNormalDist.op(-d1) * (1 - 1/Q)
            - (1 + dividendDiscount * cumNormalDist.derivative(-d1) / Math.sqrt(variance)) / Q;
            while (Math.abs(LHS - RHS)/payoff.strike() > tolerance) {
                Si = (payoff.strike() - RHS + bi * Si) / (1 + bi);
                forwardSi = Si * dividendDiscount / riskFreeDiscount;
View Full Code Here


            break;
        case Put:
            Q = (-(n-1.0) - Math.sqrt(((n-1.0)*(n-1.0)) + 4 * K)) / 2;
            LHS = payoff.strike() - Si;
            RHS = temp - (1 - dividendDiscount * cumNormalDist.op(-d1)) * Si / Q;
            bi = -dividendDiscount * cumNormalDist.op(-d1) * (1 - 1/Q)
            - (1 + dividendDiscount * cumNormalDist.derivative(-d1) / Math.sqrt(variance)) / Q;
            while (Math.abs(LHS - RHS)/payoff.strike() > tolerance) {
                Si = (payoff.strike() - RHS + bi * Si) / (1 + bi);
                forwardSi = Si * dividendDiscount / riskFreeDiscount;
                d1 = (Math.log(forwardSi/payoff.strike())+0.5*variance)/Math.sqrt(variance);
 
View Full Code Here

                Si = (payoff.strike() - RHS + bi * Si) / (1 + bi);
                forwardSi = Si * dividendDiscount / riskFreeDiscount;
                d1 = (Math.log(forwardSi/payoff.strike())+0.5*variance)/Math.sqrt(variance);
                LHS = payoff.strike() - Si;
                final double /*@Real*/ temp2 = BlackFormula.blackFormula(payoff.optionType(), payoff.strike(), forwardSi, Math.sqrt(variance))*riskFreeDiscount;
                RHS = temp2 - (1 - dividendDiscount * cumNormalDist.op(-d1)) * Si / Q;
                bi = -dividendDiscount * cumNormalDist.op(-d1) * (1 - 1 / Q)
                - (1 + dividendDiscount * cumNormalDist.derivative(-d1) / Math.sqrt(variance)) / Q;
            }
            break;
        default:
View Full Code Here

                forwardSi = Si * dividendDiscount / riskFreeDiscount;
                d1 = (Math.log(forwardSi/payoff.strike())+0.5*variance)/Math.sqrt(variance);
                LHS = payoff.strike() - Si;
                final double /*@Real*/ temp2 = BlackFormula.blackFormula(payoff.optionType(), payoff.strike(), forwardSi, Math.sqrt(variance))*riskFreeDiscount;
                RHS = temp2 - (1 - dividendDiscount * cumNormalDist.op(-d1)) * Si / Q;
                bi = -dividendDiscount * cumNormalDist.op(-d1) * (1 - 1 / Q)
                - (1 + dividendDiscount * cumNormalDist.derivative(-d1) / Math.sqrt(variance)) / Q;
            }
            break;
        default:
            throw new LibraryException(UNKNOWN_OPTION_TYPE); // QA:[RG]::verified
View Full Code Here

     }

      public static  double evaluateCumulativeNormalDistribution(double mean, double sigma, double z){
          CumulativeNormalDistribution cnd = new CumulativeNormalDistribution(mean, sigma);
      return     cnd.op(z);
      }

      public  static double evaluateCumulativePoissonDistribution(double mean, int k){
          CumulativePoissonDistribution cpd = new CumulativePoissonDistribution(mean);
          return cpd.op(k);
View Full Code Here

        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)));
        }

        for (i=0; i < x.size(); i++) {
            yd.set(i, normal.derivative(x.get(i)));
        }
View Full Code Here

        /*@Real*/ double std = this.standardDeviation();
        /*@Real*/ double variance = std*std;
        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

    /**
     * gaussian-assumption Shortfall (observations below target)       
     */
    public /*@Real*/ double gaussianShortfall(/*@Real*/ double target) /* @ReadOnly */ {
        final CumulativeNormalDistribution gIntegral = new CumulativeNormalDistribution(mean(), standardDeviation());
        return gIntegral.op(target);
    }


    /**
     * gaussian-assumption {@link Average} Shortfall (averaged shortfallness)       
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.