SSJ
V. labo.

umontreal.iro.lecuyer.discrepancy
Class DiscL2Star

java.lang.Object
  extended by umontreal.iro.lecuyer.discrepancy.Discrepancy
      extended by umontreal.iro.lecuyer.discrepancy.DiscL2Star

public class DiscL2Star
extends Discrepancy

This class computes the traditional L2-star discrepancy D2*(P) for a set of n points P. This discrepancy is also known as the Cramér-von Mises goodness-of-fit statistic. Let t = [t1, t2,…, ts] be the coordinates of a point in [0, 1]s and define the volume of the parallelepiped anchored at the origin as Vol ([0, t)) = t1t2ts. Let the function Rn(t, P) be defined as

Rn(t, P) = $\displaystyle {\frac{1}{n}}$j=1nI[0, t)s(zj) - Vol([0, t)),

where I[0, t)s is the indicator function of [0, t)s. Rn can be described as the difference between the number of points in [0, t)s and the volume of that subregion. The L2-star discrepancy is defined as the L2 norm of Rn(t, P), that is

D2*(P) = (∫[0, 1]sdst  Rn2(t, P))1/2

It can be calculated explicitly to give

[D2*(P)]2 = ($\displaystyle {\textstyle\frac{1}{3}}$)s - $\displaystyle {\frac{2}{n}}$i=1nk=1s($\displaystyle {\frac{{1 - z_{ik}^2}}{2}}$) + $\displaystyle {\frac{{1}}{{n^2}}}$i=1nj=1nk=1s[1 - max(zik, zjk)],

where n is the number of points of P, s is the dimension, and zik is the k-th coordinate of point i.

In one dimension, formula is equivalent to

[D2*(P)]2 = $\displaystyle {\frac{{1}}{{12n^2}}}$ + $\displaystyle {\frac{{1}}{{n}}}$i=1n(z(i) - $\displaystyle {\frac{{i - 1/2}}{n}}$)2,

where n is the number of points of P, and the z(i) are the points of P sorted in increasing order. This formula is faster to compute than the general formula.


Constructor Summary
DiscL2Star()
          Empty constructor.
DiscL2Star(double[][] points, int n, int s)
          Constructor with the n points points[i] in dimension s.
DiscL2Star(int n, int s)
          Constructor with n points in dimension s.
DiscL2Star(PointSet set)
          Constructor with the point set set.
 
Method Summary
 double compute(double[][] points, int n, int s)
          Computes the traditional L2-star discrepancy for the first n points of points, in dimension s.
 double compute(double[][] points, int n, int s, double[] gamma)
          Computes the discrepancy of the first n points of points in dimension s with weights gamma.
 double compute(double[] T, int n)
          Computes the traditional L2-star discrepancy for the set of n 1-dimensional points T, using formula above.
 
Methods inherited from class umontreal.iro.lecuyer.discrepancy.Discrepancy
compute, compute, compute, compute, compute, compute, compute, formatPoints, getDimension, getGamma, getName, getNumPoints, setGamma, setPoints, setPoints, sort, toArray, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DiscL2Star

public DiscL2Star(double[][] points,
                  int n,
                  int s)
Constructor with the n points points[i] in dimension s. points[i][j] is the j-th coordinate of point i. Both i and j start at 0.


DiscL2Star

public DiscL2Star(int n,
                  int s)
Constructor with n points in dimension s. The n points will be chosen later.


DiscL2Star

public DiscL2Star(PointSet set)
Constructor with the point set set. All the points are copied in an internal array.


DiscL2Star

public DiscL2Star()
Empty constructor. One must set the points and the dimension before calling any method.

Method Detail

compute

public double compute(double[][] points,
                      int n,
                      int s,
                      double[] gamma)
Description copied from class: Discrepancy
Computes the discrepancy of the first n points of points in dimension s with weights gamma.

Overrides:
compute in class Discrepancy

compute

public double compute(double[][] points,
                      int n,
                      int s)
Computes the traditional L2-star discrepancy for the first n points of points, in dimension s.

Specified by:
compute in class Discrepancy

compute

public double compute(double[] T,
                      int n)
Computes the traditional L2-star discrepancy for the set of n 1-dimensional points T, using formula above. The points of T must be sorted before calling this method.

Overrides:
compute in class Discrepancy

SSJ
V. labo.

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