How to find out which random variable was chosen? This question is related to my other question ( Need help with a model, Whatsapp data analysis ).
Suppose we have random variables $X_1,\cdots,X_m$ bernoulli distributed with probability $p$, $D_1,\cdots,D_m \sim Exp(\lambda_d)$, $P_1,\cdots,P_m \sim Exp(\lambda_P)$ and let $d_i := X_i D_i + (1-X_i)P_i$ for $i=1,\cdots,m$.
Suppose further that $\lambda_d >> \lambda_P$. Then how can we find out by observing only $d_i$ for which $X_i = 1$? In my other question it was suggested to take the mean $\widehat{d}$ of $d_i$ and if $d_i > \widehat{d}$ then to infer that $X_i = 0$. But this procedure is more a heuristic than an actual argument. Does somebody have an idea on how to make this to an argument?
I know of Otsu's method in computer vision to cluster an image into black and white. (https://en.wikipedia.org/wiki/Otsu%27s_method) Do you think this method could be applied in this situation?
Edit:
By suggestion of  Anthony Quas, I will sort the $d_i$ and then look for a large gap. The gap is found by maximizing the inter-sum of squares as in Otsu's method. Here is the R-code to find the index $I$ at which the cutoff occurs:
S <- 0
I <- -1
st <- sort(di)
for(i in seq(2,m-2)){
    A <- st[1:i]
    B <- st[(i+1):m]
    mA <- mean(A)
    mB <- mean(B)
    ssInter <- length(A)*(mA-mean(di))^2+length(B)*(mB-mean(di))^2
   if( ssInter > S){ S <- ssInter; I <- i}
}

 A: I would do it like this: the log- likelihood with respect  to the measure in which they are all $\lambda_p$ is $ \sum X_i (log(\frac {\lambda_q}{\lambda_p}) - ({\lambda_p} - {\lambda_q})(Z_i)) + log( {N \choose j} p^j (1-p) ^ {n-j})$, where $Z_i$ is your observation and my X_i are 0 or 1,  however, having chose j I am sure that you maximize the expression by choosing the j largest or j smallest $Z_i$ and then it very likely follows that the estimated $\lambda$s should be  the mean of the largest resp smallest. My claim is that this procedure is reasonable because it is based on maximizing the likelihood.  I would be surprised if this exact problem hasn't been considered, and would search under 'missing data' (the X_i) .  I changed your notation to ps and qs so I could warn you  to watch my p's and q's, the signs may be wrong by the idea  should be correct.
A: This first paragraph has been corrected
So assuming everything is known, and that $\lambda_d\gg\lambda_P$, the threshold where you should cut off between assuming $X=1$ and $X=0$ is roughly given by the solution of $pe^{-\lambda_d T}=(1-p)\lambda_P T$.
The left side is the probability that a $d_i$ that is a $D$ value lies above the threshold; and the right side is the probability that a $d_i$ that is a $P$ value lies below the threshold. When I computed the threshold for your parameter values, I got a threshold of 33. 
I will assume that $mp$ and $m(1-p)$ are large. Given the very large ratio between $\lambda_P$ and $\lambda_d$, it is quite wasteful to use the mean as the cutoff (it gives too many false $X=1$'s when the $P_i$ happen to be somewhat small relative to $1/\lambda_P$). 
Probably quite a good way to locate the cutoff in practice is to sort the $d_i$'s into order and look at the gaps. In the $\lambda_D$ part of the distribution, these should be something like $1/(mp\lambda_d)$, whereas in the $\lambda_P$ part of the distribution, they should be much bigger, around $1/(m(1-p)\lambda_P)$. I would try to find a way to guess where the gaps change; and then maybe double the threshold to be safe (you get very few false $D$'s this way and double the number of false $P$'s), but this number is something like 0.1% for your parameter range. 
