Chapter 15 Basic simulations
The Sims is a successful series of a real-life simulation games. In this game, players can create a virtual character (called a “Sim”), equip it with personality traits and stuff like clothes and furniture, meet friends and foes, and then spend days or weeks by observing and nurturing their artificial alter egos to lead their lives in a simulated environment (Figure 15.1).
This chapter on Basic simulations is the first chapter in the more general part on Modeling. As our goal is to learn how R can be used for representing and solving problems, we will first concentrate on basic and straightforward simulations that either enumerate cases (in Section 15.2) or sample random values from some distribution (in Section 15.3). While the problems considered here are simple enough that they could still be solved analytically, implementing them familiarizes us with many interesting aspects of computer simulations and provides us with an excellent excuse to solve some entertaining puzzles.
Recommended background readings for this chapter include:
Remember that the chapters on simulations are enclosed in a book part that is entitled Modeling. This raises some interesting questions:
What is a simulation?
What are the goals of creating a simulation?
What are the differences of simulation to a model? Specifically,
- Are all simulations models?
- Are all models simulations?