Exercise: Automate the Repeated Tasks and Simulate the Data

Use what we’ve learned to write functions to either automate tasks repeatedly or simulate data of experiments for better understanding.

We'll cover the following

Let’s test what we’ve learned so far regarding tasks repetitions.

Assignment

Follow the steps below to complete the assignment:

  1. Modify the final version of the function we wrote, predTrialSim, to include another argument that allows us to vary the number of prey animals in each predation trial.

  2. Pick at least four values for the number of prey in each trial and make a meaningful plot that explores how detecting a statistically significant difference in predators varies with the size of the pool of animals in each trial.

  3. Deduce which is more important, running more trials or running trials with more animals?

Below is the final version of the predTrialSim function we made before. In this version, we can alter the number of predation trials we’re running and what proportion of prey each predator eats on average.

Get hands-on with 1400+ tech skills courses.