DESCRIPTION Students: Please keep in mind the OMSI rules. Save your files often, make sure OMSI fills your entire screen at all times, etc. Remember that clicking CopyQtoA will copy the entire question box to the answer box. In questions involving code which will PARTIALLY be given to you in the question specs, you may need add new lines. There may not be information given as to where the lines should be inserted. If a question includes test code, make sure to include it in your submission. Do not simplify R expressions. If your answer is wrong but largely corrected, the full expressions may show that you deserve partial credit. Do not answer any question with simulation code unless this is specified. MAKE SURE TO RUN THE CODE IN PROBLEMS INVOLVING CODE! Hit the OMSI Submit and Run button. QUESTION -ext .R -run 'Rscript omsi_answer1.R' (R code answer, 30 points.) Consider the Machine Repair model, with only one repairperson. We wish find the long-run proportion of repairs that complete during times when both machines are down. Your solution must be excecutable R code (remember, the grading scrpt will directly execute whatever you submit), and it must show your work, via the code and comment lines. Hint: Consider what happens during a long time period (0,t). Fill in the code: # find pi0, pi1, pi2; easiest to use birth-death eqns print(propRepsState0) QUESTION -ext .R -run 'Rscript omsi_answer2.R' (R code answer, 35 points.) Say we fit an HMM to data representing n consecutive time periods, and wish to predict the states in the next k periods. Write a function for this with call form findProbsKLater(hmmOut,k) where hmmOut is the object returned by hmmr::hmm() and k is as above. Return value is a vector, consisting of the probabilities of being in the various states, k time periods after the original data, based on the most likely state at time n. Fill in the code: findProbsKLater <- function(hmmOut,k) { nstates <- hmmOut@nstates # return vector will have length nstates } library(hmmr) durs <- faithful$eruptions set.seed(9999) z <- hmm(durs,2) print(findProbsKLater(z,2)) set.seed(9999) z <- hmm(durs,3) print(findProbsKLater(z,2)) QUESTION -ext .R -run 'Rscript omsi_answer3.R' (R code answer, 35 points.) Let X be a nonnegative, continuous random variable bounded above by c, i.e. P(X < c) = 1. Let Y be the length-biased sampling version of X. Write a function with call form FY(FX,c,t,EX=NULL) where FX is an R function that computes the cdf of X and EX is the expected value of X. The return value will be F_Y(t). If the fourth argument is NULL (test using the R function is.null()), then FY will compute EY first, using the fact that EX = integral t=0 to t=c [1-F_X(t)] (Try this computation on paper with a simple example, so that you understand it.) Hint: Use integration by parts. Fill in the code: FY <- <- function(FX,c,t,EX=NULL) { } FXexample <- <- function(s) s^2 # density is 2t on (0,1) print(FY(FXexample,1,0.5,2/3)) # should be 3/32 print(FY(FXexample,1,0.5)) # should be