- All Implemented Interfaces:
RealValuedDomainOps
The χ2 distribution is the distribution of the sum of the squares of k independent random variables, each with a normal distribution and with unit variances. For the default statistic, the means of these variables are zero. For a noncentral statistic, the means are nonzero.
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.
For non-central χ2 distributions, the the notation in Abramowitz and Stegun (See Equation 26.4.25) is followed. This corresponds to the case where, when there are k degrees of freedom, $\mu_i$ μi is the mean value of the random variable $X_i$, and the random variable described by the distribution is $\chi^2 = \sum_{i=1}^k X_i^2$. The parameter λ is the noncentrality parameter and is given by $\lambda = \sum_{i=1}^k \mu_i^2$.
-
Constructor Summary
ConstructorsConstructorDescriptionChiSquareDistr(long nu) Constructor.ChiSquareDistr(long nu, double lambda) Constructor for a non-central χ2 distribution. -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine if the domain minimum is in the domain.longGet the number of degrees of freedom.doubleGet the minimum value in the domain of the function.doubleGet the non-centrality parameter.booleanDetermine if this object is a non-central χ2 distribution.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 chi2, long nu) Get the cumulative probability for a χ2 distribution.static doubleP(double chi2, long nu, double lambda) Get the cumulative probability distribution for a non-central χ2 distribution.doublepd(double x) Get the probability densitystatic doublepd(double chi2, long nu) Get the probability density for a χ2 distribution.static doublepd(double chi2, long nu, double lambda) Get the probability density for a non-central χ2 distribution.doubleQ(double x) Get the probability that a value is no smaller than the argumentstatic doubleQ(double chi2, long nu) Get the complement of the cumulative probability for a χ2 distribution.static doubleQ(double chi2, long nu, double lambda) Get the complement of the cumulative probability distribution for a non-central χ2 distribution.Methods inherited from class org.bzdev.math.stats.ProbDistribution
A, cdf, cdfc, domainMaxClosed, getDomainMax, inverseA, inverseP, inverseQ, isInDomain
-
Constructor Details
-
ChiSquareDistr
public ChiSquareDistr(long nu) Constructor.- Parameters:
nu- the number of degrees of freedom
-
ChiSquareDistr
public ChiSquareDistr(long nu, double lambda) Constructor for a non-central χ2 distribution. λ is defined as the sum of the squares of the means of the random variables whose squares are summed.- Parameters:
nu- the number of degrees of freedomlambda- the non-centrality parameter for the distribution
-
-
Method Details
-
getDegreesOfFreedom
public long getDegreesOfFreedom()Get the number of degrees of freedom.- Returns:
- the number of degrees of freedom
-
isNonCentral
public boolean isNonCentral()Determine if this object is a non-central χ2 distribution.- Returns:
- true if this object is a non-central χ2 distribution; false otherwise.
-
getLambda
public double getLambda()Get the non-centrality parameter.- Returns:
- the non-centrality parameter
- Throws:
IllegalStateException- this object is not a non-central χ2 distribution
-
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
-
getDomainMin
public double getDomainMin()Description copied from interface:RealValuedDomainOpsGet the minimum value in the domain of the function.- Specified by:
getDomainMinin interfaceRealValuedDomainOps- Overrides:
getDomainMinin classProbDistribution- Returns:
- the minimum value
-
domainMinClosed
public boolean domainMinClosed()Description copied from interface:RealValuedDomainOpsDetermine if the domain minimum is in the domain.- Specified by:
domainMinClosedin interfaceRealValuedDomainOps- Overrides:
domainMinClosedin classProbDistribution- Returns:
- true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
-
pd
public static double pd(double chi2, long nu) Get the probability density for a χ2 distribution.- Parameters:
chi2- the χ2 valuenu- the number of degrees of freedom- Returns:
- the χ2 probability density
-
P
public static double P(double chi2, long nu) Get the cumulative probability for a χ2 distribution.- Parameters:
chi2- the χ2 valuenu- the number of degrees of freedom- Returns:
- the corresponding value of the cumulative probability distribution
-
Q
public static double Q(double chi2, long nu) Get the complement of the cumulative probability for a χ2 distribution.- Parameters:
chi2- the χ2 valuenu- the number of degrees of freedom- Returns:
- a value mathematically equal to 1 - P(chi2, nu)
-
pd
public static double pd(double chi2, long nu, double lambda) Get the probability density for a non-central χ2 distribution.- Parameters:
chi2- the χ2 valuenu- the number of degrees of freedomlambda- the non-centrality parameter for the distribution- Returns:
- the value of the noncentral χ2 probability density for the specified parameters
-
P
public static double P(double chi2, long nu, double lambda) Get the cumulative probability distribution for a non-central χ2 distribution.- Parameters:
chi2- the χ2 valuenu- the number of degrees of freedomlambda- the non-centrality parameter for the distribution- Returns:
- the value of the cummulative distribution function for the specified parameters
-
Q
public static double Q(double chi2, long nu, double lambda) Get the complement of the cumulative probability distribution for a non-central χ2 distribution.- Parameters:
chi2- the χ2 valuenu- the number of degrees of freedomlambda- the non-centrality parameter for the distribution- Returns:
- the value of the complement of the cummulative distribution function for the specified parameters
-