## 2.4 Activity: Building Monte Carlo simulations

Carsey and Harden10 define Monte Carlo simulation as,

any computational algorithm that randomly generates multiple samples of data from a defined population based on an assumed data generating process (DGP). The DGP is the mechanism that characterizes the population from which simulated samples of data are drawn. Then the researcher explores patterns that emerge across those simulated samples.

In this activity you will learn the process of carrying out a Monte Carlo simulation and how to do so using TinkerPlots™.

### Model-simulate-evaluate

Looking back at the definition of a Mote Carlo simulation above, the process encompasses (1) defining a population or model, (2) randomly generating several samples of data from the population or model, and (3) exploring the patterns that emerge across the simulated samples. In simpler terms, (1) model, (2) simulate, and (3) evaluate.

In the previous course activity, you created several models using TinkerPlots™ and used them to randomly generate data. The key to Monte Carlo simulation is to generate many, many randomly generated samples. The catch is that we need to collect some information from each of these samples so that we can examine this information across the many samples. The information we collect is often a quantifiable summarization of the sample, for example the mean value, a count, or a proportion. The summary we choose is based on our research question.

### 2.4.1 Coin Flips

In this activity you will be exploring the following questions:

If we flip a “fair” coin 10 times, how many heads would we expect? How much variation in the results would we expect if we did this many times?

To access the activty
2.4.1: Monte Carlo Simulation 1: Coin Flips
##### Vocab

In a simulation, each time the model is used to produce a sample of data, it is referred to as a trial. A trial can consist of one or many outcomes depending on the simulation. In this simulation, the trial consisted of 10 outcomes (flips).

The summary of the trial, or how we quantify the sample, is referred to as the trial’s result. In this simulation, the result would be the number of heads.

### 2.4.2 Monte Carlo Simulation 2: Generating a Sample of Students

In a previous course activity, you set up a sampler to generate data for 25 students from a population of students, where 40% of the population are freshmen, 30% are sophomores, 15% are juniors, and 15% are seniors.

In this Monte Carlo simulation you will be exploring the following questions:

In a class of 25 randomly selected students, how many juniors would we expect? How much variation in the the number of juniors would we expect if we generated many samples?

To access the activty
2.4.2: Monte Carlo Simulation 2: Generating a Sample of Students