Package com.nr.ran

Examples of com.nr.ran.Normaldev


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

    // Generate gaussian distributed data
    Normaldev ndev=new Normaldev(0.0,1.0,17);
    // Special case: identical distributions
    for (i=0;i<NPTS;i++) data1[i]=ndev.dev();
    for (i=0;i<NPTS;i++) data2[i]=(NSHFT/2.0)*EPS+data1[i];
    avevar(data1,ave1,var1);
    avevar(data2,ave2,var2);
    sd=sqrt(var1.val/NPTS*2.0);
    for (i=0;i<NSHFT+1;i++) {
View Full Code Here


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

    // Generate two gaussian distributions with different variances
    Normaldev ndev=new Normaldev(0.0,1.0,17);
    for (j=0;j<NPTS;j++) data1[j]=ndev.dev();
    avevar(data1,ave1,var1);
    for (j=0;j<NPTS;j++) data1[j] -= ave1.val;
    for (j=0;j<NPTS;j++) data2[j]=data1[j];
    ftest(data1,data2,f,prob);
//    System.out.printf(1.0-prob << " %f\n", 1.0-f);
View Full Code Here

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

    // Generate two gaussian distributions of different variance
    Normaldev ndev = new Normaldev(0.0,1.0,17);
    for (i=0;i<NPTS;i++) data1[i]=ndev.dev();
    avevar(data1,ave1,var1);
    for (i=0;i<NPTS;i++) data1[i] -= ave1.val;
    // Conclass data with exactly twice the standard deviation
    for (i=0;i<NPTS;i++) data2[i]=NSHFT/2.0*EPS+2.0*data1[i];
    avevar(data2,ave2,var2);
View Full Code Here

   

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

    Normaldev ndev = new Normaldev(0.0,1.0,17);
    // Generate identical data but with a shift
    for (j=0;j<NPTS;j++) data1[j]=ndev.dev();
    avevar(data1,ave1,var1);
    for (j=0;j<NPTS;j++) {
      data1[j] -= ave1.val;
      data2[j] = -data1[j];
      data1[j] -= (NSHFT/2.0)*EPS;
 
View Full Code Here

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

    stdev=1.e-3;
    double[] f=fleg(x[0]);
    int NP=f.length;
    Normaldev ndev = new Normaldev(0.0,stdev,17);

    for (i=0;i<N;i++) {   // Create a data set
      x[i]=-1.0+0.02*(i+1);
      f=fleg(x[i]);
      y[i]=0.0;
      for (j=0;j<NP;j++) y[i] += amp[j]*f[j];
      y[i] += ndev.dev();
      sig[i]=stdev;
    }

    Fitsvd myfit=new Fitsvd(x,y,sig,this,TOL);
    myfit.fit();
View Full Code Here

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

    stdev=1.e-6;
    double[] f=fpoly(x[0]);
    int NP=f.length;
    Normaldev ndev = new Normaldev(0.0,stdev,17);

    for (i=0;i<N;i++) {   // Create a data set
      x[i]=0.1*(i+1);
      f=fpoly(x[i]);
      y[i]=0.0;
      for (j=0;j<NP;j++) y[i] += amp[j]*f[j];
      y[i] += ndev.dev();
      sig[i]=stdev;
    }

    Fitsvd myfit = new Fitsvd(x,y,sig,this,TOL);
    myfit.fit();
View Full Code Here

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

    double[] f=Fitsvd_funcs(x[0]);
    ma=f.length;
    stdev=0.02;
    Normaldev ndev = new Normaldev(0.0,stdev,17);

    for (i=0;i<N;i++) {   // Create a data set
      x[i]=0.1*(i+1);
      f=Fitsvd_funcs(x[i]);
      y[i]=0.0;
      for (j=0;j<ma;j++) y[i] += amp[j]*f[j];
      y[i] += ndev.dev();
      sig[i]=stdev;
    }

    Fitsvd mysvdfit = new Fitsvd(x,y,sig,this,TOL);
    mysvdfit.fit();
View Full Code Here

   

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

    Normaldev ndev=new Normaldev(0.0,1.0,17);
    // First try a sum of two Gaussians
    for (i=0;i<N;i++) {
      x[i]=0.1*(i+1);
      y[i]=0.0;
      for (j=0;j<MA;j+=3)
        y[i] += a[j]*exp(-SQR((x[i]-a[j+1])/a[j+2]));
      y[i] *= (1.0+SPREAD*ndev.dev());
      sig[i]=SPREAD*y[i];
    }
    FGauss fgauss = new FGauss();
    Fitmrq myfit=new Fitmrq(x,y,sig,guess,fgauss);
    myfit.fit();
View Full Code Here

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

    double[] f=Fitlin_funcs(x[0]);
    ma=f.length;
    stdev=0.02;
    Normaldev ndev=new Normaldev(0.0,stdev,17);

    for (i=0;i<N;i++) {   // Create a data set
      x[i]=0.1*(i+1);
      f=Fitlin_funcs(x[i]);
      y[i]=0.0;
      for (j=0;j<ma;j++) y[i] += amp[j]*f[j];
      y[i] += ndev.dev();
      sig[i]=stdev;
    }

    Fitlin myfit = new Fitlin(x,y,sig,this);
    myfit.fit();
View Full Code Here

        }
      }
    }

    // Test 3
    Normaldev ndev=new Normaldev(0.0,1.0,17);
    for (j=0;j<M;j++) {
      for (i=0;i<N;i++) {
        yy[i] = y[i]+ndev.dev();
        sig[i]=1.0;
      }
      Fitab fit3 = new Fitab(x,yy,sig);

//      System.out.printf(fit3.a << " %f\n", fit3.b);
View Full Code Here

TOP

Related Classes of com.nr.ran.Normaldev

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.