1. Write an R function that does the following:
· Simulate rolling an arbitrary number of dice (call this number m).
· Take the maximum of the dice minus the minimum of the dice. For example, if m = 5 and the outcomes are 4, 3, 6, 4, 2, the value we’re looking for is 6 – 2 = 4.
· Repeat this process n times, and return a vector of max-min differences
Your function should have as calling arguments m and n (you may assign default values to them if you wish). Include a comment block that explains what the function does.
Use your function to simulate max-min differences for the values m = 4 and n = 10000. From the results produce an estimated probability mass function for this random variable (round to four decimal places).
Some rules:
· Copy your function and R command output into your homework paper;
· Use Courier New font for R stuff. It is a typewriter font that aligns properly;Include only what is needed to solve the problem: no false starts or core dumps. Don’t print out reams of numbers;
· Make sure that everything you do is clear in what you submit. Indicate your final answer so that it is easy to see.