Kde1d

class Kde1d(*args, **kwargs)

Local-polynomial density estimation in 1-d.

Attributes:
bandwidth

Returns ——- float the bandwidth used to fit the density (post-multiplier; NaN until fit() has been called).

degree

Returns ——- int the polynomial degree used by the local-likelihood estimator (0, 1, or 2).

edf

Returns ——- float the effective degrees of freedom of the fitted estimator (the sum of the per-observation influence values).

grid_points

Returns ——- ndarray, shape (n,), dtype float the grid points used for interpolation (original scale).

grid_size

Returns ——- int the requested number of grid points (the value passed to the constructor).

loglik

Returns ——- float the log-likelihood of the data under the fitted estimate.

multiplier

Returns ——- float the bandwidth multiplier supplied at construction.

prob0

Returns ——- float the estimated point mass at zero (only used for the zero_inflated type; 0 otherwise).

type

Returns ——- str the variable type as the human-readable string ("continuous", "discrete", or "zero-inflated").

values

Returns ——- ndarray, shape (n,), dtype float the fitted density values on the interpolation grid.

xmax

Returns ——- float the upper bound of the support (NaN if unbounded above).

xmin

Returns ——- float the lower bound of the support (NaN if 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

bandwidth

Returns:

degree

Returns:

edf

Returns:

grid_points

Returns:

grid_size

Returns:

loglik

Returns:

multiplier

Returns:

prob0

Returns:

type

Returns:

values

Returns:

xmax

Returns:

xmin

Returns:

Methods

__init__

Constructs a Kde1d instance.

cdf

Computes the cdf of the kernel density estimate by numerical integration.

fit

Fits the kernel density estimate to data.

from_grid

Constructs a Kde1d from a pre-computed interpolation grid (skipping the kernel-density fit).

from_params

Constructs a Kde1d instance.

pdf

Computes the pdf of the kernel density estimate by interpolation.

plot

Generates a plot for the Kde1d object.

quantile

Computes the quantile function by numerical inversion of the cdf.

set_xmin_xmax

Updates the support bounds.

simulate

Simulates data from the fitted density.