To run R:

  1. See the fire an event algorithm for background.