As a chemist, I am currently working a complex molecular modeling issue and I have stumbled upon a statistical/mathematical problem which I am not able solve (nor are my close colleagues). I would very much appreciate your help. Let me explain (an analogy of) my situation.
We have a lane before a counter which runs from 0 < x < L. Then, I have obtained a profile that describes the occupancy of the lane: the probability for each position x that it is occupied by a customer p(x). Now, I want to calculate from this p(x) the distribution of lengths of the queue before the counter, so the probability q(x) that the latest occupied position is at x. The problem is illustrated in the figure below.
Illustration of the problem: http://imgur.com/a/dMRdJ
I am not able to find a satisfactory q(x); which I need to compare the model to experimental data. I have thought about a discrete method, but I am not sure whether this is (i) correct and (ii) how this translates to a continuous p(x) and q(x). This is what I came up with: $$q(x_i )=\frac{1}{\int q} \cdot \left( \prod_{x_0}^{x_{i-1}}p(x) \right)\cdot \left( \prod_{x_{i+1}}^{x_{\max(i)}}(1-p(x)) \right)$$
The first part (1/integral q) is normalization, the second part calculates the probability that the part of the lane before xi is fully occupied and the third part calculates the probability that the part of the lane after xi is not occupied (as both need to be true I think).
Thank you very much for thinking along!