Question: please use R!!! please use R!!! please use R!!! please use R!!! please use R!!! please use R!!! Question 1 Your lecturer loves chocolate and
please use R!!! please use R!!! please use R!!!
please use R!!!
please use R!!!
please use R!!!
Question 1 Your lecturer loves chocolate and has two boxes of chocolates in her office, one in the upper drawer and one in the lower drawer of her desk. Whenever she craves for a chocolate, she selects a drawer at random and takes a chocolate from the box in that drawer. We assume that each of the boxes originally contained 20 chocolates. Suppose your lecturer opens a drawer and discovers for the first time that the box in that drawer is empty. We let X denote the number of chocolates left in the other box It can be shown that the pmf of X is (40-x) P(X=x) = 20*25-40, x=0.12.20 (a) Define the pmf of X as a function in R. then plot this pmf over its range. (b) Find the probability P(X 5) using the function you defined in (a). (c) Use the sample(...) function to generate 10000 observations from the pmf of X. Assign the results to a variable. (d) Use the observations generated in (c) to obtain an estimate of P(X 25), and compare your answer with what you found in (b). My answer: (Alt + A) (e) Find the mean of X. E(X), using the function you defined in (a). (f) Use the observations generated in (c) to obtain an estimate of E(X), and compare your answer with what you found in (e). My answer: (6) Find E[(x + 1)-] both using the function you defined in (a) and using the observations generated in (c), and compare your two answers. My
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
