Week7 Assignment Data605

1. 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 .

\({ \quad { X }_{ i\quad }\in \quad N(1,k) }\)

\({ Y\quad =\{ \quad { Y }|\quad min({ X }_{ i\quad }),\quad i\quad =\quad 1.....n\quad \} }\)


\(f({ x }_{ i })=\frac { 1 }{ k } ,\quad 1\le \quad { x }_{ i }\quad \le \quad k\)

\(f({ x }_{ i })=0,\quad otherwise\)


For approching the discrect probability of the getting min(yi) in a rang N(1,k), I can process as the following:

\(P[min({ y }_{ i\quad })=1]\quad \\ =\quad 1\quad -{ p[{ x }_{ i\quad }>\quad 1] }\quad \\ =\quad 1\quad -\prod _{ i=1 }^{ i=n } \int _{ 1 }^{ k }{ f({ x }_{ i }) } d{ x }_{ i }\\ =1-{ \left( \frac { k-1 }{ k } \right) }^{ n }\)


=>\(P[min({ y }_{ i\quad })=2]\quad \\ =\quad 1\quad -\quad \prod _{ i=1 }^{ i=n }{ p[{ x }_{ i\quad }>\quad 2] } \quad -\quad P[min({ y }_{ i\quad })=1]\quad \\ =\quad 1\quad -\prod _{ i=1 }^{ i=n } \int _{ 2 }^{ k }{ \quad f({ x }_{ i })\quad d{ x }_{ i } } -\quad (1-{ \left( \frac { k-1 }{ k } \right) }^{ n })\\ ={ \left( \frac { k-1 }{ k } \right) }^{ n }\quad -\quad { \left( \frac { k-2 }{ k } \right) }^{ n }\)


=> \(P[min({ y }_{ i\quad })=3]\quad \\ =\quad 1\quad -\quad \prod _{ i=1 }^{ i=n }{ p[{ x }_{ i\quad }>\quad 3] } \quad -\quad P[min({ y }_{ i\quad })=1]\quad -\quad P[min({ y }_{ i\quad })=2]\\ =\quad 1\quad -\prod _{ i=1 }^{ i=n } \int _{ 3 }^{ k }{ \quad f({ x }_{ i })\quad d{ x }_{ i } } -\quad (1-{ \left( \frac { k-1 }{ k } \right) }^{ n })\quad -\quad \left( { \left( \frac { k-1 }{ k } \right) }^{ n }\quad -\quad { \left( \frac { k-2 }{ k } \right) }^{ n } \right) \\ ={ \left( \frac { k-2 }{ k } \right) }^{ n }\quad -\quad { \left( \frac { k-3 }{ k } \right) }^{ n }\)

=> Steps: \(\dots\)

I get the following probability approach:

P[min(yi=1)] > P[min(yi=2)] > P[min(yi=3)] > … > P[min(yi=k)]


let’s do observation in simulation

k=10,n=10

#generate 10 samples x, each x from sample function: sample(1:10,10,replace = T), randomly pick a integer from N(1,10) 
#set y euqal to the min(x1...x10)
#replicate 1000 time
#plot 1000 results of y

Y<- replicate(1000, { 
  y <- min(sample(1:10,10,replace = T))
  })
hist(Y)

K=100, n=10

#generate 10 samples X, each x from sample function: sample(1:100,10,replace = T), using sample function randomly pick a integer from N(1,100)
#set y euqal to the min(x1...x10)
#replicate 1000 time
#plot 1000 results of y

Y<- replicate(1000, { 
  y <- min(sample(1:100,10,replace = T))
  })
hist(Y)

K=10, n=100

The result becomes 100% getting 1, since generate 100 numbers from rang (1,10), and in 100 samples Xi has vary less chance not paicking 1, so that Probability of min yi is approximatly to 1.

#generate 100 samples X, each x from sample function: sample(1:10,100,replace = T), using sample function randomly pick a integer from N(1,10)
#set y euqal to the min(x1...x10)
#replicate 1000 time
#plot 1000 results of y

Y<- replicate(1000, { 
  y <- min(sample(1:10,100,replace = T))
  })
hist(Y)


2. 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. 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..)

Geomeric distribution:

\(mean = \frac{1-p}{p}\)

=>\(10 = \frac{1-p}{p}\)

=> \(p= \frac{1}{11}\)

\(variance = \frac{1-p}{p^2}\)

=> \(SD= \sqrt{\frac{1-p}{p^2}}\)

=> \(SD = 1/11\)

pgeom(8,1/11)
## [1] 0.5759024

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

Exponential distribution:

\(mean = \frac{1}{\lambda}\)

=>\(10 = \frac{1}{\lambda}\)

=> \(\lambda = \frac{1}{10}\)

\(variance = \frac{1}{\lambda^2}\)

=> \(SD= \sqrt{\frac{1}{\lambda^2}}\)

=> \(SD = 1/10\)

pexp(8,1/10)
## [1] 0.550671

c. 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)

bionomial distribution: Assume p=q=0.5

\(mean = np\)

\(10 = n(0.5)\)

=> \(n=20\)

\(variance = np(1-p)\)

=> \(SD = \sqrt{10(1-0.5)}\)

=> \(SD = \sqrt{5}\)

pbinom(8,20,0.5)
## [1] 0.2517223

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

poisson distribution:

\(mean = \lambda\)

=>\(10=\lambda\)

\(variance = \lambda = 10\)

=> \(SD = \sqrt{10}\)

ppois(8,10)
## [1] 0.3328197