6.5.6.2.4.1.1. statsmodels.sandbox.nonparametric.kernels.CustomKernel.__init__

CustomKernel.__init__(shape, h=1.0, domain=None, norm=None)[source]

shape should be a function taking and returning numeric type.

For sanity it should always return positive or zero but this isn’t enforced in case you want to do weird things. Bear in mind that the statistical tests etc. may not be valid for non-positive kernels.

The bandwidth of the kernel is supplied as h.

You may specify a domain as a list of 2 values [min, max], in which case kernel will be treated as zero outside these values. This will speed up calculation.

You may also specify the normalisation constant for the supplied Kernel. If you do this number will be stored and used as the normalisation without calculation. It is recommended you do this if you know the constant, to speed up calculation. In particular if the shape function provided is already normalised you should provide norm = 1.0.

Warning: I think several calculations assume that the kernel is normalized. No tests for non-normalized kernel.