Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

In the runs above and below the mean test of independence, the mean is

MEAN = (2*n1*n2)/N - (1/2)

So here, are n1 and n2 runs above and below or instances of numbers above and below?

In other words, is

n1 + n2 = N

or,

n1 + n2 = b (where b is equal to total number of runs)

share|improve this question
    
This site may have what you're looking for. –  smackcrane Nov 25 '11 at 4:36
add comment

1 Answer

I wouldn't have been able to make any sense of the question without this page. It would have been a lot clearer if you'd mentioned that you mean two different things by "the mean", where "MEAN" in the first formula means not the mean of the distribution itself but the mean number of runs, conditional on $n_1$ and $n_2$. Also you failed to introduce $N$ as the total number of observations and gave the formulas for the two possibilities in reverse order from the order in the text.

As the linked page states, $n_1$ and $n_2$ are numbers of individual observations. You can derive the mean number of runs using linearity of expectation. For $N$ observations, there are $N-1$ adjacent pairs of observations. Given $n_1$ and $n_2$, for each pair the probability of not continuing a run is

$$\frac{\binom{n_1}2}{\binom N2}+\frac{\binom{n_2}2}{\binom N2}=\frac{n_1^2-n_1+n_2^2-n_2}{N^2-N}\;.$$

The probability of breaking a run is $1$ minus this, by linearity of expectation the expected number of breaks between runs is just $N-1$ times that, and the expected number of breaks is $1$ more than this, so we have

$$ \begin{eqnarray} \mu_b &=& (N-1)\left(1-\frac{n_1^2-n_1+n_2^2-n_2}{N^2-N}\right)+1 \\ &=& (N-1)\left(1-\frac{n_1^2-n_1+n_2^2-(N-n_1)}{N^2-N}\right)+1 \\ &=& (N-1)\left(1-\frac{n_1^2+n_2^2-N}{N^2-N}\right)+1 \\ &=& (N-1)\frac{N^2-(n_1^2+n_2^2)}{N^2-N}+1 \\ &=& \frac{(n_1+n_2)^2-(n_1^2+n_2^2)}N+1 \\ &=& \frac{2n_1n_2}N+1\;. \end{eqnarray} $$

It's strange that you have $-\frac12$, the linked page has $\frac12$ and I have $1$, but you can check for $N=1$ and $N=2$ that $1$ is correct.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.