Here is the problem discussed in class.
X stands for a random electronic component lifetime. The distribution X in hours is exponential, with rate parameter 1/1000 = .001. We assume that some system uses 8 of these components and that these 8 random lifetimes are mutually independent. We are going to simulate three situations of how the system works:
Use R to randomly generate 10000 lifetimes and then 1000 iterates of component lifetimes for each of the 3 situations just described.
lifetimes <- rexp(10000,.001) samples <- matrix(rexp(80000,.001),ncol=8,nrow=1000) order.stats <- t(apply(samples,1,sort)) data1 <- order.stats[,8] data2 <- order.stats[,1] data3 <- order.stats[,3]Make some histrograms:
layout(matrix(1:4,2,2)) hist(lifetimes,prob=T,xlim=c(0,4500),main="Individual lifetimes") hist(data1,prob=T,xlim=c(0,4500),main="Max") hist(data2,prob=T,xlim=c(0,4500),main="Min") hist(data3,prob=T,xlim=c(0,4500),main="Third Order Statistic") layout(1)Draw the pdfs:
xx <- seq(0,5000,len=201) y1 <- .001*exp(-.001*xx) y2 <- .008*exp(-.001*xx)*(1-exp(-.001*xx))^7 y3 <- .008*exp(-.008*xx) y4 <- .168*exp(-.006*xx)*(1-exp(-.001*xx))^2 plot(xx,y1,type='l',ylim=c(0,.0025)) # original single components pdf lines(xx,y2,type='l',lty=2) #max pdf lines(xx,y3,type='l',lty=3) #min pdf lines(xx,y4,type='l',lty=4) #3rd OS