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 =...

1 answer below »

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.




Semester 2 Due 15 October 2020 Simple R programming script 1. Write an R function that does the following: 0. Simulate rolling an arbitrary number of dice (call this number m). 0. 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. 0. 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: 0. Copy your function and R command output into your homework paper; 0. 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; 0. Make sure that everything you do is clear in what you submit. Indicate your final answer so that it is easy to see. Semester 2 Due 15 October 2 020 Simple R programming scr ipt 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 cal ling 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 . Fro m 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 t hat 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. Semester 2 Due 15 October 2020 Simple R programming script 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.
Answered Same DayOct 15, 2021

Answer To: 1. Write an R function that does the following: · Simulate rolling an arbitrary number of dice...

Sudipta answered on Oct 15 2021
145 Votes
##function for taking random value for a dice and find the difference of max and min
new.function<-
function(n, m) {
l<-c() ##creating a list to hold all the min,max difference values
##Start of loop
i <- 1
while(i<=n) {
a<-c(1,2,3,4,5,6) ##get random values from a dice
ans=sample(a,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here