Example 4.5. An unbalanced coin. While the makespace argument to tosscoin is useful to
represent the tossing of a fuir coin, it is not always appropriate. For example, suppose our coin is
not perfectly balanced, for instance, maybe the "H side is somewhat heavier such that the chances
of a H appearing in a single toss is 0.70 instead of 0.5. We may set up the probability space with
> probspace(tosscoin(1), probs : c(0.7, 0.3))
tossl probs
1 H 0.7
2 T 0.3
The same procedure can be used to represent an unbalanced die, roulette wheel. etc.
4.3.6 Words of Warning
It should be mentioned that while the splendour of R is uncontested. it, like everything else. has
limits both with respect to the sample/probability spaces it can manage and with respect to the finite
accuracy of the representation of most numbers (see the R FAQ 7.31). When playing around with
probability. one may be tempted to set up a probability space for tossing 100 coins or rolling 50
dice in an attempt to answer some scintillating question. (Bear in mind: rolling a die just 9 times
has a sample space with over I0 million outcomes.)
Alas, even if there were enough RAM to barely hold the sample space (and there were enough
time to wait for it to be generated). the infinitesimal probabilities that are associated with so many
outcomes make it diflicult for the underlying machinery to handle reliably. In some cases. special
algorithms need to be called just to give something that holds asymptotically. User beware.