STAT 2011 Probability and Estimation Theory – Semester 1, 2021

Computer Practical Sheet Week 7


Computer Problems for Week 7

For this weeks lab report: Please submit your code, plot, and any comment re-quired, for Q1 only. An assignment item has been set up on Canvas; file upload format is limited to pdf, html, or word.


1. We will use simulation to demonstrate the minimum of iid exponential random variables is another exponential random variable.

(a) Set B=1000, n=10. Sample a vector of n*B=10000 from the exponential distribution with = 1, using rexp(n*B, rate=1) . Store the vector in a B-by-n matrix called x.exp (use the function matrix). No need to print out the values. Note: Pay attention to how the parameter rate is defined in the function rexp. For an exponential distribution with parameter and pdf , the mean is 1/, and rate is 1/mean. Thus rate is equal to . See help(rexp).

(b) Find the minimum of every row in x.exp using apply(x.exp, min, ...) (fill out the rest of the command). Store the results in a vector called x.min. No need to print out the values.

(c) x.min should follow an exponential distribution with parameter . State the value of with a brief explanation, by quoting the minimum exponential example in Lecture 19.

(d) Plot the histogram of x.min using

hist(x.min, prob=TRUE, ...)

and overlay the histogram with the pdf of exponential using

curve(dexp(x,rate=...), add=T).

Clearly label the title, x and y axes. Comment on how well the theoretical curve fits

the observed values in the histogram.