# Testing median, and distribution of Binomial

Given the median is $m>0$

We have $n$ random variables: $Y_1,Y_2,..,Y_n$

If we observe a value above $m$ then $Y_i=1$ if we observe a value below $m$ then $Y_i=0$

The probability of getting an observation above $m$ is "$p$"

$(i)$ Then what distribution is $Y_i$ describing? I think $Y_i$ is describing Bernoulli trials.

$(ii)$Does that mean that if we want a model of 'number of observations above median' this would be $\sum^{n}_{i=1}Y_i$ which is $Binomial(n,p)$?

$(iii)$Is the assumption p=1/2, valid? Since half the observations are above $m$ and half below.

$(iv)$I now wish to test if $m$ is the true median, and require a 95% CI.

If I know '$n$' then I should calculate exact binomial probabilities until I have cumulative probability in the lower tail below 2.5% and cumulative probability in the uppertail of below 2.5%. Alternatively I may use the normal approximation.

Essentially, I am looking to understand steps from $(i)$ to $(iv)$:

1) the validity/ accuracy of my method.

2) assumptions I may have made.

3) any other more accurate/ efficient tests out there?

Any input: thoughts/ comments/ hints would be greatly appreciated. Thank you

-

You definitely have the right idea. The p in the binomial model will be 1/2 if the population distribution is absolutely continuous. In the discrete case though P(X=m) can be greater than 0. Call it r

then p= (1-r)/2.

Aside from that you have discovered a nonparametric test for the median called the sign test. Let Y=X-m. Supoose you have n samples from the distribution for X denoted X$_1$, X$_2$,..., X$_n$ Let Y$_i$=X$_i$-m for i=1,2,..,n.

Let Z$_i$=1 is Y$_i$>0 and Z$_i$ = 0 when Y$_i$<0. Under the null hypothesis that M=m verses the alternative that M differs from m where M denotes the median of the distribution of X when the population distribution for X is absolutely continuous, P(Y$_i$=0)=0 and Z$_i$ is a well-defined Bernoulli random variable with p=1/2. Uunder the alternative the Z$_i$s are Bernoulli with p different from 1/2.

The test counts the number of Z$_i$s =1 and hence the number of y$_i$s with a positive sign (hence the name) sign tests. Under the null hypothesis the test statistic is binomila with parameters n and 1/2.

This is a simple test for the median which is often used for simplicity. However another test called the Wilcoxon signed rank test is more powerful because it includes information on the pooled ranks of the Ys in the group with positive sign as well as the sign of the Ys.

-
Thanks again Michael! you've given me a lot to research/ think about. –  plantt Sep 30 '12 at 14:21
Great If you like my answers to your questions you can check them and upvote. –  Michael Chernick Sep 30 '12 at 14:42