Package org.jquantlib.math.distributions

Examples of org.jquantlib.math.distributions.NonCentralChiSquaredDistribution


        final double df = 4.0 * k() * theta() / sigma2;
        final double ncps = 2.0 * rho * rho * (r0 - phi_.get(0.0)) * Math.exp(h * t) / (rho + psi + b);
        final double ncpt = 2.0 * rho * rho * (r0 - phi_.get(0.0)) * Math.exp(h * t) / (rho + psi);

        final NonCentralChiSquaredDistribution chis = new NonCentralChiSquaredDistribution(df, ncps);
        final NonCentralChiSquaredDistribution chit = new NonCentralChiSquaredDistribution(df, ncpt);

        final double z = Math.log(super.A(t, s) / strike) / b;
        final double call = discountS * chis.op(2.0 * z * (rho + psi + b)) - strike * discountT
        * chit.op(2.0 * z * (rho + psi));
        if (type.equals(Option.Type.Call))
            return call;
        else
            return call - discountS + strike * discountT;

 
View Full Code Here


        final double /* @Real */df = 4.0 * k() * theta() / sigma2;
        final double /* @Real */ncps = 2.0 * rho * rho * x0() * Math.exp(h * t) / (rho + psi + b);
        final double /* @Real */ncpt = 2.0 * rho * rho * x0() * Math.exp(h * t) / (rho + psi);

        final NonCentralChiSquaredDistribution chis = new NonCentralChiSquaredDistribution(df, ncps);
        final NonCentralChiSquaredDistribution chit = new NonCentralChiSquaredDistribution(df, ncpt);

        final double /* @Real */z = Math.log(A(t, s) / strike) / b;
        final double /*@Real*/ call = discountS*chis.op(2.0*z*(rho+psi+b)) -
        strike*discountT*chit.op(2.0*z*(rho+psi));

        if (type == Option.Type.Call) {
            return 0.0;
        } else {
            return 1.0;
View Full Code Here

        final double df = 4.0 * k() * theta() / sigma2;
        final double ncps = 2.0 * rho * rho * (r0 - phi_.get(0.0)) * Math.exp(h * t) / (rho + psi + b);
        final double ncpt = 2.0 * rho * rho * (r0 - phi_.get(0.0)) * Math.exp(h * t) / (rho + psi);

        final NonCentralChiSquaredDistribution chis = new NonCentralChiSquaredDistribution(df, ncps);
        final NonCentralChiSquaredDistribution chit = new NonCentralChiSquaredDistribution(df, ncpt);

        final double z = Math.log(super.A(t, s) / strike) / b;
        final double call = discountS * chis.op(2.0 * z * (rho + psi + b)) - strike * discountT
        * chit.op(2.0 * z * (rho + psi));
        if (type.equals(Option.Type.Call))
            return call;
        else
            return call - discountS + strike * discountT;

 
View Full Code Here

        final double /* @Real */df = 4.0 * k() * theta() / sigma2;
        final double /* @Real */ncps = 2.0 * rho * rho * x0() * Math.exp(h * t) / (rho + psi + b);
        final double /* @Real */ncpt = 2.0 * rho * rho * x0() * Math.exp(h * t) / (rho + psi);

        final NonCentralChiSquaredDistribution chis = new NonCentralChiSquaredDistribution(df, ncps);
        final NonCentralChiSquaredDistribution chit = new NonCentralChiSquaredDistribution(df, ncpt);

        final double /* @Real */z = Math.log(A(t, s) / strike) / b;
        final double /*@Real*/ call = discountS*chis.op(2.0*z*(rho+psi+b)) -
        strike*discountT*chit.op(2.0*z*(rho+psi));

        if (type == Option.Type.Call) {
            return 0.0;
        } else {
            return 1.0;
View Full Code Here

    for (final double[] value : values) {
      final double df = value[0];
      final double ncp = value[1];
      final double x = value[2];
      final double expected = value[3];
      final NonCentralChiSquaredDistribution nccsd = new NonCentralChiSquaredDistribution(df, ncp);
      final double realised = nccsd.op(x);
      if (Math.abs(expected-realised)>1.0e-6)
        fail("Noncentral chi squared failed: df " + df
          + " ncp " + ncp
          + " x " + x
          + " expected " + expected
View Full Code Here

           }



public static double evaluateNonCentralChiSquaredDistribution(double df, double x, double ncp) {
     NonCentralChiSquaredDistribution ncd = new NonCentralChiSquaredDistribution(df,ncp);
     return ncd.op(x);

}
View Full Code Here

TOP

Related Classes of org.jquantlib.math.distributions.NonCentralChiSquaredDistribution

Copyright © 2018 www.massapicom. 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.