Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Next, you will write a code to simulate multiple classrooms. Assume that each cl

ID: 3239198 • Letter: N

Question

Next, you will write a code to simulate multiple classrooms. Assume that each classroom has 26 students. Additionally, each student has an equally likely chance of having one of the 365 birthdays. (a) Let N = 100 be the number of classrooms. (ie. You are sampling 100 random classrooms of 26 students.) Record the number of classrooms, out of 100, in which there are two or more students who share a birthday. Find the proportion of the classrooms in which there are two or more students who share a birthday. (b) Repeat (a) for 500, 1000 and 2000 classrooms. (c) Summarize the results from Problem 3 in a table and with complete sentences (typed). Include your codes in your write-up.

Explanation / Answer

n=100
flag=0
for(i in 1:n)
{
x=runif(26,1,365)

y=x-x%%1

count=0
for(k in 2:26)
{
for (j in 1:(k-1))
{
if(y[k]==y[j])
{count=count+1}
}
}

if(count==0)
flag=flag
else
flag=flag+1

}

flag
proportion=flag/n


so, answer a) .61
b) 0.622, 0.63, 0.623 ets

it will be different each time you simulate.

c. coder are already given

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote