statsmodels.nonparametric.kde.KDEUnivariate¶
- class statsmodels.nonparametric.kde.KDEUnivariate(endog)[source]¶
Univariate Kernel Density Estimator.
Notes
If cdf, sf, cumhazard, or entropy are computed, they are computed based on the definition of the kernel rather than the FFT approximation, even if the density is fit with FFT = True.
KDEUnivariate is much faster than KDEMultivariate, due to its FFT-based implementation. It should be preferred for univariate, continuous data. KDEMultivariate also supports mixed data.
See also
KDEMultivariate,kdensity,kdensityfftExamples
>>> import statsmodels.api as sm >>> import matplotlib.pyplot as plt>>> nobs = 300 >>> np.random.seed(1234) # Seed random generator >>> dens = sm.nonparametric.KDEUnivariate(np.random.normal(size=nobs)) >>> dens.fit() >>> plt.plot(dens.cdf) >>> plt.show()Methods
evaluate(point)Evaluate density at a point or points.
fit([kernel, bw, fft, weights, gridsize, ...])Attach the density estimate to the KDEUnivariate class.
Properties
Returns the cumulative distribution function evaluated at the support.
Returns the hazard function evaluated at the support.
Returns the differential entropy evaluated at the support
Inverse Cumulative Distribution (Quantile) Function
Returns the survival function evaluated at the support.