plot the kernel density estimate of a data set - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Graphics : Statistics : Statistics/KernelDensityPlot

Statistics[KernelDensityPlot] - plot the kernel density estimate of a data set

Calling Sequence

KernelDensityPlot(X, options, plotoptions)





data sample



(optional) equation(s) of the form option=value where option is one of bandwidth, bins, ignore, kernel, left, method, range, right, weights, or any standard plot options; specify options for the KernelDensityPlot command



options to be passed to the plots[display] command



The KernelDensityPlot command plots the kernel density estimate for a data sample.


The first parameter X is a single data sample - given as e.g. a Vector.


If the ['interactive'] option is used, then a dialog box appears that allows for customized creation of the plot.



The options argument can contain one or more of the options shown below. All unrecognized options will be passed to the plots[display] command. See plot[options] for details.




The bandwidth is a positive quantity that specifies the width of the kernel (the amount each data point affects distant portions of the probability density estimate).  Each kernel is scaled such that the bandwidth is equal to the standard deviation of the kernel.




The number of bins in which to categorize data points (512 by default). This value must be a power of 2 and is equal to the size of the array returned from the routine when the option method=piecewise is specified.  This parameter is ignored if method=exact.




This option is used to specify how to handle non-numeric data. If ignore is set to true all non-numeric items in data will be ignored.


kernel=gaussian, biweight, epanechnikov, triangular, or rectangular


The default value is gaussian.  This option allows a non-Gaussian kernel to be used in developing the estimate. For more information, see Statistics[KernelDensity].




This option specifies the lower boundary on valid data values. Any data values that are smaller than this value are discarded.  By default, this procedure will impose boundary conditions consistent with the specified range rng.


method=exact or piecewise


This parameter specifies the method of plotting the kernel density estimate (by default this is piecewise).  For more information, see Statistics[KernelDensity].


range=deduce or realrange


By default this is deduce.  This option is used to bound the horizontal real range on which the kernel density estimate is plotted.




This option specifies the upper boundary on valid data values. Any data values that are smaller than this value are discarded.  By default, this procedure will impose boundary conditions consistent with the specified range rng.




Vector of weights (one-dimensional rtable). If weights are given, the kernel density estimate will be scaled so each data point has the given weight. Note that the weights provided must have type realcons and the results are floating-point, even if the problem is specified with exact values. Both the data array and the weights array must have the same number of elements.



Note that the discrete case of kernel density estimation employs a discrete Fourier transform in order to calculate the kernel sums as quickly as possible.  However, this results in an estimating function which is periodic over the range left..right.  Hence estimates near these lower and upper boundaries of the range will often be more imprecise than points within this range.


Note that points that do not fall into the range left..right and missing data are not considered for this operation and are normally discarded.  If ignore=false and this procedure encounters missing data, it will spawn a userinfo message.


Note that all options specified in calling this command that are not parsed by KernelDensity are then passed to plot.



Plot the kernel density estimate of a data sample.




The command to create the plot from the Plotting Guide is





See Also

Statistics, Statistics[Computation], Statistics[KernelDensity], Statistics[KernelDensitySample]

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam