KernelDensity.Estimate Method

Definition

Namespace: Numerics.NET.Statistics
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

Estimate(Vector<Double>, Kernel, Vector<Double>, Double, KernelDensityBandwidthEstimator, Double)

Estimates the density of the input
C#
public static Vector<double> Estimate(
	Vector<double> input,
	Kernel kernel,
	Vector<double> values,
	double bandwidth = NaN,
	KernelDensityBandwidthEstimator bandwidthEstimator = KernelDensityBandwidthEstimator.NormalReference,
	double bandwidthAdjustment = 1
)

Parameters

input  Vector<Double>
kernel  Kernel
The kernel to use for the estimation.
values  Vector<Double>
The value at which to estimate the density.
bandwidth  Double  (Optional)
Optional. The bandwidth.
bandwidthEstimator  KernelDensityBandwidthEstimator  (Optional)
Optional. The method used to compute the bandwidth.
bandwidthAdjustment  Double  (Optional)
Optional. A factor by which to adjust the bandwidth.

Return Value

Vector<Double>
A vector containing the estimated density at values.

Remarks

When bandwidth is supplied, it is used as the bandwidth, and the value of bandwidthEstimator is ignored. Otherwise, the method specified by bandwidthEstimator is used to estimate the bandwidth. The default is to use the normal reference bandwidth, which minimizes the integrated square error under the assumption that the data is normal.

The bandwidth is multiplied by the bandwidthAdjustment, with a default value of 1. This makes it possible to specify a bandwidth as a fraction of the estimated bandwidth.

Exceptions

ArgumentNullException

input is null.

-or-

kernel is null.

-or-

values is null.

Estimate(Vector<Double>, Kernel, Double, Double, KernelDensityBandwidthEstimator, Double)

Estimates the density of the input
C#
public static double Estimate(
	Vector<double> input,
	Kernel kernel,
	double value,
	double bandwidth = NaN,
	KernelDensityBandwidthEstimator bandwidthEstimator = KernelDensityBandwidthEstimator.NormalReference,
	double bandwidthAdjustment = 1
)

Parameters

input  Vector<Double>
kernel  Kernel
The kernel to use for the estimation.
value  Double
The value at which to estimate the density.
bandwidth  Double  (Optional)
Optional. The bandwidth.
bandwidthEstimator  KernelDensityBandwidthEstimator  (Optional)
Optional. The method used to compute the bandwidth.
bandwidthAdjustment  Double  (Optional)
Optional. A factor by which to adjust the bandwidth.

Return Value

Double
The estimated density at value.

Remarks

When bandwidth is supplied, it is used as the bandwidth, and the value of bandwidthEstimator is ignored. Otherwise, the method specified by bandwidthEstimator is used to estimate the bandwidth. The default is to use the normal reference bandwidth, which minimizes the integrated square error under the assumption that the data is normal.

The bandwidth is multiplied by the bandwidthAdjustment, with a default value of 1. This makes it possible to specify a bandwidth as a fraction of the estimated bandwidth.

Exceptions

ArgumentNullException

input is null.

-or-

kernel is null.

Estimate(Vector<Double>, Kernel, Int32, Double, Double, Double, Double, KernelDensityBandwidthEstimator, Double)

Estimates the density of the input.
C#
public static Vector<double> Estimate(
	Vector<double> input,
	Kernel kernel,
	int dataPoints = -1,
	double lowerBound = NaN,
	double upperBound = NaN,
	double padding = 3,
	double bandwidth = NaN,
	KernelDensityBandwidthEstimator bandwidthEstimator = KernelDensityBandwidthEstimator.NormalReference,
	double bandwidthAdjustment = 1
)

Parameters

input  Vector<Double>
kernel  Kernel
The kernel to use for the estimation.
dataPoints  Int32  (Optional)
Optional. The number of data points to use in the approximation.
lowerBound  Double  (Optional)
Optional. The lower bound of the interval where the density should be approximated.
upperBound  Double  (Optional)
Optional. The lower bound of the interval where the density should be approximated.
padding  Double  (Optional)
Optional. The space before the smallest element in input and after the largest element in input where the probability density should be approximated in units of the bandwidth. The default value is 3.
bandwidth  Double  (Optional)
Optional. The bandwidth.
bandwidthEstimator  KernelDensityBandwidthEstimator  (Optional)
Optional. The method used to compute the bandwidth.
bandwidthAdjustment  Double  (Optional)
Optional. A factor by which to adjust the bandwidth.

Return Value

Vector<Double>
A vector containing the estimated density at dataPoints equally spaced points extending padding bandwidths past the lowest and largest values in input.

Remarks

When bandwidth is supplied, it is used as the bandwidth, and the value of bandwidthEstimator is ignored. Otherwise, the method specified by bandwidthEstimator is used to estimate the bandwidth. The default is to use the normal reference bandwidth, which minimizes the integrated square error under the assumption that the data is normal.

The bandwidth is multiplied by the bandwidthAdjustment, with a default value of 1. This makes it possible to specify a bandwidth as a fraction of the estimated bandwidth.

If lowerBound or upperBound are not supplied, they are calculated by extending the range of input by padding times the bandwidth.

Exceptions

ArgumentNullException

input is null.

-or-

kernel is null.

See Also