# Recursive Z-statistic

In respones to: Consider a standard Z-statistic used in hypothesis testing. One of the variables needed to compute the Z-statistic is the number of observations. The problem is that with each additional observation one has to recompute the Z-statistic from scratch. It seems like there is no recursive formulation, e.g. a representation such as Z(n) = Z(n-1) + new piece of information. Is there perhaps an approximate recursive formulation? Any other thoughts? Thanks.

An example hypothesis test is:

$H_{0}:$ $\mu=\mu_{0}$

$H_{1}:$ $\mu\neq\mu_{0}$

We reject this hypothesis if $\overline{x}$ is either greater than or lower than a critical value. Assuming the critical values do not change all you have to update is $Z_{0}$.

The test statistic is:

 $Z_{0}=\frac{\overline{X}-\mu}{\sigma/\sqrt{n}}$

Assuming you know $\sigma$, when you get a new variable $X_{n+1}$ you can update $\overline{x}$ using $n$, $\overline{X}$, and $X_{n+1}$, then recalculate $Z_{0}$.

Now if you do not know $\sigma$, and your sample size is large enough to use the Normal distribution, you have to update your sample variance, $S^{2}$. If your sample size is not large enough and you are using the t-distribution then your critical values will change when $n$ changes.

To do update $S$ without recalculating, you should keep running totals of $\sum_{i}X_{i}$ and $\sum_{i}X_{i}^{2}$, so you can update $S$ using the computation formula for the sample variance.

Title Recursive Z-statistic RecursiveZstatistic 2013-03-22 19:11:30 2013-03-22 19:11:30 statsCab (25915) statsCab (25915) 4 statsCab (25915) Definition msc 62-00