Put this in your pipe and smoke it!

Jan 12, 2005 21:14

Assessing "serial dependency, autocorrelation, or independence" from flip to flip--another test of randomness.
We can determine whether the trials are independent or unrelated by calculating two conditional probabilities and comparing them [note: the term "p(X)" is the probability of "X" ]:

p(H given H) -- The conditional probability of a Head following a Head. Given a head, what is the probability of a head on the next flip?

P(H given T) -- The conditional probability of a head following a tail. Given a tail, what is the probability of a head on the next flip?
With randomness, both of these probabilities should be close to .50, the p(H), because what happens on the previous flip should have no influence on what happens on the current flip. The histogram shows the distribution of one of the probabilities (the other one was similar) for 1,040 samples of 100 flips.

If these two conditional probabilities are equal, then each event is independent of the next one--the data look random.

If they are quite different, then there is a dependency, something which is unlikely in a random process.
So now you must assess these two probabilities. [We do not have to look at the other two probabilities, p(T given H) or p(T given T), because they express quantities which are 1.0 minus the ones we will calculate].

How to assess the conditional probabilities
To do this, you link each trial with the next one (this will give you 99 links) and then see the percentage of time that an H is followed by an H. In the example below, this is 3 out of 4 or 67%. The four sequences which begin with a head are a, b, c and f, and three of them have a head in the second sequence --a, b, and f. Then see how many times a T is followed by a H -- the example below has 1 out of 2, 50%. This involves sequences d and e, and only e has an H.
Example:

H
] a
H
] b
H
] c
T
] d
T
] e
H
] f
H

Is there independency?

If the two conditional probabilities are close to each other (within 10 percentage points), your pattern mimics a random process: there is trial to trial independency.

If the difference is greater than 10 points, there is no simple way to determine if the degree of dependency is greater than you could expect would occur by chance (see level 3 below for the "dirty details").

Level 3: More formal ways to assess Serial Dependency
We express p(H given H) as x/y where y is the number of couplets beginning with a head and x is the number of these which have a head in the second position.
P(H given T) is z/w where w is the number of couplets beginning with a tail, and z is the number of these which have a head in the second position.

As with the longest run, the tests of significance depend on the proportion of heads observed, so the general guidelines used for the other levels are not precise.

You can use the following formula to calculate the standard error (SE) of the difference between the conditional probabilities:

If your difference in the percentages (conditional probabilities) is more than 2 times larger than SE, then you have a significant dependency problem.
In other words, is p(H given H) - p(H given T) > 2*SE?

Other types of serial dependency

The above calculations look at what is called a "lag 1" dependency or autocorrelation because we look at how trial X relates to trial X+1 in the series. We could take "lag 2" dependencies by looking at how trial X correlates with trial X+ 2. This would involve linking every other trial. We could even lag things three, four, etc deep. Most statistical tests don't go beyond two or three lags.

There are a huge number of different types of lags. We could look at pairs of flips and see how often a H occurs after a "HH," "HT," "TH," and a "TT." All four of these probabilities should be about the same. We could see what happens after triplets, and so forth. As you can see there is no limit to the number of ways you could analyze a sequence! This is part of the problem with testing for randomness: given enough tests, any random sequence will eventually fail at least one of them!
Previous post Next post
Up