Package org.jquantlib.math.functions

Examples of org.jquantlib.math.functions.Minus


        final int n = getSampleSize();
        QL.require(n >= 1 , unsufficient_sample_size);

        final List<Ops.DoubleOp> functions = new ArrayList<Ops.DoubleOp>();
        functions.add(new Square());
        functions.add(new Bind2nd(new Minus(), mean()));
        final Expression comp = new Expression(functions);

        // Evaluate the composed function in the specified range (ie. everyWhere).
        final double s2 = expectationValue(comp, new TruePredicate()).getFirst();
        return s2*n/(n-1.0);
 
View Full Code Here


        if (n <= 2)
            throw new IllegalArgumentException(unsufficient_sample_size_2);

        final List<Ops.DoubleOp> functions = new ArrayList<Ops.DoubleOp>();
        functions.add(new Cube());
        functions.add(new Bind2nd(new Minus(), mean()));
        final Expression comp = new Expression(functions);

        final double x = expectationValue(comp, new TruePredicate()).getFirst();
        final double sigma = standardDeviation();
        final double _n = n;
View Full Code Here

        if (n <= 3)
            throw new IllegalArgumentException(unsufficient_sample_size_3);

        final List<DoubleOp> functions = new ArrayList<DoubleOp>();
        functions.add(new Fourth());
        functions.add(new Bind2nd(new Minus(), mean()));
        final Expression comp = new Expression(functions);

        final double x = expectationValue(comp, new TruePredicate()).getFirst();

        final double _N = n;
View Full Code Here

    public double regret(final double target){
        // average over the range below the target

        final List<Ops.DoubleOp> functions = new ArrayList<Ops.DoubleOp>();
        functions.add(new Square());
        functions.add(new Bind2nd(new Minus(), target));
        final Expression comp = new Expression(functions);
        final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);

        final Pair<Double, Integer> result = statistics.expectationValue(comp, less);
        final double x = result.getFirst();
View Full Code Here

    /*! averaged shortfallness, defined as
        \f[ \mathrm{E}\left[ t-x \;|\; x<t \right] \f]
     */
    public double averageShortfall(final double target) {

        final Ops.DoubleOp minus = new Bind1st(target, new Minus());
        final Ops.DoublePredicate less = new Bind1stPredicate(target, new LessThanPredicate());
        final Pair<Double, Integer> result = statistics.expectationValue(minus, less);

        final double x = result.getFirst();
        //mmhh somewhere we have to change N to int
View Full Code Here

        // Subtract the mean and square. Repeat on the whole range.
        // Hopefully, the whole thing will be inlined in a single loop.
        /*@Real*/ final double s2 = expectationValue(
            new ComposedFunction(
                new Square(), new Bind2nd(
                    new Minus(), mean())),
                                   new Everywhere()).first();
        return s2*N/(N-1.0);
    }
View Full Code Here

        QL.require(N > 2, "sample number <=2, unsufficient");

        /*@Real*/ final double x = expectationValue(
            new ComposedFunction(
                new Cube(), new Bind2nd(
                    new Minus(), mean())),
                                  new Everywhere()).first();
        /*@Real*/ final double sigma = standardDeviation();

        return (x/(sigma*sigma*sigma))*(N/(N-1.0))*(N/(N-2.0));
    }
View Full Code Here

        QL.require(N > 3, "sample number <=3, unsufficient");

        /*@Real*/ final double x = expectationValue(
            new ComposedFunction(
                new Fourth(), new Bind2nd(
                    new Minus(), mean())),
                                  new Everywhere()).first();
        /*@Real*/ final double sigma2 = variance();

        /*@Real*/ final double c1 = (N/(N-1.0)) * (N/(N-2.0)) * ((N+1.0)/(N-3.0));
        /*@Real*/ final double c2 = 3.0 * ((N-1.0)/(N-2.0)) * ((N-1.0)/(N-3.0));
 
View Full Code Here

  public /*@Real*/ double regret(final /*@Real*/ double target) /*@ReadOnly*/ {
    // average over the range below the target

    final List<Ops.DoubleOp> functions = new ArrayList<Ops.DoubleOp>();
    functions.add(new Square());
    functions.add(new Bind2nd(new Minus(), target));
    final Expression comp = new Expression(functions);
    final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);

    final Pair<Double, Integer> result = expectationValue(comp, less);
    final double x = result.first();
View Full Code Here

   * averaged shortfallness, defined as
   * {@latex[ \mathrm{E}\left[ t-x \;|\; x<t \right] }
   */
  public /*@Real*/ double averageShortfall(final /*@Real*/ double target) /*@ReadOnly*/ {

    final Ops.DoubleOp minus = new Bind1st(target, new Minus());
    final Ops.DoublePredicate less = new Bind1stPredicate(target, new LessThanPredicate());
    final Pair<Double, Integer> result = expectationValue(minus, less);

    final double x = result.first();
    final Integer N = result.second();
View Full Code Here

TOP

Related Classes of org.jquantlib.math.functions.Minus

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.