Let x be the vector 1:366. Use a nested for loop to estimate, for each value of the vector x[i] = i, the corresponding probability y[i] that there will be at least one common birthday if there are i people in a room (ignore leap years, as usual). Your for loop should create a vector y of the same size as x. Now use the plot command plot(x,y) to draw the graph. Use google to see how to add some labels, change the color of the curve to green, make it thicker, and add a title to the graph. Make any other changes that you think will make the graph look nicer. Your assignment should include all of the code (for loop + the codes to make the graph nicer) as well as the final version of the graph. code in R
Get Answers For Free
Most questions answered within 1 hours.