Example usage for org.apache.commons.math3.distribution BetaDistribution BetaDistribution

List of usage examples for org.apache.commons.math3.distribution BetaDistribution BetaDistribution

Introduction

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

Prototype

public BetaDistribution(double alpha, double beta) 

Source Link

Document

Build a new instance.

Usage

From source file:com.itemanalysis.psychometrics.irt.estimation.ItemParamPriorBeta.java

public ItemParamPriorBeta(double alpha, double beta) {
    this.alpha = alpha;
    this.beta = beta;
    betaDistribution = new BetaDistribution(alpha, beta);
}

From source file:com.mgmtp.perfload.core.client.util.BetaDistWaitingTimeStrategy.java

@Override
public long calculateWaitingTime() {
    BetaDistribution betaDist = new BetaDistribution(betaDistParamA, betaDistParamB);
    double probability = betaDist.cumulativeProbability(Math.random());
    return calculateNormedValue(probability);
}

From source file:bide.prior.PriorBeta.java

/**
 * Build a new instance./*from w  ww . j a v  a  2 s  .com*/
 * 
 * @param alpha
 *            first shape parameter (must be positive)
 * @param beta
 *            second shape parameter (must be positive)
 */

public PriorBeta(double alpha, double beta) {
    this.alpha = alpha;
    this.beta = beta;
    z = Double.NaN;
    bDist = new BetaDistribution(alpha, beta);

}

From source file:jasima.core.random.continuous.DblBeta.java

public DblBeta(double alpha, double beta) {
    super();
    setDistribution(new BetaDistribution(alpha, beta));
}

From source file:gedi.lfc.gui.LfcMapper.java

@Override
public PixelBlockToValuesMap map(ReferenceSequence reference, GenomicRegion region,
        PixelLocationMapping pixelMapping, PixelBlockToValuesMap data) {

    double[] counts = new double[2];

    PixelBlockToValuesMap re = new PixelBlockToValuesMap(data.getBlocks(), 2, NumericArrayType.Double);
    for (int i = 0; i < pixelMapping.size(); i++) {
        NumericArray in = data.getValues(i);
        Arrays.fill(counts, 0);// w ww .  ja va 2 s.  c om

        for (int c = 0; c < in.length(); c++) {
            int cond = contrast == null ? (c * 2) / in.length() : contrast.getMappedIndex(c);
            if (cond != -1)
                counts[cond] += in.getDouble(c);
        }
        NumericArray out = re.getValues(i);
        if (ArrayUtils.max(counts) > 0) {
            //            out.set(0, Math.log(counts[0]/counts[1])/Math.log(2));

            BetaDistribution dist = new BetaDistribution(counts[0] + 1, counts[1] + 1);
            out.set(0, pToLfc(dist.inverseCumulativeProbability(lower)));
            out.set(1, pToLfc(dist.inverseCumulativeProbability(upper)));
        } else {
            out.setDouble(0, Double.NaN);
            out.setDouble(1, Double.NaN);
        }
    }

    return re;
}

From source file:distributions.Beta.java

public void process(int pickedinstances, int totalinstances, int deletedattribute) {
    double value;
    BetaDistribution bd = new BetaDistribution(alfa, beta);
    for (int row = 0; row < data.length; row++) {
        //value = getBetaDistribution(b, row, alfa, beta);
        value = bd.density(normalizedData[row]);
        Prob[row] = value;/*from   ww w  .j a  va 2s. co  m*/
        System.out.println(Prob[row]);
    }

    double total = 0;
    for (int row = 0; row < data.length; row++) {
        total = total + Prob[row];

    }
    System.out.println(total);
    findpairs(pickedinstances, totalinstances);
    deletedata(deletedattribute);
    generateCSVFile();
}

From source file:jasima.core.random.continuous.DblBeta.java

/**
 * Sets the parameter value for the distribution's shape parameter
 * {@code alpha}./*ww w  .j av a 2 s .c om*/
 * 
 * @param alpha
 *            The alpha value to use.
 * @throws NotStrictlyPositiveException
 *             If {@code alpha} was {@code <=0}.
 */
public void setAlpha(double alpha) throws NotStrictlyPositiveException {
    setDistribution(new BetaDistribution(alpha, getBeta()));
}

From source file:edu.upf.bioevo.manhattanPlotter.QQPlot.java

void setExperiment(Experiment experiment) {
    this.experiment = experiment;

    // Creates ordered array with log10 observed values
    orderedLog10ObservedValues = new double[experiment.tests.length];
    for (int i = 0; i < experiment.tests.length; i++) {
        orderedLog10ObservedValues[i] = experiment.tests[i].logPValue;
    }/*from  w  w  w.j  av  a2s .c o  m*/
    Arrays.sort(orderedLog10ObservedValues);
    maxObservedLogValue = orderedLog10ObservedValues[orderedLog10ObservedValues.length - 1];

    // Creates ordered array with log10 exepected values
    orderedLog10ExpectedValues = new double[experiment.tests.length];
    for (int i = experiment.tests.length; i > 0; i--) {
        orderedLog10ExpectedValues[experiment.tests.length - i] = -Math
                .log10((double) i / (experiment.tests.length + 1));
    }
    maxExpectedLogValue = orderedLog10ExpectedValues[orderedLog10ExpectedValues.length - 1];

    // Creates CI95 upper and lower values
    if (ic95Option) {
        lowerCI = new double[experiment.tests.length];
        upperCI = new double[experiment.tests.length];

        for (int i = experiment.tests.length - 1; i >= 0; i--) {
            BetaDistribution beta = new BetaDistribution(i + 1, experiment.tests.length - i);
            lowerCI[i] = -Math.log10(beta.inverseCumulativeProbability(0.025));
            upperCI[i] = -Math.log10(beta.inverseCumulativeProbability(0.975));
        }
        Arrays.sort(lowerCI);
        Arrays.sort(upperCI);
    }

}

From source file:fi.smaa.jsmaa.model.BetaMeasurement.java

@Override
public Interval getRange() {
    BetaDistribution dist = new BetaDistribution(alpha, beta);
    double lowEnd = convertToRange(dist.inverseCumulativeProbability(0.025));
    double highEnd = convertToRange(dist.inverseCumulativeProbability(0.975));
    return new Interval(lowEnd, highEnd);
}

From source file:jasima.core.random.continuous.DblBeta.java

/**
 * Sets the shape parameter {@code beta} of the distribution.
 * //ww  w .j av  a2  s .c  om
 * @param beta
 *            The {@code beta} parameter value to use.
 * @throws NotStrictlyPositiveException
 *             If {@code beta} was {@code <=0}.
 */
public void setBeta(double beta) throws NotStrictlyPositiveException {
    setDistribution(new BetaDistribution(getAlpha(), beta));
}