SSJ
3.3.1
Stochastic Simulation in Java
|
This class is similar to FDist, except that it provides static methods to compute or approximate the complementary distribution function of \(X\), which we define as \(\bar{F} (x) = P[X\ge x]\), instead of \(F (x)=P[X\le x]\). More...
Static Public Member Functions | |
static double | scan (int n, double d, int m) |
Return \(P[S_N (d) \ge m]\), where \(S_N (d)\) is the scan statistic(see [71], [70] and GofStat.scan ), defined as. More... | |
This class is similar to FDist, except that it provides static methods to compute or approximate the complementary distribution function of \(X\), which we define as \(\bar{F} (x) = P[X\ge x]\), instead of \(F (x)=P[X\le x]\).
Note that with our definition of \(\bar{F}\), one has \(\bar{F} (x) = 1 - F (x)\) for continuous distributions and \(\bar{F} (x) = 1 - F (x-1)\) for discrete distributions over the integers.
|
static |
Return \(P[S_N (d) \ge m]\), where \(S_N (d)\) is the scan statistic(see [71], [70] and GofStat.scan ), defined as.
\[ S_N (d) = \sup_{0\le y\le1-d} \eta[y, y+d], \tag{scan} \]
where \(d\) is a constant in \((0, 1)\), \(\eta[y, y+d]\) is the number of observations falling inside the interval \([y, y+d]\), from a sample of \(N\) i.i.d. \(U (0,1)\) random variables. One has (see [7] ),
\begin{align} P[S_N (d) \ge m] & \approx \left(\frac{m}{d}-N-1\right) b (m) + 2 \sum_{i=m}^N b (i) \tag{DistScan1} \\ & \approx 2 (1-\Phi(\theta\kappa)) + \theta\kappa\frac{\exp(-\theta^2\kappa^2 /2)}{d \sqrt{2\pi}} \tag{DistScan2} \end{align}
where \(\Phi\) is the standard normal distribution function.
\begin{align*} b (i) & = \binom{N}{i} d^i (1-d)^{N-i}, \\ \theta & = \sqrt{\frac{d}{1-d}}, \\ \kappa & = \frac{m}{d \sqrt{N}} - \sqrt{N}. \end{align*}
For \(d \le1/2\), ( DistScan1 ) is exact for \(m > N/2\), but only an approximation otherwise. The approximation ( DistScan2 ) is good when \(N d^2\) is large or when \(d > 0.3\) and \(N>50\). In other cases, this implementation sometimes use the approximation proposed by Glaz [71] . For more information, see [7], [71], [234] . The approximation returned by this function is generally good when it is close to 0, but is not very reliable when it exceeds, say, 0.4. If \(m \le(N + 1)d\), the method returns 1. Else, if \(Nd \le10\), it returns the approximation given by Glaz [71] . If \(Nd > 10\), it computes ( DistScan2 ) or ( DistScan1 ) and returns the result if it does not exceed 0.4, otherwise it computes the approximation from [71] , returns it if it is less than 1.0, and returns 1.0 otherwise. The relative error can reach 10% when \(Nd \le10\) or when the returned value is less than 0.4. For \(m > Nd\) and \(Nd > 10\), a returned value that exceeds \(0.4\) should be regarded as unreliable. For \(m = 3\), the returned values are totally unreliable. (There may be an error in the original formulae in [71] ). Restrictions: \(N \ge2\) and \(d \le1/2\).
n | sample size ( \(\ge2\)) |
d | length of the test interval ( \(\in(0,1)\)) |
m | scan statistic |
m