\[P(Y = y)\]
\[ P(Y = y) = P(X_i = y \text ,X_i > y) \]
\[ P(X_i = y \text, X_i > y) = P(X_1 = y) \times P(X_2 > y) \times \ldots \times P(X_n > y) \]
\(P(X_i = y) = \frac{1}{k}\), $\(P(X_i > y) = \frac{k - y}{k}\)
\[ P(Y = y) = \left( \frac{1}{k} \right) \times \left( \frac{k - y}{k} \right)^{n - 1} \]
\[( y = 1, 2, …, k )\]
\[P(Y = y) = \left\{ \begin{array}{ll}0 & \text{if } y < 1 \\\left( \frac{1}{k} \right) \times \left( \frac{k - y}{k} \right)^{n - 1} & \text{if } 1 \leq y \leq k \\0 & \text{if } y > k \end{array} \right. \]
# expected lifetime in years
lifetime <- 10
# failure rate (lambda) one failure for every ten years
lambda <- 1 / lifetime
# Probability of failure in each year
PoF <- 1 - exp(-lambda)
cat("Probability of failure in each year:", PoF, "\n")
## Probability of failure in each year: 0.09516258
\[ P(X=k)=(1−p)^{k−1}\times p\]
\[ P(failafter8 ears)=1−(1−p)^{8−1} \]
# Probability of failure each year
PoF <- 1 - exp(-lambda)
# Probability of not failing in 8 years
PnoF <- (1 - PoF) ^ 8
# Probability of failing after 8 years
PoFa <- 1 - PnoF
cat("Probability of failing after 8 years:", PoFa, "\n")
## Probability of failing after 8 years: 0.550671
EV <- 1 / PoF
sd <- sqrt((1 - PoF) / PoF^2)
cat("Expected value:", EV, "\n")
## Expected value: 10.50833
cat("Standard deviation:", sd, "\n")
## Standard deviation: 9.995835
\[ P(fails after 8 years)=1−(1−e^ {−λ×8})\]
lambda <- 1 / 10
# Probability that machine fails after 8 years
Pfa8 <- 1 - pexp(8, lambda)
EV <- 1 / lambda
sd <- 1 / lambda
print(Pfa8)
## [1] 0.449329
print(EV)
## [1] 10
print(sd)
## [1] 10
\[P(X=k)=(\frac{n}{k})×p^{k} ×(1−p)^{n−k}\] \[P(fails after 8 years)=P(X=0)\]
period <- 8
# Probability of failure in each year
PoF <- 1/10
# Probability of 0 failures in 8 years using binomial distribution
PnF <- dbinom(0, size = period, prob = PoF)
# Print the probability of 0 failures in 8 years
cat("Probability of 0 failures in 8 years:", PnF, "\n")
## Probability of 0 failures in 8 years: 0.4304672
EV <- period * PoF
sd <- sqrt(period * PoF * (1 - PoF))
cat("Expected value:", EV, "\n")
## Expected value: 0.8
cat("Standard deviation:", sd, "\n")
## Standard deviation: 0.8485281
\[P(X=k)= \frac{e^{−λ}\times λ^k} {k!}\]
period <- 8
# Probability of failure in each year
prob_failure <- 1 - exp(-lambda)
# Expected number of failures in 8 years
expected_failures <- lambda * period
# Probability of the machine failing after 8 years
PoFa <- 1 - ppois(0, lambda = expected_failures)
cat("Probability of failing after 8 years:", PoFa, "\n")
## Probability of failing after 8 years: 0.550671
EV <- expected_failures
sd <- sqrt(expected_failures)
cat("Expected value:", EV, "\n")
## Expected value: 0.8
cat("Standard deviation:", sd, "\n")
## Standard deviation: 0.8944272