# Probability of being included in a Ranked Set Sample

I am doing a research work which needs a probability calculation. I'll be grateful if the community cross validates the formula that I have derived using the idea of binary strings and following a great answer by whuber to this question. But I really apologize to you for such a long thread!

In my design, I am planning to allocate a patient to either treatment policy B1 or to treatment policy B2 upon their remission times measured in days. Say, there are $mn^2$ observations in total. For the following picture $m=2$ and $n=4$. We divide the $mn^2$ patients randomly into $m$ groups of size $n^2$ and then randomize the $n^2$ patients again into $n$ blocks each having $n$ observations. This is all the same as dividing the $mn^2$ patients into $mn$ blocks of size $n$. Then we allocate the patients with the smallest remission time in block-1, 2nd smallest in block-2, 3rd smallest in block-3 up to the largest of block-n (here n=4) to treatment B1. Likewise we allocate patients to treatment B2.

Now the original data may contain tied observations. So I wanted to extend whuber's answer for the case where $x_1<=x_2<=\ldots<=x_n$ can be possible. Here $x_i$ are the remission times that may or may not have tied observations. This time I want to calculate the probability that $x_i$ will be allocated to treatment B1.

So, here is my generalization:

After we sort the data in R, let us define the following notations:

$r1$=Number of tied observations that come before $x_i$ in the sorted data

$r2$=Number of tied observations that come after $x_i$ in the sorted data

$p$=Number of ones in the binary string (please see whuber's answer that was mentioned earlier) that are placed in the $r1$ places before $x_i$.

$q$=Number of ones in the binary string that are placed in the $r2$ places after $x_i$.

$k$ denotes the order of $x_i$ in the RSS block.

So when, $r1=r2=0$ then $p=q=0$ and $(p+1+q)$=The number of tied observations along with $x_i$ in the RSS block.

With these notations according to my calculation, the probability that $x_i$ will get B1 is given by-

$prob(i)=\sum_{k=1}^{n}\frac{\sum_{p=0}^{min(r1,n-1)}\sum_{q=0}^{min(r2,n-1-p)} \dbinom{i-r1-1}{k-1-p} \dbinom{r1}{p} \dbinom{r2}{q} \dbinom{mn^{2}-i-r2}{n-k-q}}{\dbinom{mn^2}{n}}$

Since each RSS block may contain tied observations to $x_i$ and then all of the tied observations will have the same probability of being selected as the k-th smallest of the RSS block (with probability $1/(p+1+q)$, I guess), so do I need any adjustment? Although the the sum of the probabilities (over all $i$) of being the k-th smallest of a particular RSS block seems to be 1 always, which is the total law of probability.

For further generazation...

Can anyone suggest me if there were censoring and I had $C_i$, the censoring time for each observation, then what adjustment to the formula should be made?