Java Code Examples for org.apache.commons.math3.special.Gamma#gamma()

The following examples show how to use org.apache.commons.math3.special.Gamma#gamma() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CNLOHCaller.java    From gatk-protected with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public double value(double a) {

    // Cannot evaluate a gamma at zero, so set a to a minimum value..
    final double aPrime = Math.max(a, MIN_L);
    final double pAlpha = gammaDistribution.density(aPrime);
    final double gammaAlpha = Gamma.gamma(aPrime);

    final double numerator = pAlpha * gammaAlpha;
    final double denominator = Math.pow(Gamma.gamma(aPrime/numEffectivePhis), numEffectivePhis);
    final double coeff = numerator/denominator;

    return coeff * Math.exp((aPrime/numEffectivePhis) * sumLogEffectivePhis);
}
 
Example 2
Source File: NakagamiDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public double density(double x) {
    if (x <= 0) {
        return 0.0;
    }
    return 2.0 * FastMath.pow(mu, mu) / (Gamma.gamma(mu) * FastMath.pow(omega, mu)) *
                 FastMath.pow(x, 2 * mu - 1) * FastMath.exp(-mu * x * x / omega);
}
 
Example 3
Source File: NakagamiDistribution.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public double density(double x) {
    if (x <= 0) {
        return 0.0;
    }
    return 2.0 * FastMath.pow(mu, mu) / (Gamma.gamma(mu) * FastMath.pow(omega, mu)) *
                 FastMath.pow(x, 2 * mu - 1) * FastMath.exp(-mu * x * x / omega);
}
 
Example 4
Source File: NakagamiDistribution.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double getNumericalMean() {
    return Gamma.gamma(mu + 0.5) / Gamma.gamma(mu) * FastMath.sqrt(omega / mu);
}
 
Example 5
Source File: NakagamiDistribution.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double getNumericalVariance() {
    double v = Gamma.gamma(mu + 0.5) / Gamma.gamma(mu);
    return omega * (1 - 1 / mu * v * v);
}
 
Example 6
Source File: NakagamiDistribution.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double getNumericalMean() {
    return Gamma.gamma(mu + 0.5) / Gamma.gamma(mu) * FastMath.sqrt(omega / mu);
}
 
Example 7
Source File: NakagamiDistribution.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** {@inheritDoc} */
public double getNumericalVariance() {
    double v = Gamma.gamma(mu + 0.5) / Gamma.gamma(mu);
    return omega * (1 - 1 / mu * v * v);
}