This class provides methods to construct a kernel density estimator (KDE) for univariate densities from a set of \(n\) individual observations \(x_0,\dots, x_{n-1}\), and to evaluate it at a single point or at a set of selected evaluation points.
More...
|
static double | evalDensity (double x, ContinuousDistribution kernel, double h, double[] data, double eps) |
| Evaluates the KDE with kernel density functionkernel, bandwidth h which is defined by the observations data at the evaluation point x. More...
|
|
static double [] | evalDensity (double[] evalPoints, ContinuousDistribution kernel, double h, double[] data, double eps) |
| Evaluates the KDE with kernel density functionkernel, bandwidth h which is defined by the observations data at each of the evaluation points evalPoints and returns the results in an array. More...
|
|
static double [][] | evalDensity (double[] evalPoints, ContinuousDistribution kernel, double h, double[][] data, double eps) |
| Assume that we have \(m\) independent realizations of the underlying model. More...
|
|
static void | evalDensity (ArrayList< DensityEstimator > listDE, double[] evalPoints, double[][] data, ArrayList< double[][]> listDensity) |
| This function is particularly designed for experiments with many different types of density estimators, as it evaluates all of these estimators at the points in evalPoints. More...
|
|
static double [] | computeVariance (double[][] density) |
| This method computes the empirical variance based on the values given in data. More...
|
|
static double | computeIV (double[][] density, double a, double b, double[] variance) |
| This method estimates the empirical IV over the interval \([a,b]\). More...
|
|
static void | computeIV (ArrayList< double[][]> listDensity, double a, double b, ArrayList< Double > listIV) |
| This method estimates the empirical IV over the interval \([a,b]\) for a collection of different estimators. More...
|
|
static double [] | computeMISE (ContinuousDistribution dist, double[] evalPoints, double[][] density, double a, double b, double[] variance, double[] sqBias, double[] mse) |
| In situations where the true density is known this method can estimate the empirical MISE over the interval \([a,b]\). More...
|
|
static void | computeMISE (ContinuousDistribution dist, double[] evalPoints, ArrayList< double[][]> listDensity, double a, double b, ArrayList< double[]> listMISE) |
| This method estimates the empirical MISE over the interval \([a,b]\) for a collection of different estimators. More...
|
|
static String | plotDensity (double[] evalPoints, double[] density, String plotTitle, String[] axisTitles) |
| Gives a plot of the estimated density. More...
|
|
static double | roughnessFunctional (double[] density, double a, double b) |
| Estimates the roughness functional. More...
|
|
This class provides methods to construct a kernel density estimator (KDE) for univariate densities from a set of \(n\) individual observations \(x_0,\dots, x_{n-1}\), and to evaluate it at a single point or at a set of selected evaluation points.
The observations can be collected data or realizations of a umontreal.ssj.mcqmctools.MonteCarloModelDouble, for instance.
The KDE takes a fixed bandwidth \( h>0\) as well as a kernel function \(k\), which is also referred to as kernel density. The kernel density should be non-negative and integrate to one. For \(x\in[a,b]\), the KDE itself is defined as
\[ \hat{f}_{n}(x) = \hat{f}_{n,h}(x) = \frac{1}{nh} \sum_{i = 0}^{n-1} k\left( \frac{x - x_i}{h} \right). \tag{KDE} \]
This class also offers static methods so that the user can simply evaluate the density based on a set of observations without having to construct a KDE.
double [] evalDensity |
( |
double [] |
evalPoints | ) |
|
Evaluates the KDE at each of the evaluation points evalPoints and returns the results in an array.
Each summand w.r.t. \(i\) in ( KDE ) is only considered if it is larger than \(\varepsilon\) .
For this method the kernel function \(K\) is assumed to be unimodal, i.e. increasing and then decreasing, and that the points in evalPoints are sorted in increasing order. This allows this method to avoid looping over all \(i\) for each evaluation point by remembering that some summands have already been deemed too small.
- Parameters
-
evalPoints | the evaluation points. |
- Returns
- the value of the KDE at evalPoints.
static double [] evalDensity |
( |
double [] |
evalPoints, |
|
|
ContinuousDistribution |
kernel, |
|
|
double |
h, |
|
|
double [] |
data, |
|
|
double |
eps |
|
) |
| |
|
static |
Evaluates the KDE with kernel density functionkernel, bandwidth h which is defined by the observations data at each of the evaluation points evalPoints and returns the results in an array.
Each summand w.r.t. \(i\) in ( KDE ) is only considered if it is larger than \(\varepsilon\) .
For this method the kernel function \(K\) is assumed to be unimodal, i.e. increasing and then decreasing, and that the points in evalPoints are sorted in increasing order. This allows this method to avoid looping over all \(i\) for each evaluation point by remembering that some summands have already been deemed too small.
- Parameters
-
evalPoints | the evaluation points. |
kernel | the kernel density function. |
h | the bandwidth. |
data | the observations. |
eps | the threshold level. |
- Returns
- the KDE defined by the above parameters evaluated at the evaluation points evalPoints.
static double [][] evalDensity |
( |
double [] |
evalPoints, |
|
|
ContinuousDistribution |
kernel, |
|
|
double |
h, |
|
|
double |
data[][], |
|
|
double |
eps |
|
) |
| |
|
static |
Assume that we have \(m\) independent realizations of the underlying model.
For each such realization this method evaluates a KDE with kernel density functionkernel, bandwidth h at the points from evalPoints. The independent realizations are passed via the 2-dimensional \(m\times n\) array data, where \(n\) denotes the number of observations per realization. Hence, its first index identifies the independent realization while its second index identifies a specific observation of this realization.
The result is returned as a \(m\times k\) matrix, where \(k \) is the number of evaluation points, i.e., the length of evalPoints. The first index, again, identifies the independent realization whereas the second index corresponds to the point of evalPoints at which the KDE was evaluated.
For this method the kernel function \(K\) is assumed to be unimodal, i.e. increasing and then decreasing, and that the points in evalPoints are sorted in increasing order. For a specific observation, this allows this method to avoid looping over all \(i\) for each evaluation point by remembering that some summands have already been deemed too small.
- Parameters
-
evalPoints | the evaluation points. |
kernel | the kernel density function. |
h | the bandwidth. |
data | the two-dimensional array of observations. |
eps | the threshold level. |
- Returns
- the KDE for each realization evaluated at evalPoints.