SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
DiscL2Star Class Reference

This class computes the traditional \(\mathcal{L}_2\)-star discrepancy \(\mathcal{D}_2^*(\mathcal{P})\) for a set of \(n\) points \(\mathcal{P}\) [236], [237], [83] . More...

Inheritance diagram for DiscL2Star:
[legend]
Collaboration diagram for DiscL2Star:
[legend]

Public Member Functions

double compute (double[][] points, int n, int s, double[] gamma)
 
 DiscL2Star (double[][] points, int n, int s)
 Constructor with the \(n\) points points[i] in dimension \(s\). More...
 
 DiscL2Star (int n, int s)
 Constructor with \(n\) points in dimension \(s\). More...
 
 DiscL2Star (PointSet set)
 Constructor with the point set set. More...
 
 DiscL2Star ()
 Empty constructor. More...
 
double compute (double[][] points, int n, int s)
 Computes the traditional \(\mathcal{L}_2\)-star discrepancy ( discstar ) for the first \(n\) points of points, in dimension \(s\).
 
double compute (double[] T, int n)
 Computes the traditional \(\mathcal{L}_2\)-star discrepancy for the set of \(n\) 1-dimensional points \(T\), using formula ( cramermises ) above. More...
 
- Public Member Functions inherited from Discrepancy
 Discrepancy (double[][] points, int n, int s)
 Constructor with the \(n\) points points[i] in \(s\) dimensions. More...
 
 Discrepancy (double[][] points, int n, int s, double[] gamma)
 Constructor with the \(n\) points points[i] in \(s\) dimensions and the \(s\) weight factors gamma[ \(j\)], \(j = 0, 1, …, (s-1)\). More...
 
 Discrepancy (int n, int s, double[] gamma)
 The number of points is \(n\), the dimension \(s\), and the \(s\) weight factors are gamma[ \(j\)], \(j = 0, 1, …, (s-1)\). More...
 
 Discrepancy (PointSet set)
 Constructor with the point set set. More...
 
 Discrepancy ()
 Empty constructor. More...
 
double compute ()
 Computes the discrepancy of all the points in maximal dimension (dimension of the points).
 
double compute (int s)
 Computes the discrepancy of all the 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.
 
abstract double compute (double[][] points, int n, int s)
 Computes the discrepancy of the first n points of points in dimension s with weights \(=1\).
 
double compute (double[][] points)
 Computes the discrepancy of all the points of points in maximum dimension. More...
 
double compute (double[] T, int n)
 Computes the discrepancy of the first n points of T in 1 dimension. More...
 
double compute (double[] T)
 Computes the discrepancy of all the points of T in 1 dimension. More...
 
double compute (double[] T, int n, double gamma)
 Computes the discrepancy of the first n points of T in 1 dimension with weight gamma.
 
double compute (PointSet set, double[] gamma)
 Computes the discrepancy of all the points in set in the same dimension as the point set and with weights gamma.
 
double compute (PointSet set)
 Computes the discrepancy of all the points in set in the same dimension as the point set. More...
 
int getNumPoints ()
 Returns the number of points \(n\).
 
int getDimension ()
 Returns the dimension of the points \(s\).
 
void setPoints (double[][] points, int n, int s)
 Sets the points to points and the dimension to \(s\). More...
 
void setPoints (double[][] points)
 Sets the points to points. More...
 
void setGamma (double[] gam, int s)
 Sets the weight factors to gam for each dimension up to \(s\).
 
double [] getGamma ()
 Returns the weight factors gamma for each dimension up to \(s\).
 
String toString ()
 Returns the parameters of this class.
 
String formatPoints ()
 Returns all the points of this class.
 
String getName ()
 Returns the name of the Discrepancy.
 

Additional Inherited Members

- Static Public Member Functions inherited from Discrepancy
static double [][] toArray (PointSet set)
 Returns all the \(n\) points ( \(s\)-dimensional) of umontreal.ssj.hups.PointSet set as an array points[ \(n\)][ \(s\)].
 
static DoubleArrayList sort (double[] T, int n)
 Sorts the first \(n\) points of \(T\). More...
 
