197Frequency Modelling: Selecting and Calibrating a Frequency Model
However, it is difcult to use this method for the mass production of negative bino-
mial variates for simulation purposes as we would need one lookup table for each nega-
tive binomial variate. The obvious way around this is writing VBA code that reproduces
repeatedly the functionality of the lookup table or (even better) uses repeatedly the expo-
nential waiting times method outlined in Section 14.2.2 without needing to store a large
number of intermediate results.
In R, things are as usual much simpler, and negative binomial variates can be produced
straightforwardly using the function rnegbin(no _ of _ simul,mu,theta), included
in the basic library MASS. Here is, for example ...