## What is autocorrelation?Autocorrelation is a statistical test that determines whether a random number generator is producing independent random numbers in a sequence.## What does autocorrelation test?- The tests for autocorrelation are concerned with the dependence between numbers in a sequence.
- The test computes the autocorrelation between every m numbers (m is also known as the lag) starting with the ith number (i is also known as the index).
## What does autocorrelation look like?Here is a list of random integers generated. See if you can identify a pattern by looking at the values in the sequence.
If you look carfully at the following table of random integers generated, you'll notice that every number in the 5th, 10th, 15th, and 20th postion is a larger value.
## What are the important variables to remember?m - is the lag, the space between the numbers being tested.
i - is the index, or the number in the sequence that you start with
N - the number of numbers generated in a sequence
M - is the largest integer such that
## Mathematical StuffThe test described below requires the computation of the autocorrelation between every m numbers (m is the lag) starting with the ith number. The autocorrelation between the following numbers .
The value M is is the largest integer such that , where N is the total numbers in the sequence. Since a nonzero
autocorrelation implies a lack of independence, the following two-tailed test is appropriate:
For large values of M, the distribution of the estimator of , denoted with a hat, is approximately normal if the values are uncorrelated. Then the test statistic can be formed as follows:
The formula for (with a hat), in a slightly different form, and the standard deviation of the estimator, are as follows (Scmidt and Taylor 1970):
After computing , do not reject the null hypothesis of independence if , where is the level of signifigance. If > 0, the subsequence is said to exhibit positive autocorrelation. On the other hand, if < 0, the subsequence is exhibiting negative autocorrelation, which means the m values are followed by greater values. ## How do you figure out the value of M?To figure out the value of M, you must use some simple algebra. For example, the equation: must be solved using the given values i the index, N the number of elements in the sequence, and m the lag.
Since the value M must be an integer, the 0.8 is truncated and the 4 is saved as the value of M. Thus, M is equal to 4. ## Using the Equations
To use the estimator equation, denoted with a hat, you must understand the sequence and summation notations. The formula
is actually quite easy to use. The next equation is even simpler to use. After solving for M, plug the numbers in and use the results. ## Applet for computing an Autocorrelation test
Download Source Code for Applet ## Drawbacks when using autocorrelation
- Autocorrelation is not very sensitive to small values of M, when the values being tested are on the low side. For example, if all the values were equal to zero, then the resulting value would be -1.95, which is not enough to reject the hypothesis.
- Many sequences can be formed in a set of date (the sequence of all numbers, the sequence from the first, fifth, ..., numbers and so forth. If the
alpha is equal to 0.05, then there is a possibility of rejecting a true hypothesis. For example, if these are 10 independent events, the possibility
of finding of finding no autocorrelation alone is (0.95)
^{10}or 0.60. Thus, 40% of the time signifigant autocorrelation would be detected when it does not exist.
## The ConclusionWhen using autocorrelation tests, be cautious. Autocorrelation may be detected after numerous tests even when no autocorrelation exists. ## Helpful Resources about Autocorrelation
http://www.ruf.rice.edu/~lane/stat_sim/comp_r/index.html |