[R] runs of heads when flipping a coin

Carl Witthoft carl at witthoft.com
Thu Oct 9 23:42:04 CEST 2008


IIRC this is a standard problem in digital communications theory, so you 
might want to look for literature in that arena.

Carl


 > Can someone recommend a method to answer the following type of
 > question:
 >
 > Suppose I have a coin with a probability hhh of coming up heads
 > (and 1-hhh
 > of coming up tails)
 > I plan on flipping the coin nnn times (for example, nnn = 500)
 > What is the expected probability or frequency of a run of rrr
 > heads* during
 > the nnn=500 coin flips?
 > Moreover, I would probably (excuse the pun) want the answer for a
 > range of
 > rrr values, for example rrr = 0:50
 >
 > Of course I am more interested in an analytical solution than a
 > monte carlo
 > simulation solution.

I think this is a relatively deep problem analytically, and there appears to
be a substantial amount of literature. Googling on ``probability of a 
sequence
of runs'' got a lot of hits, including a pointer to

         http://mathworld.wolfram.com/Run.html

which gives some interesting discussion and provides a number of references.
(Feller volume 1 seems to be a good place to start, as usual.)



More information about the R-help mailing list