Adding a kernel function to generic function density


How to add a new kernel (new_kernel), other the list of kernels (gaussian, epanechnikov, uniform , triangular,...), in order to use in density(x, bw = 1, kernel = "new_kernel") for estimate the probability density function.

Thank you

There is not a convenient / effortless way to do this.
You would have to effectively write your own solution.
If you type density.default into your R console, you could look at the code that is normally used, and there are many switch() statements where different code is implemented based on the kernel name, you would have to devise your own such code and thereby extend these switch statements.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.