Extracted text: 2. (a) Write a function, called myListFn, which takes a single argument n and implements the following algorithm: 1. Simulate n independent numbers, denoted x = (x1, x2,..., xn), from the N(0, 1) distribution. 2. Calculate the mean X = E- Ti n. 3. If x > 0, then simulate n independent numbers, denoted y (y1, y2,.. ., Yn), from the exponential density with mean X. If x < 0,="" then="" simulate="" n="" independent="" numbers,="" denoted="" z="(21," 2,="" ...,="" zn),="" from="" the="" exponential="" density="" with="" mean="" -x.="" set="" y="(y1," y2,="" ...,="" yn)="-z." 4.="" calculate="" k="" which="" is="" the="" number="" of="" j="" with="" yj|=""> ]xj\. 5. Return the list of x, y and k with names xVec, yVec and count respectively. (b) Execute the following lines and check the format of the answers: lapply( rep(10,4), myListFn ) sapply( rep(10,4), myListFn ) Note that sapply is effectively lapply followed by simplify2array. If myListFn has no arguments, then similar results can be obtained with replicate (4, myListFn()) and replicate(4, myListFn(), simplify=F). Now for a simulation study. Use lapply to call the function myListFn with n = 10 for 1,000 times. So the output consists of 10,000 values for x denoted {rij: i = 1,2,..., 1,000; j = 1, 2, ..., 10}; 10,000 values for y denoted {y;jii = 1, 2, ..., 1,000; j = 1, 2,..., 10}; and 1,000 values for n denoted n1, n2,... , n1000- Denote the output by myList. This output is used in the remaining parts of this question. (c) Extract all the vectors with the name yVec. The result should be a list of 1000 vectors. (d) Extract all the vectors with the name yVec. The result should be a 10 x 1000 matrix with one column for each of the vectors yVec. (e) Create a list which is identical to myList but all the components called count have been removed. (f) Pick out those lists in myList which are such that count is greater than 2.