Kde1d
- class Kde1d(*args, **kwargs)
Local-polynomial density estimation in 1-d.
- Attributes:
bandwidthReturns ——- float the bandwidth used to fit the density (post-multiplier;
NaNuntilfit()has been called).degreeReturns ——- int the polynomial degree used by the local-likelihood estimator (0, 1, or 2).
edfReturns ——- float the effective degrees of freedom of the fitted estimator (the sum of the per-observation influence values).
grid_pointsReturns ——- ndarray, shape (n,), dtype float the grid points used for interpolation (original scale).
grid_sizeReturns ——- int the requested number of grid points (the value passed to the constructor).
loglikReturns ——- float the log-likelihood of the data under the fitted estimate.
multiplierReturns ——- float the bandwidth multiplier supplied at construction.
prob0Returns ——- float the estimated point mass at zero (only used for the
zero_inflatedtype;0otherwise).typeReturns ——- str the variable type as the human-readable string (
"continuous","discrete", or"zero-inflated").valuesReturns ——- ndarray, shape (n,), dtype float the fitted density values on the interpolation grid.
xmaxReturns ——- float the upper bound of the support (
NaNif unbounded above).xminReturns ——- float the lower bound of the support (
NaNif unbounded below).
Methods
cdf(self, x[, check_fitted])Computes the cdf of the kernel density estimate by numerical integration.
fit(self, x[, weights])Fits the kernel density estimate to data.
from_grid(grid_points, values[, xmin, xmax, ...])Constructs a Kde1d from a pre-computed interpolation grid (skipping the kernel-density fit).
from_params([xmin, xmax, type, multiplier, ...])Constructs a Kde1d instance.
pdf(self, x[, check_fitted])Computes the pdf of the kernel density estimate by interpolation.
plot(self[, xlim, ylim, grid_size, ...])Generates a plot for the Kde1d object.
quantile(self, x[, check_fitted])Computes the quantile function by numerical inversion of the cdf.
set_xmin_xmax(self[, xmin, xmax])Updates the support bounds.
simulate(self, n[, seeds, check_fitted])Simulates data from the fitted density.
Attributes
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
Methods
Constructs a Kde1d instance.
Computes the cdf of the kernel density estimate by numerical integration.
Fits the kernel density estimate to data.
Constructs a Kde1d from a pre-computed interpolation grid (skipping the kernel-density fit).
Constructs a Kde1d instance.
Computes the pdf of the kernel density estimate by interpolation.
Generates a plot for the Kde1d object.
Computes the quantile function by numerical inversion of the cdf.
Updates the support bounds.
Simulates data from the fitted density.