I am trying to derive a probability function and here are the assumptions.
- Let $S = \{x_{(1)},x_{(2)},...,x_{(7)}\}$ be a set of distinct values that are ordered.
- Let $S*=\{x_1^*,x_2^*,...,x_7^*\}$ be a replication of $S$, as in, each elements $x_i^*$ are randomly chosen from $S$ with equal probability.
ex), $S^*$ could be $\{x_1,...,x_1\}$, or it could be an exact replica of $S$, etc.
- The sampling process are mutually independent.
My goal is to find the probability that the median of $S*$, say, $M(S*)$, is equal to $x_{(i)}$.
I would like to use the notation
$$B\left[j;n,p\right] ={n \choose j}p^j(1-p)^{n-j}$$
associated to the binomial distribution.
Here is my thought process.
To find $p(i)=Pr[M(S*)=x_{(1)}]$ we need at least 4 elements from $S*$ to be $x_{(1)}$ so
$$p(1) = \sum_{j=4}^7 B\left[j;7,\frac{1}{7}\right]$$
in other words,
$$\therefore = \sum_{j=0}^3 B\left[j;7,\frac{6}{7}\right]$$.
To find $p(2)$ we need at least the least 4 elements to be less than or equal to $x_{(2)}$, but take away the probability $p(1)$, so with similar argument I can get
$$p(2) = \sum_{j=0}^3 B\left[j;7,\frac{5}{7}\right]-p(1)$$
I am hoping that the general case would look something like
$$p(i) = \sum_{j=0}^3 \left(B\left[j;7,\frac{i-1}{7}\right]-B\left[j;7,\frac{i}{7}\right]\right)$$
but I am not too confident...
May I have some assistance please?
A different result is also more than welcome as long as it is accurate and makes sense.
There are $7^7=823543$ equally likely possibilities for the resampling with replacement.
This is a tractable number and it is possible just to count how many give which order statistic as the median:
and so probabilities
If you wanted this analytically, you want the probability that at least half of the sample is less than or equal to $x_{(n)}$ but are not less than or equal to $x_{(n-1)}$, i.e. $$\sum\limits_{j=4}^7 {7 \choose j}\frac{n^j (7-n)^{7-j}}{7^7}- \sum\limits_{j=4}^7 {7 \choose j}\frac{(n-1)^j (8-n)^{7-j}}{7^7} \\= \frac1{7^7}\sum\limits_{j=4}^7 {7 \choose j}\left({n^j (7-n)^{7-j}}- {(n-1)^j (8-n)^{7-j}}\right)$$
or using R
as already found