2.2.3.10. sdepy.montecarlo.pdf¶
-
montecarlo.
pdf
(x, method='gaussian_kde', bandwidth=1.0, kind='linear')[source]¶ Normalized sample probability density function, evaluated at
x
.Parameters: - x : array-like
Values at which to evaluate the pdf.
- method : {‘gaussian_kde’, ‘interp’}
Specifies the method used to estimate the pdf value. One of: ‘gaussian_kde’ (default), smooth Gaussian kernel density estimate of the probability density function; ‘interp’, interpolation of density histogram values, of the given
kind
.- bandwidth : float
The bandwidth of Gaussian kernels is set to
bandwidth
times each bin width.- kind : str
Interpolation kind for the ‘interp’ method, passed to
scipy.interpolate.intep1d
.
Returns: - array
An estimate of the sample probability density function of the cumulated sample data, at the given ‘x’ values, according to the stated method.
Notes
For the ‘gaussian_kde’ method, kernels are computed at bins midpoints, weighted according to the density histogram counts, using in each bin a bandwidth set to
bandwidth
times the bin width. The resulting pdf:- Has support on the real line.
- Integrates exactly to 1.
- May not closely track the density histogram counts.
For the ‘interp’ method, the pdf evaluates to the density histogram counts at each bin midpoint, and to 0 at the bins boundaries and outside. The resulting pdf:
- Has support within the bins boundaries.
- Is intended to track the density histogram counts.
- Integrates close to, but not exactly equal to, 1.
May systematically overestimate the probability distribution within the bins’ boundaries if part of the cumulated samples data (accounted for in the
outpaths
property andouterr
method) fall above or below the bins boundaries.