# If $X_1,\ldots,X_n$ are continuous and IID with sample median $m$, are $1(X_1\geq m),\ldots,1(X_n\geq m)$ IID?

Suppose $$X_1,\ldots,X_n$$ are continuous random variables and IID with sample median $$m$$ for some $$n\geq 2$$. Is it then true that $$1(X_1\geq m),\ldots,1(X_n\geq m)$$ are IID?

Here the definition of $$1(X_i\geq m)$$ is that it is 1 if $$X_i\geq m$$ and 0 otherwise.

I ask because I often see researchers create these dummy variables (i.e. indicator variables) in regression analyses and I am worried that there is dependence between them by design (i.e. by construction). Mathematically I feel that since the dummy variables are functions of independent random variables, they ought to be independent. On the other hand, by the law of large numbers, for large $$n$$ we intuitively have that $$(1/n)\sum_i1(X_i\geq m)$$ is approximately equal to the expectation of $$1(X_i\geq m)$$ with $$m$$ being close to the population median, i.e. 0.5, with probability 1, suggesting that there is a linear dependence between the dummy variables for large $$n$$. (EDIT: Since $$m$$ is the sample median, we also know that $$(1/n)\sum_i1(X_i\geq m)$$ is at least 0.5.) I am unsure what I should conclude from this simple line of reasoning and unable to proceed in a more mathematically rigorous manner.

EDIT: I guess the answer to my question is simple. The indicator variables are not independent because all of them cannot be equal to 1 by the definition of the sample median.

• This seems to take care of the "independent" part.
– Dave
Commented Jul 21, 2022 at 20:29
• I don't see how the law of large numbers "... imply[s] that there is a linear dependence between the dummy variables...". This seems to me to be related to the classical fallacy that, e.g., a run of heads in a coin-flip experiment must make tails more likely so that the fraction of heads can get closer to 0.5. Am I misunderstanding something? Commented Jul 21, 2022 at 20:43
• The ambiguity of the question is whether or not the OP means the population median (as opposed to the sample median). Commented Jul 21, 2022 at 21:44
• @Xi'an Excellent point. The question is a little more interesting when the sample median is intended, for then these indicators are exchangeable but not independent.
– whuber
Commented Jul 22, 2022 at 16:30
• @Xi'an Thanks for emphasizing this. Here I meant $m$ to be equal to the sample median of $(X_1,\ldots,X_n)$. My question has been updated. Commented Jul 23, 2022 at 5:32

A fairly rigorous argument is that $$\mathbb P(X_1\ge m(X_1,\ldots,X_n),\ldots,X_n\ge m(X_1,\ldots,X_n))=0\ne \mathbb P(X_1\ge m(X_1,\ldots,X_n))^n$$

• What is interesting about the question is that although it specifies a continuous distribution, I believe the result is true for all distributions (except for the obvious exceptions $n=1$ and when the $X_i$ are constant a.s.) But for discrete distributions your final inequality does not necessarily hold.
– whuber
Commented Jul 23, 2022 at 23:26
• Right, all $X_i$'s could be identical. Commented Jul 24, 2022 at 8:52

Another argument is that:

1. If $$n$$ is even, then $$\sum_{i=1}^n1(x_i \geq m) = n/2$$, therefore the $$1(x_i \geq m)$$ cannot be independent,

2. If $$n$$ is odd, then $$\sum_{i=1}^n1(x_i \geq m) = (n+1)/2$$, therefore the $$1(x_i \geq m)$$ cannot be independent.

• The two "therefores" still need justification. Admittedly it is easy for continuous variables--but it still needs to be there.
– whuber
Commented Jul 23, 2022 at 23:24