Package com.nr.ran

Examples of com.nr.ran.Gammadev


   

    // Test mcmc
    System.out.println("Testing mcmc");

    Gammadev gdev1 = new Gammadev(k1,lambda1,17);
    Gammadev gdev2 = new Gammadev(k2,lambda2,17);
    t=0.0;
    for (i=0;i<N;i++) {
      if (t < tc) {
        t += gdev1.dev();
      } else {
        t += gdev2.dev();
      }
      times[i]=t;
    }

    State s=new State(1.0,3.0,100.0,1,1);
View Full Code Here


    System.out.println("Testing Gammadev");

    // Check fingerprint of doub()
    alpha=3.0;
    beta=1.0;
    Gammadev myran=new Gammadev(alpha,beta,17);
    localflag=false;
    for (i=0;i<10;i++)
//      System.out.printf(setw(25) << setprecision(20) << myran.dev());
      localflag=localflag || abs(myran.dev()-fingerprint[i])>sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Gammadev: dev() does not match fingerprint");
     
    }

    // Check statistics
    Gammadist expect=new Gammadist(alpha,beta);
    binsize=range/M;
    for (i=0;i<M;i++) {
      x[i]=binsize*i;
      ebins[i]=N*binsize*expect.p(x[i]+0.5*binsize);
      bins[i]=0;
    }
    for (i=0;i<N;i++) {
      nbin=(int)(floor(myran.dev()/binsize));
      if ((nbin >= 0) && (nbin < M)) bins[nbin] += 1;
    }
    chsone(bins,ebins,df,chisq,prob);
    System.out.printf("     chisq,dev(): %f  prob: %f\n",chisq.val, prob.val);
    localflag = (prob.val < 0.05);
View Full Code Here

TOP

Related Classes of com.nr.ran.Gammadev

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.