1package umontreal.ssj.stat.density;
3import umontreal.ssj.probdist.NormalDist;
104 double sign =
getOrder() % 2 == 0 ? 1.0 : -1.0;
107 double nInv = 1.0 / (double) n;
108 double hInv = 1.0 /
getH();
110 double norma = sign * nInv * Math.pow(hInv,
getOrder() + 1.0);
112 for (
int i = 0; i < n; i++) {
113 z = (x -
data[i]) * hInv;
131 double sign =
getOrder() % 2 == 0 ? 1.0 : -1.0;
132 int k = evalPoints.length;
133 double[]
density =
new double[k];
135 double nInv = 1.0 / (double) n;
136 double hInv = 1.0 /
getH();
138 double norma = sign * nInv * Math.pow(hInv,
getOrder() + 1.0);
140 for (
int j = 0; j < k; j++) {
141 for (
int i = 0; i < n; i++) {
142 z = (evalPoints[j] -
data[i]) * hInv;
157 return "DDE [Gaussian kernel with h = " +
getH() +
"]";
173 double sign = order % 2 == 0 ? 1.0 : -1.0;
176 double nInv = 1.0 / (double) n;
177 double hInv = 1.0 / h;
179 double norma = sign * nInv * Math.pow(hInv, order + 1.0);
181 for (
int i = 0; i < n; i++) {
182 z = (x -
data[i]) * hInv;
201 public static double[]
evalDensity(
double[] evalPoints,
int order,
double h,
double[]
data) {
203 double sign = order == 0 ? 1.0 : -1.0;
204 int k = evalPoints.length;
205 double[]
density =
new double[k];
207 double nInv = 1.0 / (double) n;
208 double hInv = 1.0 / h;
210 double norma = sign * nInv * Math.pow(hInv, order + 1.0);
212 for (
int j = 0; j < k; j++) {
213 for (
int i = 0; i < n; i++) {
214 z = (evalPoints[j] -
data[i]) * hInv;
244 public static double[][]
evalDensity(
double[] evalPoints,
int order,
double h,
double[][]
data) {
246 double[][]
density =
new double[m][];
247 for (
int r = 0; r < m; r++)
Extends the class ContinuousDistribution for the normal distribution (e.g., tjoh95a (page 80)).
static double density01(double x)
Same as density(0, 1, x).
String toString()
Gives a short description of the estimator.a short description.
DEDerivativeGaussian(double h, double[] data)
Constructs a DDE with a Gaussian kernel function with bandwidth h based on the observations data.
DEDerivativeGaussian(int order, double h)
Constructs a DDE with a Gaussian kernel function of order order and bandwidth h.
static double[] evalDensity(double[] evalPoints, int order, double h, double[] data)
Evaluates the DDE of order order with bandwidth h which is defined by the observations data at each o...
static double evalDensity(double x, int order, double h, double[] data)
Evaluates the DDE of order order with bandwidth h which is defined by the observations data at the ev...
static double[][] evalDensity(double[] evalPoints, int order, double h, double[][] data)
Assume that we have independent realizations of the underlying model.
double evalDensity(double x)
Evaluates the DDE at the point x.
DEDerivativeGaussian(double h)
Constructs a DDE with a Gaussian kernel function with bandwidth h.
static double hermitePoly(int r, double x)
Computes the probabilist's Hermite polynomial of order r at x, which is defined by the recursion.
DEDerivativeGaussian(int order)
Constructs a DDE with a Gaussian kernel function of order order.
double[] evalDensity(double[] evalPoints)
Evaluates the DDE at all the points in evalPoints and the resulting values are returned in an array.
DEDerivativeGaussian(int order, double[] data)
Constructs a DDE with a Gaussian kernel function of order order based on the observations data.
DEDerivativeGaussian(int order, double h, double[] data)
Constructs a DDE with a Gaussian kernel function of order order and bandwidth h based on the observat...
This class implements a density derivative estimator (DDE) based on a kernel density estimator (KDE) ...
int getOrder()
Gives the order of the DDE.
double getH()
Gives the current bandwidth .
void setH(double h)
Sets the bandwidth to h.
void setOrder(int order)
Sets the order of the DDE to order.
double[] data
The data associated with this DensityEstimator object, if any.
Tools for univariate density estimation.