Top Description Fields Constructors Methods
org.apache.commons.math3.distribution

pack-priv final Class SaddlePointExpansion

extends Object
Class Inheritance
Imports
org.apache.commons.math3.special.Gamma, org.apache.commons.math3.util.FastMath, .MathUtils

Utility class used by various distributions to accurately compute their respective probability mass functions. The implementation for this class is based on the Catherine Loader's dbinom routines.

This class is not intended to be called directly.

References:

  1. Catherine Loader (2000). "Fast and Accurate Computation of Binomial Probabilities.". http://www.herine.net/stat/papers/dbinom.pdf

Since
2.1

Field Summary

Modifier and TypeField and Description
private static final double[]
EXACT_STIRLING_ERRORS

exact Stirling expansion error for certain values.

private static final double
HALF_LOG_2_PI

1/2 * log(2 π).

Constructor Summary

AccessConstructor and Description
private
SaddlePointExpansion()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv static double

Returns:

a part of the deviance.
getDeviancePart
(double
the x value.
x
,
double
the average.
mu
)

A part of the deviance portion of the saddle point approximation.

pack-priv static double

Returns:

the Striling's series error.
getStirlingError
(double
the value.
z
)

Compute the error of Stirling's series at the given value.

pack-priv static double

Returns:

log(p(x)).
logBinomialProbability
(int
the value at which the probability is evaluated.
x
,
int
the number of trials.
n
,
double
the probability of success.
p
,
double
the probability of failure (1 - p).
q
)

Compute the logarithm of the PMF for a binomial distribution using the saddle point expansion.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EXACT_STIRLING_ERRORSback to summary
private static final double[] EXACT_STIRLING_ERRORS

exact Stirling expansion error for certain values.

HALF_LOG_2_PIback to summary
private static final double HALF_LOG_2_PI

1/2 * log(2 π).

Constructor Detail

SaddlePointExpansionback to summary
private SaddlePointExpansion()

Default constructor.

Method Detail

getDeviancePartback to summary
pack-priv static double getDeviancePart(double x, double mu)

A part of the deviance portion of the saddle point approximation.

References:

  1. Catherine Loader (2000). "Fast and Accurate Computation of Binomial Probabilities.". http://www.herine.net/stat/papers/dbinom.pdf

Parameters
x:double

the x value.

mu:double

the average.

Returns:double

a part of the deviance.

getStirlingErrorback to summary
pack-priv static double getStirlingError(double z)

Compute the error of Stirling's series at the given value.

References:

  1. Eric W. Weisstein. "Stirling's Series." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/StirlingsSeries.html

Parameters
z:double

the value.

Returns:double

the Striling's series error.

logBinomialProbabilityback to summary
pack-priv static double logBinomialProbability(int x, int n, double p, double q)

Compute the logarithm of the PMF for a binomial distribution using the saddle point expansion.

Parameters
x:int

the value at which the probability is evaluated.

n:int

the number of trials.

p:double

the probability of success.

q:double

the probability of failure (1 - p).

Returns:double

log(p(x)).