Examples of FDIST


Examples of com.nr.sf.Fdist

    Fdist normi;
   
    func_Fdist(double nnu1, double nnu2) {
      nu1 = nnu1;
      nu2 = nnu2;
      normi = new Fdist(nu1,nu2);
    }
View Full Code Here

Examples of com.nr.sf.Fdist

    pi=acos(-1.0);

    // Test special cases
    nu1=1.0; nu2=1.0; u=1.0;
    Fdist norm1=new Fdist(nu1,nu2);
    localflag = abs(norm1.p(u)-0.5/pi) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fdist: Special case #1 failed");
     
    }

    nu1=1.0; nu2=2.0; u=1.0;
    Fdist norm2=new Fdist(nu1,nu2);
    localflag = abs(norm2.p(u)-1.0/pow(3.0,1.5)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fdist: Special case #2 failed");
     
    }

    nu1=2.0; nu2=1.0; u=1.0;
    Fdist norm3=new Fdist(nu1,nu2);
    localflag = abs(norm3.p(u)-1.0/pow(3.0,1.5)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fdist: Special case #3 failed");
     
    }

    nu1=2.0; nu2=2.0; u=1.0;
    Fdist norm4=new Fdist(nu1,nu2);
    localflag = abs(norm4.p(u)-0.25) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fdist: Special case #4 failed");
     
    }

    nu1=2.0; nu2=2.0; u=2.0;
    Fdist norm5=new Fdist(nu1,nu2);
    localflag = abs(norm5.p(u)-1.0/9.0) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fdist: Special case #5 failed");
     
    }

    // integral of distribution is one
    sbeps=5.e-7;
    nu1=5.0; nu2=5.0;
    func_Fdist dist = new func_Fdist(nu1,nu2);
    Midpnt q2 = new Midpnt(dist,0.0,10.0);
    Midinf q3 = new Midinf(dist,10.0,1.0e99);
    integral=qromo(q2)+qromo(q3);
    localflag = abs(1.0-integral) > sbeps;
//    System.out.printf(setprecision(15) << 1.0-integral);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fdist: Distribution is not normalized to 1.0");
     
    }

    // cdf agrees with incomplete integral
    sbeps=1.e-6;
    nu1=5.0; nu2=5.0;
    func_Fdist dist2 = new func_Fdist(nu1,nu2);
    Fdist normcdf=new Fdist(nu1,nu2);
    localflag=false;
    for (i=0;i<N;i++) {
      q2 = new Midpnt(dist2,0.0,x[i]);
      integral=qromo(q2);
      c[i]=integral;
      d[i]=normcdf.cdf(x[i]);
//      System.out.printf(c[i]-d[i]);
      localflag = localflag || abs(c[i]-d[i]) > sbeps;
    }
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fdist: cdf does not agree with result of quadrature");
     
    }

    // inverse cdf agrees with cdf
    nu1=5.0; nu2=5.0;
    Fdist normc=new Fdist(nu1,nu2);
    Ran myran = new Ran(17);
    sbeps=5.0e-14;
    localflag=false;
    for (i=0;i<1000;i++) {
      u=3.0*myran.doub();
      a=normc.cdf(u);
      b=normc.invcdf(a);
//      if (abs(u-b) > sbeps) {
//        System.out.printf(setprecision(15) << u << " %f\n", b << " %f\n", abs(u-b));
//      }
      localflag = localflag || abs(u-b) > sbeps;
    }
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fdist: Inverse cdf does not accurately invert the cdf");
     
    }
     
    // Fingerprint test
    nu1=3.0; nu2=3.0;
    Fdist normf=new Fdist(nu1,nu2);
    for (i=0;i<N;i++) {
      p[i]=normf.p(x[i]);
//      System.out.printf(setprecision(17) << p[i] << " %f\n", pexp[i]);
    }
//    System.out.println("Fdist: Maximum discrepancy = %f\n", maxel(vecsub(p,pexp)));
    localflag = maxel(vecsub(p,pexp)) > sbeps;
    globalflag = globalflag || localflag;
View Full Code Here

Examples of org.boris.expr.function.excel.FDIST

        assertEquals(eval(e, 0.2, 10, true), 0.864664716763387);
        assertEquals(eval(e, 0.2, 10, false), 1.35335283236613);
    }

    public void testFDIST() throws Exception {
        FDIST f = new FDIST();
        fail("FDIST not implemented");
    }
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.