SSJ
V. 2.6.

umontreal.iro.lecuyer.probdist
Class CramerVonMisesDist

java.lang.Object
  extended by umontreal.iro.lecuyer.probdist.ContinuousDistribution
      extended by umontreal.iro.lecuyer.probdist.CramerVonMisesDist
All Implemented Interfaces:
Distribution

public class CramerVonMisesDist
extends ContinuousDistribution

Extends the class ContinuousDistribution for the Cramér-von Mises distribution (see). Given a sample of n independent uniforms Ui over [0, 1], the Cramér-von Mises statistic Wn2 is defined by

Wn2 = 1/12n + ∑j=1n(U(j) - (j-0.5)/n)2,

where the U(j) are the Ui sorted in increasing order. The distribution function (the cumulative probabilities) is defined as Fn(x) = P[Wn2 <= x].


Field Summary
 
Fields inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
decPrec
 
Constructor Summary
CramerVonMisesDist(int n)
          Constructs a Cramér-von Mises distribution for a sample of size n.
 
Method Summary
 double barF(double x)
          Returns the complementary distribution function.
static double barF(int n, double x)
          Computes the complementary distribution function bar(F)n(x) with parameter n.
 double cdf(double x)
          Returns the distribution function F(x).
static double cdf(int n, double x)
          Computes the Cramér-von Mises distribution function with parameter n.
 double density(double x)
          Returns f (x), the density evaluated at x.
static double density(int n, double x)
          Computes the density function for a Cramér-von Mises distribution with parameter n.
 double getMean()
          Returns the mean.
static double getMean(int n)
          Returns the mean of the distribution with parameter n.
 int getN()
          Returns the parameter n of this object.
 double[] getParams()
          Return an array containing the parameter n of this object.
 double getStandardDeviation()
          Returns the standard deviation.
static double getStandardDeviation(int n)
          Returns the standard deviation of the distribution with parameter n.
 double getVariance()
          Returns the variance.
static double getVariance(int n)
          Returns the variance of the distribution with parameter n.
 double inverseF(double u)
          Returns the inverse distribution function x = F-1(u).
static double inverseF(int n, double u)
          Computes x = Fn-1(u), where Fn is the Cramér-von Mises distribution with parameter n.
 void setN(int n)
          Sets the parameter n of this object.
 String toString()
           
 
Methods inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
getXinf, getXsup, inverseBisection, inverseBrent, setXinf, setXsup
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CramerVonMisesDist

public CramerVonMisesDist(int n)
Constructs a Cramér-von Mises distribution for a sample of size n.

Method Detail

density

public double density(double x)
Description copied from class: ContinuousDistribution
Returns f (x), the density evaluated at x.

Specified by:
density in class ContinuousDistribution
Parameters:
x - value at which the density is evaluated
Returns:
density function evaluated at x

cdf

public double cdf(double x)
Description copied from interface: Distribution
Returns the distribution function F(x).

Parameters:
x - value at which the distribution function is evaluated
Returns:
distribution function evaluated at x

barF

public double barF(double x)
Description copied from class: ContinuousDistribution
Returns the complementary distribution function. The default implementation computes bar(F)(x) = 1 - F(x).

Specified by:
barF in interface Distribution
Overrides:
barF in class ContinuousDistribution
Parameters:
x - value at which the complementary distribution function is evaluated
Returns:
complementary distribution function evaluated at x

inverseF

public double inverseF(double u)
Description copied from class: ContinuousDistribution
Returns the inverse distribution function x = F-1(u). Restrictions: u∈[0, 1].

Specified by:
inverseF in interface Distribution
Overrides:
inverseF in class ContinuousDistribution
Parameters:
u - value at which the inverse distribution function is evaluated
Returns:
the inverse distribution function evaluated at u

getMean

public double getMean()
Description copied from class: ContinuousDistribution
Returns the mean.

Specified by:
getMean in interface Distribution
Overrides:
getMean in class ContinuousDistribution
Returns:
the mean

getVariance

public double getVariance()
Description copied from class: ContinuousDistribution
Returns the variance.

Specified by:
getVariance in interface Distribution
Overrides:
getVariance in class ContinuousDistribution
Returns:
the variance

getStandardDeviation

public double getStandardDeviation()
Description copied from class: ContinuousDistribution
Returns the standard deviation.

Specified by:
getStandardDeviation in interface Distribution
Overrides:
getStandardDeviation in class ContinuousDistribution
Returns:
the standard deviation

density

public static double density(int n,
                             double x)
Computes the density function for a Cramér-von Mises distribution with parameter n.


cdf

public static double cdf(int n,
                         double x)
Computes the Cramér-von Mises distribution function with parameter n. Returns an approximation of P[Wn2 <= x], where Wn2 is the Cramér von Mises statistic (see). The approximation is based on the distribution function of W2 = limn -> ∞Wn2, which has the following series expansion derived by Anderson and Darling:

        P(W2 <= x)  =  1#1∑j=0(- 1)j2#2(4j+1)1/2    exp{ - 3#3}K1/4([tex2html_wrap_indisplay244]),

where Kν is the modified Bessel function of the second kind. To correct for the deviation between P(Wn2 <= x) and P(W2 <= x), we add a correction in 1/n, obtained empirically by simulation. For n = 10, 20, 40, the error is less than 0.002, 0.001, and 0.0005, respectively, while for n >= 100 it is less than 0.0005. For n -> ∞, we estimate that the method returns at least 6 decimal digits of precision. For n = 1, the method uses the exact distribution: P(W12 <= x) = 2(x - 1/12)1/2 for 1/12 <= x <= 1/3.


barF

public static double barF(int n,
                          double x)
Computes the complementary distribution function bar(F)n(x) with parameter n.


inverseF

public static double inverseF(int n,
                              double u)
Computes x = Fn-1(u), where Fn is the Cramér-von Mises distribution with parameter n.


getMean

public static double getMean(int n)
Returns the mean of the distribution with parameter n.

Returns:
the mean

getVariance

public static double getVariance(int n)
Returns the variance of the distribution with parameter n.

Returns:
variance

getStandardDeviation

public static double getStandardDeviation(int n)
Returns the standard deviation of the distribution with parameter n.

Returns:
the standard deviation

getN

public int getN()
Returns the parameter n of this object.


setN

public void setN(int n)
Sets the parameter n of this object.


getParams

public double[] getParams()
Return an array containing the parameter n of this object.


toString

public String toString()
Overrides:
toString in class Object

SSJ
V. 2.6.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.