Package com.nr.ran

Examples of com.nr.ran.Poissondev


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

    // Generate data. Break each time interval into 100 parts
    Poissondev pdev1 = new Poissondev(lambda1/M,17);
    Poissondev pdev2 = new Poissondev(lambda2/M,17);
    j=0;
    for (i=0;i<(int)(lambda1*tc/k1);i++) {
      for (k=0;k<k1;k++) {
        while (pdev1.dev() == 0) j++;
        j++;
      }
      times[i] = j*1.0/M;
    }
    for (i=(int)(lambda1*tc/k1);i<N;i++) {
      for (k=0;k<k2;k++) {
        while (pdev2.dev() == 0) j++;
        j++;
      }
      times[i] = j*1.0/M;
    }
   
View Full Code Here


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

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

    // Check statistics
    Poissondist expect = new Poissondist(lambda);
    for (i=0;i<M;i++) {
      ebins[i]=N*expect.p(i);
      bins[i]=0;
    }
    for (i=0;i<N;i++) {
      nbin=myran.dev();
      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.Poissondev

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.