[R] runs of heads when flipping a coin

Rolf Turner r.turner at auckland.ac.nz
Thu Oct 9 21:43:26 CEST 2008


On 10/10/2008, at 6:16 AM, Harvey wrote:

> 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.)

		cheers,

			Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list