#### Make a simulation and function using R.

I continue to teach some R programming in my AP Stats class because this is an essential skill for them to have.

We are now in chapter five of our textbook, Probability and Simulation. I had my students review the parking problem on page 290. The problem asked to make a simulation of picking two students from a total of 95 in the high school and finding the probability that these two students are from the same class of only 28 students.

The textbook solves the simulation problem by using the random number table in the back of the book. By reading across, you read two digits at a time and check to see if the two numbers are less than or equal to 28.

To use the random digits chart, you need to number the students from 01 to 95. Since there are 28 students in the class that won the lottery, we want to simulate the probability of picking two students from this class of 28 students from the total population of 95.

For this lesson, I wanted my class to explore the concept of simulation more in depth and I thought using R would be better at teaching this lesson than using our TI Nspire calculators. The book’s example gives the simulated probability at about 10 percent.

To begin, [Read more…] about Simulation in R For AP Statistics