Conditional multivariate kernel density estimator.
Calculates P(Y_1,Y_2,...Y_n | X_1,X_2...X_m) = P(X_1, X_2,...X_n, Y_1, Y_2,..., Y_m)/P(X_1, X_2,..., X_m). The conditional density is by definition the ratio of the two densities, see [R4].
Parameters : | endog: list of ndarrays or 2-D ndarray :
exog: list of ndarrays or 2-D ndarray :
dep_type: str :
indep_type: str :
bw: array_like or str, optional :
defaults: Instance of class EstimatorSettings :
Attributes : ——— : bw: array_like :
|
---|
See also
References
[R4] | (1, 2) http://en.wikipedia.org/wiki/Conditional_probability_distribution |
Examples
>>> import statsmodels.api as sm
>>> nobs = 300
>>> c1 = np.random.normal(size=(nobs,1))
>>> c2 = np.random.normal(2,1,size=(nobs,1))
>>> dens_c = sm.nonparametric.KDEMultivariateConditional(endog=[c1],
... exog=[c2], dep_type='c', indep_type='c', bw='normal_reference')
>>> dens_c.bw # show computed bandwidth
array([ 0.41223484, 0.40976931])
Methods
cdf([endog_predict, exog_predict]) | Cumulative distribution function for the conditional density. |
imse(bw) | The integrated mean square error for the conditional KDE. |
loo_likelihood(bw[, func]) | Returns the leave-one-out conditional likelihood of the data. |
pdf([endog_predict, exog_predict]) | Evaluate the probability density function. |