public class ChiSquareDistribution extends AbstractDistribution implements ExponentialFamily
The chi-square distribution has numerous applications in inferential statistics, for instance in chi-square tests and in estimating variances. Many other statistical tests also lead to a use of this distribution, like Friedman's analysis of variance by ranks.
Modifier and Type | Field and Description |
---|---|
int |
nu
The degrees of freedom.
|
Constructor and Description |
---|
ChiSquareDistribution(int nu)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
cdf(double x)
Cumulative distribution function.
|
double |
entropy()
Shannon entropy of the distribution.
|
int |
length()
The number of parameters of the distribution.
|
double |
logp(double x)
The density at x in log scale, which may prevents the underflow problem.
|
Mixture.Component |
M(double[] x,
double[] posteriori)
The M step in the EM algorithm, which depends the specific distribution.
|
double |
mean()
The mean of distribution.
|
double |
p(double x)
The probability density function for continuous distribution
or probability mass function for discrete distribution at x.
|
double |
quantile(double p)
The quantile, the probability to the left of quantile is p.
|
double |
rand()
Generates a random number following this distribution.
|
double |
sd()
The standard deviation of distribution.
|
java.lang.String |
toString() |
double |
variance()
The variance of distribution.
|
inverseTransformSampling, quantile, quantile, rejection
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
likelihood, logLikelihood, rand
public ChiSquareDistribution(int nu)
nu
- the degree of freedom.public int length()
Distribution
length
in interface Distribution
public double mean()
Distribution
mean
in interface Distribution
public double variance()
Distribution
variance
in interface Distribution
public double sd()
Distribution
sd
in interface Distribution
public double entropy()
Distribution
entropy
in interface Distribution
public java.lang.String toString()
toString
in class java.lang.Object
public double rand()
Distribution
rand
in interface Distribution
public double p(double x)
Distribution
p
in interface Distribution
public double logp(double x)
Distribution
logp
in interface Distribution
public double cdf(double x)
Distribution
cdf
in interface Distribution
public double quantile(double p)
Distribution
quantile
in interface Distribution
public Mixture.Component M(double[] x, double[] posteriori)
ExponentialFamily
M
in interface ExponentialFamily
x
- the input data for estimationposteriori
- the posteriori probability.