java.lang.Object
org.bzdev.math.stats.ProbDistribution
org.bzdev.math.stats.GaussianDistr
- All Implemented Interfaces:
RealValuedDomainOps
Class providing methods for Gaussian/Normal distributions.
The use of A, P and Q follows the convention in Abramowitz and
Stegun, "Handbook of Mathematical Functions" (10th printing [1972],
9th Dover printing), chapter 26. Some of the methods have names
that start with an upper-case letter, contrary to the usual Java
convention, in order to conform to this text.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.GaussianDistr(double mu, double sigma) Constructor given a mean and standard deviation. -
Method Summary
Modifier and TypeMethodDescriptiondoubleA(double x) Get the probability that a value is within the range [-x, x].static doubleA(double x, double mu, double sigma) Compute the probability that a value deviates from 0 by no more than a specified amount given a Gaussian distribution with a variance of σ2 and a mean of μ.booleanisSymmetric(double x) Determine if this distribution is symmetric about x.doubleP(double x) Get the probability that a value is no larger than the argumentstatic doubleP(double x, double mu, double sigma) Compute the cumulative probability function for a Gaussian distribution with a variance of σ2 and a mean of μ.doublepd(double x) Get the probability densitystatic doublepd(double x, double mu, double sigma) Compute the probability density for a Gaussian distribution with a variance of σ2 and a mean of μ.doubleQ(double x) Get the probability that a value is no smaller than the argumentstatic doubleQ(double x, double mu, double sigma) Compute the complement of the cumulative probability function for a Gaussian distribution with a variance of σ2 and a mean of μ.Methods inherited from class org.bzdev.math.stats.ProbDistribution
cdf, cdfc, domainMaxClosed, domainMinClosed, getDomainMax, getDomainMin, inverseA, inverseP, inverseQ, isInDomain
-
Constructor Details
-
GaussianDistr
public GaussianDistr()Constructor. The mean is 0.0 and the standard deviation is 1.0. -
GaussianDistr
public GaussianDistr(double mu, double sigma) Constructor given a mean and standard deviation.- Parameters:
mu- the mean value for the distribution (μ)sigma- the standard deviation for the distribution (σ)
-
-
Method Details
-
isSymmetric
public boolean isSymmetric(double x) Description copied from class:ProbDistributionDetermine if this distribution is symmetric about x. A distribution is symmetric if its probability density f satisfies f(x+y) = f(x-y) and that if x+y is in f's domain, so is x-y. Equivalently, it must satisfy Q(x+y) = P(x-y).- Specified by:
isSymmetricin classProbDistribution- Parameters:
x- the point about which to test if this distribution is symmaetric- Returns:
- true if it is symmetric; false otherwise.
-
pd
public double pd(double x) Description copied from class:ProbDistributionGet the probability density- Overrides:
pdin classProbDistribution- Parameters:
x- the value for which the density is to be computed- Returns:
- the probability density
-
P
public double P(double x) Description copied from class:ProbDistributionGet the probability that a value is no larger than the argument- Specified by:
Pin classProbDistribution- Parameters:
x- the argument- Returns:
- the probability
-
Q
public double Q(double x) Description copied from class:ProbDistributionGet the probability that a value is no smaller than the argument- Overrides:
Qin classProbDistribution- Parameters:
x- the argument- Returns:
- the probability
-
A
public double A(double x) Description copied from class:ProbDistributionGet the probability that a value is within the range [-x, x]. This method is meaningful for distributions that are symmetric about 0. When this is not the case, an UnsupportedOperationException should be thrown.- Overrides:
Ain classProbDistribution- Parameters:
x- the argument- Returns:
- the probability that a value is in the range [-x, x]
-
pd
public static double pd(double x, double mu, double sigma) Compute the probability density for a Gaussian distribution with a variance of σ2 and a mean of μ.- Parameters:
x- a value in the range [-∞,∞]mu- the mean μsigma- the standard deviation σ- Returns:
- the probability density
-
P
public static double P(double x, double mu, double sigma) Compute the cumulative probability function for a Gaussian distribution with a variance of σ2 and a mean of μ.- Parameters:
x- a value in the range [-∞,∞]mu- the mean μsigma- the standard deviation σ- Returns:
- the cumulative probability P(x,μ,σ)
-
Q
public static double Q(double x, double mu, double sigma) Compute the complement of the cumulative probability function for a Gaussian distribution with a variance of σ2 and a mean of μ. This is equal to 1 - P(x,μ σ) when the computation is exact.- Parameters:
x- a value in the range [-∞,∞]mu- the mean μsigma- the standard deviation σ- Returns:
- the complement, 1 - P(x,μ σ), of the cumulative probability
-
A
public static double A(double x, double mu, double sigma) Compute the probability that a value deviates from 0 by no more than a specified amount given a Gaussian distribution with a variance of σ2 and a mean of μ. of 1.0. The probability is equal to the integral of the probability density from -x to x.- Parameters:
x- the maximum value for an interval.mu- the mean μsigma- the standard deviation σ- Returns:
- the probability that a value is in the range [-x,x]
-