| Statistics Toolbox | ![]() |
Compute density estimate using a kernel smoothing method
Syntax
[f,xi] = ksdensity(x) f = ksdensity(x,xi) [f,xi,u] = ksdensity(...) [...] = ksdensity(...,'param1',val1,'param2',val2,...)
Description
[f,xi] = ksdensity(x)
computes a probability density estimate of the sample in the vector x. f is the vector of density values evaluated at the points in xi. The estimate is based on a normal kernel function, using a window parameter ('width') that is a function of the number of points in x. The density is evaluated at 100 equally-spaced points covering the range of the data in x.
f = ksdensity(x,xi)
specifies the vector xi of values where the density estimate is to be evaluated.
[f,xi,u] = ksdensity(...)
also returns the width of the kernel smoothing window.
[...] = ksdensity(...,'param1',val1,'param2',val2,...)
specifies parameter name/value pairs to control the density estimation. Valid parameters and their possible values are:
Examples
This example generates a mixture of two normal distributions, and plots the estimated density.
See Also
References
[1] Bowman, A.W. and A. Azzalini, Applied Smoothing Techniques for Data Analysis, Oxford University Press, 1997.
| kruskalwallis | kstest | ![]() |