Blog of Andrés Aravena
CMB2:

# Homework 9

26 April 2019. Deadline: Friday, 3 May, 9:00.

# 1. How many persons with epilepsy in our course?

According to the slides, the proportion of epilepsy on the population is 1%. If you take a group of M people, what is the relative frequency of epilepsy on the group?

Write a function to simulate a group of M people. The function must return the (random) number of people with epilepsy on that group

epilepsy <- function(M) {
}

Simulate N=1E4 times for different values of M. For example, you can take M from the vector seq(from=10, to=90, by=10). Then you can make a plot like this:

# 2. Birthdays on the same day

What is the chance that two people in our class share the same birthday?

Write a function to simulate a group of M people. The function must return TRUE if there are at least 2 persons with the same birthday

same_birthday <- function(M) {
}
Simulate N=1E4 times for different values of M. For example, you can take M from the vector seq(from=10, to=90, by=10). For each simulation, calculate the proportion of TRUE cases, and store it in a vector. Then you can make a plot like this: