statsmodels.nonparametric.kernel_regression.KernelCensoredReg#
- class statsmodels.nonparametric.kernel_regression.KernelCensoredReg(endog, exog, var_type, reg_type, bw='cv_ls', ckertype='gaussian', ukertype='aitchison_aitken_reg', okertype='wangryzin_reg', censor_val=0, defaults=None, *, rng=None)[source]#
Nonparametric censored regression
Calculates the conditional mean
E[y|X]wherey = g(X) + e, where y is left-censored. Left censored variable Y is defined asY = min {Y', L}whereLis the value at whichYis censored andY'is the true value of the variable.- Parameters:
- endogarray_like
This is the dependent variable.
- exogarray_like
The training data for the independent variable(s) Each element in the list is a separate variable
- var_type
str The type of the variables, one character per variable:
c: Continuous
u: Unordered (Discrete)
o: Ordered (Discrete)
- reg_type
str Type of regression estimator
lc: Local Constant Estimator
ll: Local Linear Estimator
- bw
stror array_like,optional Either a user-specified bandwidth or the method for bandwidth selection.
cv_ls: cross-validation least squares
aic: AIC Hurvich Estimator
- ckertype
str,optional The kernel used for the continuous variables.
- okertype
str,optional The kernel used for the ordered discrete variables.
- ukertype
str,optional The kernel used for the unordered discrete variables.
- censor_val
float,optional Value at which the dependent variable is censored. Default is 0.
- defaults
EstimatorSettingsinstance,optional The default values for the efficient bandwidth estimation
- rng
int, array_likeofint,numpy.random.Generator,ornumpy.random.RandomState,optional If rng is None, the legacy global (singleton)
RandomStateprovided bynumpy.randomis used; this behavior is deprecated and will change to creating a newGeneratorusing fresh entropy from the operating system in a future release. If rng is an int or array of ints, a newGeneratoris created, seeded with rng. If rng is already aGeneratororRandomStateinstance, that instance is used.Deprecated since version 0.15.0: In release 0.17.0 or after January 2028, whichever comes sooner, using None will initialize a new numpy.random.default_rng using system entropy.
- Attributes:
- bw
ndarray The bandwidth parameters
- bw
Methods
aic_hurvich(bw[, func])Computes the AIC Hurvich criteria for the estimation of the bandwidth
cv_loo(bw, func)The cross-validation function with leave-one-out estimator
fit([data_predict])Returns the mean and marginal effects at the data_predict points
Returns the leave-one-out likelihood function
Returns the R-Squared for the nonparametric regression
sig_test(var_pos[, nboot, nested_res, pivot])Significance test for the variables in the regression
censored
Methods
aic_hurvich(bw[, func])Computes the AIC Hurvich criteria for the estimation of the bandwidth
censored(censor_val)cv_loo(bw, func)The cross-validation function with leave-one-out estimator
fit([data_predict])Returns the mean and marginal effects at the data_predict points
Returns the leave-one-out likelihood function
Returns the R-Squared for the nonparametric regression
sig_test(var_pos[, nboot, nested_res, pivot])Significance test for the variables in the regression