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 TypeMethodDescriptiondouble
A
(double x) Get the probability that a value is within the range [-x, x].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 μ.boolean
isSymmetric
(double x) Determine if this distribution is symmetric about x.double
P
(double x) Get the probability that a value is no larger than the argumentstatic 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 μ.double
pd
(double x) Get the probability densitystatic 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 μ.double
Q
(double x) Get the probability that a value is no smaller than the argumentstatic 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 μ.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:ProbDistribution
Determine 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:
isSymmetric
in 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:ProbDistribution
Get the probability density- Overrides:
pd
in 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:ProbDistribution
Get the probability that a value is no larger than the argument- Specified by:
P
in classProbDistribution
- Parameters:
x
- the argument- Returns:
- the probability
-
Q
public double Q(double x) Description copied from class:ProbDistribution
Get the probability that a value is no smaller than the argument- Overrides:
Q
in classProbDistribution
- Parameters:
x
- the argument- Returns:
- the probability
-
A
public double A(double x) Description copied from class:ProbDistribution
Get 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:
A
in 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]
-