University of Minnesota, Twin Cities School of Statistics Stat 3011 Rweb Textbook (Wild and Seber)
Like Figure 4.1.1 in Wild and Seber but with a normal scale rather than their log scale on the horizontal axis.
samplegenerates a random sample from a specified set either with or without replacement. Here the set is
c(0, 1)and the sampling is with replacement. This is just like coin flips, except that we've coded zero for tails and one for heads.
cumsumreturns the vector of cumulative sums of a sequence. Thus
yis the vector of relative frequencies of heads (ones), that is
y[k]is the relative of frequencies of heads in the first k flips.