views:

131

answers:

1

From Feller (1950) An Introduction to Probability Theory:

A path of length n can be interpreted as the record of an ideal experiment consisting of n successive tosses of a coin. If +1 stands for heads, then Sk equals the (positive or negative) excess of the accumulated number of heads over tails at the conclusion of the kth trial. The classical description introduces the fictitious gambler Peter who at each trial wins or loses a unit amount. The sequence S1, S2,...Sn then represents Peter's successive cumulative gains.

I have a column of ones and zeros from a real coin toss experiment and would like to construct a graph similar to that Feller presents (as described above). cumsum and plotCsum don't seem to be quite what I am looking for.

+2  A: 

I have a column of ones and zeros

Maybe it works if you convert the 0 into -1

Fillet
That appears to be exactly what I was after. Not being a mathematician or a programmer, these things don't come naturally. Thanks very much.
RSoul
Cheers. Have fun plotting.
Fillet
For completeness, this is what I used plot.ts(cumsum(x).
RSoul