I would like to calculate the integral of an already estimated probability density function. This PDF was estimated with a SPLINE, which is "slightly" negative in certain areas. My SPLINE is saved as a "struct" and integrating it works just fine fnint(PDF). However, the resulting CDF is decreasing in those areas of negative densities, which I would like to avoid by simply replacing those areas of the PDF with 0.
My question: Is it possible to set those regions of the function equal to 0, or to integrate just over the positive values ot this PDF? I would like to avoid transforming the function into a vector of resulting densities, and instead use the (spline) function directly?
Thanks in advance!