Example usage for org.apache.commons.math3.distribution GammaDistribution DEFAULT_INVERSE_ABSOLUTE_ACCURACY

List of usage examples for org.apache.commons.math3.distribution GammaDistribution DEFAULT_INVERSE_ABSOLUTE_ACCURACY

Introduction

In this page you can find the example usage for org.apache.commons.math3.distribution GammaDistribution DEFAULT_INVERSE_ABSOLUTE_ACCURACY.

Prototype

double DEFAULT_INVERSE_ABSOLUTE_ACCURACY

To view the source code for org.apache.commons.math3.distribution GammaDistribution DEFAULT_INVERSE_ABSOLUTE_ACCURACY.

Click Source Link

Document

Default inverse cumulative probability accuracy.

Usage

From source file:adams.data.distribution.Gamma.java

/**
 * Adds options to the internal list of options.
 *///from  w  w  w . j  a va 2 s.co  m
@Override
public void defineOptions() {
    super.defineOptions();

    m_OptionManager.add("shape", "shape", 0.0);

    m_OptionManager.add("scale", "scale", 1.0);

    m_OptionManager.add("inverse-cum-accuracy", "inverseCumAccuracy",
            GammaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
}

From source file:gdsc.smlm.ij.plugins.EMGainAnalysis.java

/**
 * Randomly generate a histogram from poisson-gamma-gaussian samples
 * /*  w w  w  .ja v a  2  s.  co  m*/
 * @return The histogram
 */
private int[] simulateFromPoissonGammaGaussian() {
    // Randomly sample
    RandomGenerator random = new Well44497b(System.currentTimeMillis() + System.identityHashCode(this));

    PoissonDistribution poisson = new PoissonDistribution(random, _photons, PoissonDistribution.DEFAULT_EPSILON,
            PoissonDistribution.DEFAULT_MAX_ITERATIONS);

    CustomGammaDistribution gamma = new CustomGammaDistribution(random, _photons, _gain,
            GammaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);

    final int steps = simulationSize;
    int[] sample = new int[steps];
    for (int n = 0; n < steps; n++) {
        if (n % 64 == 0)
            IJ.showProgress(n, steps);

        // Poisson
        double d = poisson.sample();

        // Gamma
        if (d > 0) {
            gamma.setShapeUnsafe(d);
            d = gamma.sample();
        }

        // Gaussian
        d += _noise * random.nextGaussian();

        // Convert the sample to a count 
        sample[n] = (int) Math.round(d + _bias);
    }

    int max = Maths.max(sample);
    int[] h = new int[max + 1];
    for (int s : sample)
        h[s]++;
    return h;
}

From source file:msi.gaml.operators.Stats.java

@operator(value = "gamma_rnd", can_be_const = false, type = IType.LIST, category = {
        IOperatorCategory.STATISTICAL }, concept = { IConcept.STATISTIC, IConcept.CLUSTERING })
@doc(value = "returns a random value from a gamma distribution with specified values of the shape and scale parameters", examples = {
        @example(value = "gamma_rnd(10.0,5.0)", isExecutable = false) })
public static Double OpGammaDist(final IScope scope, final Double shape, final Double scale)
        throws GamaRuntimeException {
    final GammaDistribution dist = new GammaDistribution(scope.getRandom().getGenerator(), shape, scale,
            GammaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
    return dist.sample();
}

From source file:org.jreserve.jrlib.util.random.RndGammaTest.java

@Before
public void setUp() {
    rnd = new RndGamma(new JavaRandom(SEED));

    double scale = VARIANCE / MEAN;
    double shape = MEAN / scale;
    RandomGenerator rg = new JDKRandomGenerator();
    rg.setSeed(SEED);/*w w  w  . jav a 2s.c  o m*/
    gd = new GammaDistribution(rg, shape, scale, GammaDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
}