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

The code for matching rounds process for n=5 is n <-5 individuals <- seq(1,n,1)

ID: 3883481 • Letter: T

Question

The code for matching rounds process for n=5 is

n <-5
individuals <- seq(1,n,1)
phones <- individuals
phones <-sample(phones)

matches <-!phones == individuals
individuals <- individuals[matches]
phones <- sample(individuals)

matching.rounds <- function(n){
   individuals <- seq(1, n, 1)
   unmatched <- matrix(1,1,n)
   while(length(individuals) > 0){
         individuals <- individuals[!sample(individuals)==individuals]
         new.unmatched <-matrix(0,1,n)
         new.unmatched[individuals] <- 1
         unmatched <- rbind(unmatched,new.unmatched)
         }
      return(unmatched)
}

matching.rounds(5)

This is meant to be programmed in R GUI. I'm just a bit confused on how to set up the "for" loop and the histogram.

Create a 1000 x 1 matrix called mr. Using a for loop repeat the simulated matching rounds process 1000 times and store the number of rounds required to obtain all of the matches in the rows of mr Create a histogram of the data in mr that has 25 blue bars (use the breaks and col arguments). The main title should say "Matching Rounds n-z" where is the number of individuals used in the simulation. Repeat this experiment usingn 5, 25, and 50. provide detailed comments on the shape of this histograms and what you have learned about the distribution of the number of rounds that are required to complete this process from the simulations. Please include the R code you used for this

Explanation / Answer

Image was not visible kindly provide problem in text format otherwise provide in good quality image format

Thanking You

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