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 DistributionApproximation
public double[] evaluate(double[] x)
x
- an array of data pointspublic double[] evaluate(double[] x, int index)
x
- index
- public double[] getPoints()
DistributionApproximation
getPoints
in interface DistributionApproximation
public int getNumberOfPoints()
DistributionApproximation
getNumberOfPoints
in interface DistributionApproximation
public Bandwidth getBandwidth()
public org.apache.commons.math3.analysis.UnivariateFunction getInterpolater()
public org.apache.commons.math3.analysis.UnivariateFunction getInterpolater2()
public double getPointAt(int index)
DistributionApproximation
getPointAt
in interface DistributionApproximation
index
- array index of evaluation points.public double getDensityAt(int index)
DistributionApproximation
getDensityAt
in interface DistributionApproximation
index
- array index of density value.public void setDensityAt(int index, double value)
setDensityAt
in interface DistributionApproximation
public void setPointAt(int index, double value)
setPointAt
in interface DistributionApproximation
public double getMinimum()
getMinimum
in interface DistributionApproximation
public double getMaximum()
getMaximum
in interface DistributionApproximation
public double getMean()
getMean
in interface DistributionApproximation
public double getStandardDeviation()
getStandardDeviation
in interface DistributionApproximation
public double[] standardize(boolean keepPoints)
standardize
in interface DistributionApproximation
keepPoints
- 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.