SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.discrepancy.DiscL2Star Class Reference

Computes the traditional \(\mathcal{L}_2\)-star discrepancy \(\mathcal{D}_2^*(\mathcal{P})\) for a set of \(n\) points \(\mathcal{P}\) [226], [227],. More...

Inheritance diagram for umontreal.ssj.discrepancy.DiscL2Star:
umontreal.ssj.discrepancy.Discrepancy

Public Member Functions

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.
 DiscL2Star (double[][] points, int n, int s)
 Constructor with the \(n\) points points[i] in dimension.
 DiscL2Star (int n, int s)
 Constructor with \(n\) points in dimension \(s\).
 DiscL2Star (PointSet set)
 Constructor with the point set set.
 DiscL2Star ()
 Empty constructor.
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.
Public Member Functions inherited from umontreal.ssj.discrepancy.Discrepancy
 Discrepancy (double[][] points, int n, int s)
 Constructor with the \(n\) points points[i] in \(s\) dimensions.
 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)\).
 Discrepancy (int n, int s, double[] gamma)
 The number of points is \(n\), the dimension \(s\), and the.
 Discrepancy (PointSet set)
 Constructor with the point set set.
 Discrepancy ()
 Empty constructor.
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)
 Computes the discrepancy of all the points of points in maximum dimension.
double compute (double[] T)
 Computes the discrepancy of all the points of T in 1 dimension.
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.
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\).
void setPoints (double[][] points)
 Sets the points to points.
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 umontreal.ssj.discrepancy.Discrepancy
static double[][] toArray (PointSet set)
 Returns all the \(n\) points ( \(s\)-dimensional) of.
static DoubleArrayList sort (double[] T, int n)
 Sorts the first \(n\) points of \(T\).

Detailed Description

Computes the traditional \(\mathcal{L}_2\)-star discrepancy \(\mathcal{D}_2^*(\mathcal{P})\) for a set of \(n\) points \(\mathcal{P}\) [226], [227],.

[80] . 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_1 t_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 \(\mathcal{L}_2\) norm of \(R_n(t, P)\), that is the (REF_discrepancy_DiscL2Star_eq_discstar0)

\[ \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 the

\[ [\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 the

\[ [\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 ).

Definition at line 75 of file DiscL2Star.java.

Constructor & Destructor Documentation

◆ DiscL2Star() [1/4]

umontreal.ssj.discrepancy.DiscL2Star.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.

Definition at line 87 of file DiscL2Star.java.

◆ DiscL2Star() [2/4]

umontreal.ssj.discrepancy.DiscL2Star.DiscL2Star ( int n,
int s )

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

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

Definition at line 95 of file DiscL2Star.java.

◆ DiscL2Star() [3/4]

umontreal.ssj.discrepancy.DiscL2Star.DiscL2Star ( PointSet set)

Constructor with the point set set.

All the points are copied in an internal array.

Definition at line 103 of file DiscL2Star.java.

◆ DiscL2Star() [4/4]

umontreal.ssj.discrepancy.DiscL2Star.DiscL2Star ( )

Empty constructor.

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

Definition at line 111 of file DiscL2Star.java.

Member Function Documentation

◆ compute() [1/3]

double umontreal.ssj.discrepancy.DiscL2Star.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.

Reimplemented from umontreal.ssj.discrepancy.Discrepancy.

Definition at line 165 of file DiscL2Star.java.

◆ compute() [2/3]

double umontreal.ssj.discrepancy.DiscL2Star.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\).

Reimplemented from umontreal.ssj.discrepancy.Discrepancy.

Definition at line 120 of file DiscL2Star.java.

◆ compute() [3/3]

double umontreal.ssj.discrepancy.DiscL2Star.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.

Reimplemented from umontreal.ssj.discrepancy.Discrepancy.

Definition at line 77 of file DiscL2Star.java.


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