## Run Test

Run test is a nonparametric test of randomness. The runs test is used to determine whether the order or sequence of observations in a sample is random. A run is a succession of observations that have a particular one of the characteristics.

**One Sample**

Let $n$ denote the sample size. Let $n_1$ be the number of observations of the first type and $n_2$ be the number of observations of the second type such that $n = n_1+n_2$.

### Step 1 Hypothesis : Set up the hypothesis testing problem.

### Step 2 Level of Significance : $\alpha$.

### Step 3 Compute test Statistics:

If $n_1\leq 20$ and $n_2\leq 20$, use small sample test, otherwise use large sample test (Normal approximation).

#### Small Sample:

The test statistics is $r$, where $r$ denote the number of runs.

#### Large Sample :

The test statistics is $Z$, where $$ \begin{aligned} Z&=\frac{r-E(R )}{\sqrt{V(R )}} \end{aligned} $$

$$

\begin{aligned}
E(R ) &= \frac{2n_1n_2}{n_1+n_2}+1
\end{aligned}
$$

$$ \begin{aligned} V(R ) &= \frac{2n_1n_2(2n_1n_2-n_1-n_2}{(n_1+n_2)^2(n_1+n_2-1)} \end{aligned} $$

### Step 4 Critical Value :

#### For Small sample:

obtain the critical value of $r$ from statistical table at $\alpha$ level of significance.

#### For large sample:

obtain the critical value of $Z$ for given level of significance $\alpha$. That is, `$-Z_{\alpha/2}$`

and `$Z_{\alpha/2}$`

### Step 5 Conclusion:

- Reject $H_0$, if $r$ is outside the ……….
- Reject $H_0$, if
`$Z< -Z_{\alpha/2}$`

or`$Z > Z_{\alpha/2}$`

.

### Step 6 Decision:

## Related Resources

Suggestions and comments will be appreciated.