Question: II. This problem will use R to find all possible orderings of 5 objects, and probabilities associated with it. Consider your vector of possible values

II. This problem will use R to find all possible orderings of 5 objects, and probabilities associated with it. Consider your vector of possible values to be: Values = c("A","B","C","D","E")

(a) Use the function sample to sample from Values 5 times (without replacement), and call this value one.draw. Then, use the following code to collapse the vector of 5 characters into a vector of 1 character: one.order = paste(one.draw,collapse = "") and display the value one.order.

(b) Use an sapply to repeat (a) 100000 times. Then, on your vector of 100000 objects, find the number of unique values by using a command similar to the below: length(unique(Result)) Report back the number of unique characters in your vector.

(c) Using your vector from (b), find the probability that the order was exactly the following: "ABCDE"

(d) Using your vector from (b), find the probability that the draw begin with an "A", and ended with an "E".

R coding

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!