Package com.nr.ran

Examples of com.nr.ran.Expondev


   

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

    Expondev edev = new Expondev(1.0,17);
    for (i=0;i<NPTS;i++) {
      x=edev.dev();
      ibin=(int)(x*NBINS/3.0);
      if (ibin < NBINS) ++bins1[ibin];
    }
    for (i=0;i<NBINS;i++) bins2[i]=bins1[i];
    chstwo(bins1,bins2,df,chsq,prob,0);
    localflag = localflag || (chsq.val != 0.) || (prob.val != 1);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** chtwo: Incorrect chsq or prob for perfectly matching distributions");
     
    }

    for (i=0;i<NBINS;i++) bins2[i]=0;
    for (i=0;i<NPTS;i++) {
      x=edev.dev();
      ibin=(int)(x*NBINS/3.0);
      if (ibin < NBINS) ++bins2[ibin];
    }
    chstwo(bins1,bins2,df,chsq,prob,0);
//    System.out.printf(df << " %f\n", chsq << " %f\n", prob);
View Full Code Here


   

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

    Expondev edev=new Expondev(1.0,17);
    for (k=0;k<NPTS;k++) {
      x=edev.dev();
      ibin=(int)(x*NBINS/3.0);
      if (ibin < NBINS) ++bins[ibin];
    }
    for (i=0;i<NBINS;i++) ebins[i]=bins[i];
    chsone(bins,ebins,df,chsq,prob,0);
View Full Code Here

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

    // Check fingerprint of doub()
    Expondev myran = new Expondev(beta,17);
    localflag=false;
    for (i=0;i<10;i++)
      localflag=localflag || abs(myran.dev()-fingerprint[i])>sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Expondev: dev() does not match fingerprint");
     
    }

    // Check statistics
    Expondist expect = new Expondist(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 < 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.Expondev

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.