HW7

1) Uniform Distribution

Let X1, X2, . . . , Xn be n mutually independent random variables, each of which is uniformly distributed on the integers from 1 to k. Let Y denote the minimum of the Xi’s. Find the distribution of Y .

The uniform distribution formula of Y is Y = 1/xa-xa

a <- runif(1000)
d <-density(1/(max(a)-min(a)),min(a))
plot(d)

d
## 
## Call:
##  density.default(x = 1/(max(a) - min(a)), bw = min(a))
## 
## Data: 1/(max(a) - min(a)) (1 obs.);  Bandwidth 'bw' = 0.0004737
## 
##        x                y          
##  Min.   :0.9993   Min.   :  9.445  
##  1st Qu.:1.0000   1st Qu.: 67.160  
##  Median :1.0007   Median :272.867  
##  Mean   :1.0007   Mean   :350.542  
##  3rd Qu.:1.0014   3rd Qu.:633.897  
##  Max.   :1.0021   Max.   :841.995

2) Machine Lifetime

Your organization owns a copier (future lawyers, etc.) or MRI (future doctors). This machine has a manufacturer’s expected lifetime of 10 years. This means that we expect one failure every ten years. (Include the probability statements and R Code for each part.).

a) Geometric

What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a geometric. (Hint: the probability is equivalent to not failing during the first 8 years..)

c<-c(1,2,3,4,5,6,7,8,9,10)
f<- 1/10
nf<- 9/10
n <- 8
m<- 1/10
nf8<- round(nf^n,2)
ev<-sum(c[1:8]*nf+c[9:10]*f)/10
std<-sd(c[1:8]*nf+c[9:10]*f)

The geometric probability of the machine failing after 8 years is 0.43, expected value is 4 and standard deviation is 2.2168188

b) Exponential

What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as an exponential.

nf8 <- round(exp(log(nf^n)),2)
ev<-sum(c[1:8]*nf+c[9:10]*f)/10
std<-sd(c[1:8]*nf+c[9:10]*f)

The expected exponential probability of the machine failing after 8 years is 0.43

c) Binomial

What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a binomial. (Hint: 0 success in 8 years)

f<-dbinom(8,10,.9)
nf<- 1-dbinom(8,10,.9)
cf<- c(9,10)
cnf<-c(1,2,3,4,5,6,7,8)
ecf <- sum(f*cf)/10
ecnf <- sum(nf*cnf)/10
sdcf <- sd(f*cf)
sdnf <- sd(nf*cnf)
ef<- round(ecf + ecnf, 2)
std<- round(sdcf + sdnf, 2)
nf8 <- round((1- f*nf)/2, 2)

The expected probability of the machine as a binomial failing after 8 years is 0.42, standard deviation is 2.11 and expected value is 3.27

d) Poisson

What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a Poisson.

f<-rpois(8, .1)
nf<-rpois(8, .9)
cf<- c(9,10)
cnf<-c(1,2,3,4,5,6,7,8)
ecf <- sum(f*cf)/10
ecnf <- sum(nf*cnf)/10
sdcf <- sd(f*cf)
sdnf <- sd(nf*cnf)
ref<- round(ecf + ecnf, 2)/2
rstd<- round(sdcf + sdnf, 2)/2
rnf8 <- round((1-(sum(f)/length(f))*(sum(nf)/length(nf))), 2)/2

The expected probability and SD of the machine failing after 8 years is 0.5, standard deviation is 3.5 and expected value is 2.75