public class KernelDensity extends java.lang.Object implements DistributionApproximation
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
interpolatorUpdateNeeded |
| Constructor and Description |
|---|
KernelDensity(KernelFunction kernel,
Bandwidth h,
UniformDistributionApproximation uniform) |
| Modifier and Type | Method and Description |
|---|---|
double[] |
evaluate()
Call this method when using the incremental update to the density estimator.
|
double[] |
evaluate(double[] x)
Call tihs method when not using the incremental update.
|
double[] |
evaluate(double[] x,
int index)
Leave one out kernel evaluate estimate.
|
Bandwidth |
getBandwidth()
Bandwith
|
double |
getDensityAt(int index)
Gets an elements from the array of density values.
|
org.apache.commons.math3.analysis.UnivariateFunction |
getInterpolater() |
org.apache.commons.math3.analysis.UnivariateFunction |
getInterpolater2()
Returns interpolator for squared evaluate
|
double |
getMaximum() |
double |
getMean() |
double |
getMinimum() |
int |
getNumberOfPoints()
Number of evaluation points (and corresponding number of density values) in this approximation.
|
double |
getPointAt(int index)
Gets an element from the array of evaluation points.
|
double[] |
getPoints()
Gets an array of evaluation points.
|
double |
getStandardDeviation() |
void |
increment(double x)
Incremental computation of the density.
|
void |
setDensityAt(int index,
double value) |
void |
setPointAt(int index,
double value) |
double[] |
standardize(boolean keepPoints)
Uses current quadrature points and weights to compute the mean and standard deviation of the
density, and tehn standardizes the distribution to have a mean of zero and a standard deviation of one.
|
public KernelDensity(KernelFunction kernel, Bandwidth h, UniformDistributionApproximation uniform)
public void increment(double x)
x - a data pointpublic double[] evaluate()
evaluate in interface DistributionApproximationpublic double[] evaluate(double[] x)
x - an array of data pointspublic double[] evaluate(double[] x,
int index)
x - index - public double[] getPoints()
DistributionApproximationgetPoints in interface DistributionApproximationpublic int getNumberOfPoints()
DistributionApproximationgetNumberOfPoints in interface DistributionApproximationpublic Bandwidth getBandwidth()
public org.apache.commons.math3.analysis.UnivariateFunction getInterpolater()
public org.apache.commons.math3.analysis.UnivariateFunction getInterpolater2()
public double getPointAt(int index)
DistributionApproximationgetPointAt in interface DistributionApproximationindex - array index of evaluation points.public double getDensityAt(int index)
DistributionApproximationgetDensityAt in interface DistributionApproximationindex - array index of density value.public void setDensityAt(int index,
double value)
setDensityAt in interface DistributionApproximationpublic void setPointAt(int index,
double value)
setPointAt in interface DistributionApproximationpublic double getMinimum()
getMinimum in interface DistributionApproximationpublic double getMaximum()
getMaximum in interface DistributionApproximationpublic double getMean()
getMean in interface DistributionApproximationpublic double getStandardDeviation()
getStandardDeviation in interface DistributionApproximationpublic double[] standardize(boolean keepPoints)
standardize in interface DistributionApproximationkeepPoints - if true original points are retained and weights are computed at these points using
linear interpolation of the empirical cumulative distribution. If false, original weights
are retained and standardization is achieved by linearly transforming the original points.