I have a set of samples from measurement. It can be expressed as random variable $Z = X + Y$. So that $Z$ is observable, but $X,Y$ is unobservable. According to prior knowledge and histogram of $Z$, I can assume that $X$ following exponential distribution with a manual selected parameter. The estimation of probability density function(pdf) of $Y$ is what I wanted. I use fft method to process this density deconvolution problem. More details can be found in this post.
To solve this numerical density deconvolution problem we adopt "deconv" function supplied by pracma package in R. The results contain a block of negative value which conflict the definition of probability density. If I ignore all of those invalid value by setting them to zero and convolute it back, there would be a great mount of differences between reconvoluted value and samples. Why? How to process it?
Furthermore, if I want to get parameters of $Y$ after its pdf was estimated, perhaps a mixture of normal distribution, what should I do?
=================================================
The background is provided as complementary: The samples are collected Round Trip Time(RTT) marked as $D_{rtt}$. It can be expressed as $D_{rtt} = D_{mech} + D_{delay}$, where $D_{mech}$ refers to time delay caused by mechanism, $D_{delay}$ is the real delay which is the main task for this analysis. $D_{mech}$ can be concluded as mixture distribution of exponential distribution and unifrom distribution. Fortunately, there is a gap between the two basic distributions in the pdf. So that I can process it separately as I modeled above.
=================================================
I add up my code for sample processing in R below.
delay_est = function(x, samples = 1000, thresh = 0.1){
library(pracma)
lp = subset(x, value < thresh)
d = hist(lp$value, samples)
len = length(d$density)
fit = function(lambda){
di = dexp(d$mids, lambda)
dx = deconv(c(d$density, rep(0, len)), subset(di, di > 0))
rd = dx$q[dx$q<0]
return(sum(abs(rd)))
}
opt = optim(500, fit, method='Brent', lower=0, upper=10000)
print(str(opt))
di = dexp(d$mids, opt$par)
dx = deconv(c(d$density, rep(0, len)), di)
return(list(dx$q, opt))
}