- Protected Member Functions inherited from Discrepancy
void appendGamma (StringBuffer sb, double[] gamma, int s)
 
- Static Protected Member Functions inherited from Discrepancy
static void setONES (int s)
 
- Protected Attributes inherited from Discrepancy
double [] gamma
 
double [][] Points
 
int dim
 
int numPoints
 
- Static Protected Attributes inherited from Discrepancy
static double [] ONES = { 1 }
 
- Static Package Attributes inherited from Discrepancy
static final double UNSIX = 1.0/6.0
 
static final double QUARAN = 1.0/42.0
 
static final double UNTRENTE = 1.0 / 30.0
 
static final double DTIERS = 2.0 / 3.0
 
static final double STIERS = 7.0 / 3.0
 
static final double QTIERS = 14.0 / 3.0
 

Detailed Description

This class computes the traditional \(\mathcal{L}_2\)-star discrepancy \(\mathcal{D}_2^*(\mathcal{P})\) for a set of \(n\) points \(\mathcal{P}\) [236], [237], [83] .

This discrepancy is also known as the Cramér-von Mises goodness-of-fit statistic. Let \(t = [t_1, t_2, …, t_s]\) 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)) = t_1t_2 …t_s\). Let the function \(R_n(t, P)\) be defined as

\[ R_n(t, P) = \frac{1}{n} \sum_{j=1}^n I_{[0, t)^s}(z_j) - \mbox{Vol}([0,t)), \]

where \(I_{[0, t)^s}\) is the indicator function of \([0, t)^s\). \(R_n\) can be described as the difference between the number of points in \([0, t)^s\) and the volume of that subregion. The \(\mathcal{L}_2\)-star discrepancy is defined as the \(\mathcal{L}_2\) norm of \(R_n(t, P)\), that is

\[ \mathcal{D}_2^*(\mathcal{P}) = \left(\int_{[0, 1]^s} d^st\; R_n^2(t, P)\right)^{1/2} \tag{discstar0} \]

It can be calculated explicitly to give

\[ [\mathcal{D}_2^*(\mathcal{P})]^2 = \left(\frac{1}{3}\right)^s - \frac{2}{n} \sum_{i=1}^n \prod_{k=1}^s \left(\frac{1 - z_{ik}^2}{2}\right) + \frac{1}{n^2} \sum_{i=1}^n\sum_{j=1}^n \prod_{k=1}^s \left[1 - \max(z_{ik}, z_{jk})\right], \tag{discstar} \]

where \(n\) is the number of points of \(\mathcal{P}\), \(s\) is the dimension, and \(z_{ik}\) is the \(k\)-th coordinate of point \(i\).

In one dimension, formula ( discstar ) is equivalent to

\[ [\mathcal{D}_2^*(\mathcal{P})]^2 = \frac{1}{12n^2} + \frac{1}{n} \sum_{i=1}^n \left(z_{(i)} - \frac{i - 1/2}{n}\right)^2, \tag{cramermises} \]

where \(n\) is the number of points of \(\mathcal{P}\), and the \(z_{(i)}\) are the points of \(\mathcal{P}\) sorted in increasing order. This formula is faster to compute than the general formula ( discstar ).

Constructor & Destructor Documentation

◆ DiscL2Star() [1/4]

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() [2/4]

DiscL2Star ( int  n,
int  s 
)

Constructor with \(n\) points in dimension \(s\).

The \(n\) points will be chosen later.

◆ DiscL2Star() [3/4]

DiscL2Star ( PointSet  set)

Constructor with the point set set.

All the points are copied in an internal array.

◆ DiscL2Star() [4/4]

Empty constructor.

One must set the points and the dimension before calling any method.

Member Function Documentation

◆ compute()

double compute ( double []  T,
int  n 
)

Computes the traditional \(\mathcal{L}_2\)-star discrepancy for the set of \(n\) 1-dimensional points \(T\), using formula ( cramermises ) above.

The points of \(T\) must be sorted before calling this method.


The documentation for this class was generated from the following file: