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" ]:
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.
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].
Is there independency?
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:
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!