HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulestatistics-0.16.3.0Haskell2010

Statistics.Sample.KernelDensity.Simple

Deprecated. Use Statistics.Sample.KernelDensity instead.

Kernel density estimation code, providing non-parametric ways to estimate the probability density function of a sample.

The techniques used by functions in this module are relatively fast, but they generally give inferior results to the KDE function in the main Statistics.KernelDensity module (due to the oversmoothing documented for bandwidth below).

  • 3 types
  • 10 values

Simple entry points

2 declarations
valueepanechnikovPDF
  1. :: Vector v Double
  2. => Int

    Number of points at which to estimate

  3. -> v Double

    Data sample

  4. -> (Points, Vector Double)
#

Simple Epanechnikov kernel density estimator. Returns the uniformly spaced points from the sample range at which the density function was estimated, and the estimates at those points.

valuegaussianPDF
  1. :: Vector v Double
  2. => Int

    Number of points at which to estimate

  3. -> v Double

    Data sample

  4. -> (Points, Vector Double)
#

Simple Gaussian kernel density estimator. Returns the uniformly spaced points from the sample range at which the density function was estimated, and the estimates at those points.

Building blocks

0 declarations

Choosing points from a sample

newtypenewtype Points
#

Points from the range of a Sample.

Instances9Eq, Data, Read, Show, Generic, Binary, …
valuechoosePoints
  1. :: Vector v Double
  2. => Int

    Number of points to select, n

  3. -> Double

    Sample bandwidth, h

  4. -> v Double

    Input data

  5. -> Points
#

Choose a uniform range of points at which to estimate a sample's probability density function.

If you are using a Gaussian kernel, multiply the sample's bandwidth by 3 before passing it to this function.

If this function is passed an empty vector, it returns values of positive and negative infinity.

Bandwidth estimation

Compute the optimal bandwidth from the observed data for the given kernel.

This function uses an estimate based on the standard deviation of a sample (due to Deheuvels), which performs reasonably well for unimodal distributions but leads to oversmoothing for more complex ones.

Kernels

typetype Kernel = Double -> Double -> Double -> Double -> Double
#

The convolution kernel. Its parameters are as follows:

  • Scaling factor, 1/nh

  • Bandwidth, h

  • A point at which to sample the input, p

  • One sample value, v

Low-level estimation

valuesimplePDF
  1. :: Vector v Double
  2. => (Double -> Double)

    Bandwidth function

  3. -> Kernel

    Kernel function

  4. -> Double

    Bandwidth scaling factor (3 for a Gaussian kernel, 1 for all others)

  5. -> Int

    Number of points at which to estimate

  6. -> v Double

    sample data

  7. -> (Points, Vector Double)
#

A helper for creating a simple kernel density estimation function with automatically chosen bandwidth and estimation points.

References

0 declarations
  • Deheuvels, P. (1977) Estimation non paramétrique de la densité par histogrammes généralisés. Mhttp:/archive.numdam.orgarticle/RSA_1977__25_3_5_0.pdf>