|
SSJ V. 1.2.5. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.gof.FDist
public class FDist
This class provides methods to compute (or approximate) the distribution functions of various types of goodness-of-fit test statistics. All the methods in this class return F(x) for some probability distribution. Recall that the distribution function of a continuous random variable X with density f is
Most distributions are implemented only in standardized form here, i.e., with the location parameter set to 0 and the scale parameter set to 1. To shift the distribution by x0 and rescale by c, it suffices to replace x by (x - x0)/c in the argument when calling the function.
Method Summary | |
---|---|
static double |
andersonDarling(int N,
double x)
Returns P[AN2 <= x], where AN2 is the Anderson-Darling statistic for a sample of independent uniforms over (0, 1). |
static double |
cramerVonMises(int N,
double x)
Returns an approximation of P[WN2 <= x], where WN2 is the Cramér-von Mises statistic for a sample of independent uniforms over (0, 1). |
static double |
kolmogorovSmirnov(int N,
double x)
Returns p(x) = P[DN <= x], where DN = max(DN+, DN-) is the two-sided Kolmogorov-Smirnov statistic for a sample of size N. |
static double |
kolmogorovSmirnovPlus(int N,
double x)
Returns p(x) = P[DN+ <= x], the distribution function of the positive Kolmogorov-Smirnov statistic. |
static double |
kolmogorovSmirnovPlusJumpOne(int N,
double a,
double x)
Similar to kolmogorovSmirnovPlus but for the case where the distribution
function F has a jump of size a at a given point x0,
is zero at the left of x0,
and is continuous at the right of x0. |
static double |
scan(int N,
double d,
int m)
Returns F(m), the distribution function of the scan statistic with parameters N and d, evaluated at m. |
static double |
watsonG(int N,
double x)
Returns an approximation of P[GN <= x], where GN is the Watson statistic defined in watsonU ,
for a sample of independent uniforms over (0, 1). |
static double |
watsonU(int N,
double x)
Returns P[U2 <= x], where U2 is the Watson statistic in the limit when N -> ∞, for a sample of independent uniforms over (0, 1). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double kolmogorovSmirnovPlus(int N, double x)
GofStat
.
The relative error on
p(x) = P[DN+ <= x] is always less than
10-5, and the relative error on 1 - p(x) is less than
10-1 when
1 - p(x) > 10-10.
The absolute error on 1 - p(x) is less than 10-11
when
1 - p(x) < 10-10.
N
- sample sizex
- positive or negative Kolmogorov-Smirnov statistic
public static double kolmogorovSmirnov(int N, double x)
Warning: for 1 < N < 10 or x in the lower tail, the approximation is bad. But the precision is at least 1 decimal digit nearly everywhere.
N
- sample sizex
- Kolmogorov-Smirnov statistic
public static double kolmogorovSmirnovPlusJumpOne(int N, double a, double x)
kolmogorovSmirnovPlus
but for the case where the distribution
function F has a jump of size a at a given point x0,
is zero at the left of x0,
and is continuous at the right of x0.
Restriction: 0 < a < 1.
N
- sample sizea
- size of the jumpx
- positive or negative Kolmogorov-Smirnov statistic
public static double cramerVonMises(int N, double x)
N
- sample sizex
- Cramér-von Mises statistic
public static double watsonU(int N, double x)
N
- sample sizex
- Watson statistic
public static double watsonG(int N, double x)
watsonU
,
for a sample of independent uniforms over (0, 1).
The approximation is computed in a similar way as for
cramerVonMises
.
To implement this method, a table of the values of
g(x) = limN -> ∞P[GN <= x] and of its derivative
was first computed by numerical integration.
For x <= 1.5, the method uses this table with cubic spline
interpolation.
For x > 1.5, it uses the empirical curve
g(x) = 1 - e19-20x.
A correction of order
1/(N)1/2, obtained
empirically from 107 simulation runs with N = 256 and also
implemented as an interpolation table with an exponential tail,
is then added.
The absolute error is estimated to be less than
0.01, 0.005, 0.002, 0.0008, 0.0005, 0.0005, 0.0005 for
N = 16, 32, 64, 128, 256, 512, 1024, respectively.
N
- sample sizex
- Watson statistic
public static double andersonDarling(int N, double x)
cramerVonMises
.
To implement this method, an interpolation table of the values of
g(x) = limN -> ∞P[AN2 <= x]
was first computed by numerical integration.
Then a linear correction in 1/N, obtained by simulation, was added.
For x <= 5.0, the method approximates
gN(x) = P[AN2 <= x] by
interpolation. For x > 5.0 (the tail of the distribution),
it uses the empirical curve
gN(x) = 1 - e-1.06x-0.56 - e-1.06x-1.03/N,
which includes an empirical correction in 1/N.
The absolute error on gN(x) is estimated to be
less than 0.001 for N > 6.
For N = 2, 3, 4, 6, it is estimated to be
less than 0.04, 0.01, 0.005, 0.002, respectively.
For N = 1, the method returns the exact value,
gN(x) = (1 - 4e-x-1)1/2 for
x >= ln(4) - 1.
N
- sample sizex
- Anderson-Darling statistic
public static double scan(int N, double d, int m)
scan
,
which computes its complementary distribution
bar(F)(m) = 1 - F(m - 1).
N
- sample size ( >= 2)d
- length of the test interval (∈(0, 1))m
- scan statistic
|
SSJ V. 1.2.5. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |