The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: none
Declaration: function EstimateProbDensity (const SampleData: TVector; var Probability: TVector; LowBorder, HighBorder, Smoothing, WindowWidth: double; Resolution: integer; var MinDensIx, MaxDensIx: integer; Feedback: TOnPercentDoneEvent): integer;

The procedure EstimateProbDensity estimates the probabilitiy density function using a variable kernel method based on Gaussian kernels. The widths of the kernels (and thus the overall result of the density estimation) are controlled by the parameters Smoothing and WindowWidth. The Smoothing parameter controls the overall smoothness of the density estimation by multiplying the individual kernel widths by this factor; smaller values decrease smoothing, larger values increase it.

The WindowWidth parameter specifies the width of the search window for estimating the width of the Gaussian kernel at a particular point of the distribution. As a rule of thumb the WindowWidth should be in the same range as the width of individual features of the distribution which must not be smoothed out. Setting WindowWidth to a zero value forces all kernel widths to a default value of one (no individual kernel widths are calculated).

The parameter SampleData contains the data values which are a sample of the distribution to be estimated. The results of the estimation are stored in the variable parameter Probability. The parameters LowBorder and HighBorder define the range of the density estimation, the Resolution parameter defines the number of estimates distributed over this range (the size of the Probability vector is automatically adjusted to contain Resolution values). Please note that the Resolution is restricted to a range between 10 and 10000 data points.

The variable parameters MinDensIx and MaxDensIx indicate the position of the minimum and the maximum estimated density. These values are indexes into the Probability vector. The Feedback parameter can be set to a feedback procedure in order to provide feedback to the user during time consuming calculations (i.e. when both the Resolution parameter and the size of the data vector SampleData are large). Set Feedback to NIL if you don't need any feedback.

The function returns the following error codes:

 0 ... everything is OK
-1 ... Resolution is out of range (valid range: 10 ... 10000)
-2 ... invalid smoothing parameter (valid range: >0)
Hint: More background information can be found in "B.W. Silverman, Density Estimation for Statistics and Data Analysis", Chapman and Hall, London 1986, page 21

Last Update: 2023-Feb-06