freealg.kde#
- freealg.kde(eig, xs, lam_m, lam_p, h, kernel='beta', plot=False)#
Kernel density estimation of eigenvalues.
- Parameters:
- eignumpy.array
1D array of samples of size n.
- xsnumpy.array
1D array of evaluation grid (must lie within
[lam_m, lam_p])- lam_mfloat
Lower end of the support endpoints with
lam_m < lam_p.- lam_pfloat
Upper end of the support endpoints with
lam_m < lam_p.- hfloat
Kernel bandwidth in rescaled units where
0 < h < 1.- kernel{
'gaussian','beta'}, default='beta' Kernel function using either Gaussian or Beta distribution.
- plotbool, default=False
If True, the KDE is plotted.
- Returns:
- pdfnumpy.ndarray
Probability distribution function with the same length as
xs.
See also
Notes
In Beta kernel density estimation, the shape parameters \(a\) and \(b\) of the \(\mathrm{Beta}(a, b)\) distribution are computed for each data point \(u\) as:
\[a = (u / h) + 1.0 b = ((1.0 - u) / h) + 1.0\]This is a standard way of using Beta kernel (see R-package documentation [1]). These equations are derived from moment matching method, where
\[\mathrm{Mean}(\mathrm{Beta}(a,b)) = u \mathrm{Var}(\mathrm{Beta}(a,b)) = (1-u) u h\]Solving these two equations for \(a\) and \(b\) yields the relations above. See [2] (page 134).
References
[2]Chen, S. X. (1999). Beta Kernel estimators for density functions. Computational Statistics and Data Analysis 31 p. 131–145.