library(visualize)
  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

\(K^n\) represents the total num of combinations. \((k-1)^n\) represents the combinations where none of the Xi are equal to 1.

\[ P(X=1) = \frac{k^n-(k-1)^n}{k^n} \] \[P(X=2) = \frac{(k-2+1)^n-(k-2)^n}{k^n} \]

\[P(X=y) = \frac{(k-y+1)^n-(k-y)^n}{k^n} \]

n = 50
sample <- runif(n, min = 1, max = n)
Y = min(sample)
plot(sample)

hist(sample)

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

pgeom(8, 0.1, lower.tail = F)
## [1] 0.3874205
visualize.geom(8, prob = 0.1, section = "upper")

\[ E(X) = \frac{1}{\lambda} = 1/0.1 = 10\]

\[ \sigma^2 = \sqrt(\frac{1}{\lambda^2}) = \frac{1}{\lambda} = 1/0.1 = 10\]

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

pexp(8, 0.1, lower.tail = F)
## [1] 0.449329
visualize.exp(stat = 8, theta = 0.1, section = "upper")

\[E(X)=np= 8 \times 0.1 = 0.8\]

\[\sigma^2 = \sqrt{npq} = \sqrt{8 \times 0.1 \times 0.9} \approx 0.8485\]

(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)

pbinom(0, 8, 0.1)
## [1] 0.4304672
visualize.binom(stat = 0, size = 8, prob = 0.1, section = "lower")

\[ E(X)=np= 8 \times 0.1 = 0.8\]

\[\sigma^2 = \sqrt{npq} = \sqrt{8 \times 0.1 \times 0.9} \approx 0.8485\]

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

\[P(X = x) = \frac{e^{-\mu}\mu^x}{x!}\]

x <- 8
mu <- 10

dpois(x, mu)
## [1] 0.112599
visualize.pois(stat = c(x,x), lambda = mu, section = "bounded")
## Supplied strict length < 2, setting inequalities to  equal to  inequality.

mu
## [1] 10
sqrt(mu)
## [1] 3.162278