Hint from class video 7:
\[ P(Y < y) = P(\min(x_1, x_2, \ldots, x_n) < y), \]
Where \(y\) is the minimum of each random variable, and only one or more \(X_i\) need to be greater. To solve this, we can use the complement (negation) to find the probability:
\[ 1 - P(Y > y) = 1 - P(x_1 > y, x_2 > y, \ldots, x_n > y). \]
Assuming they are identically distributed (iid), this is equal to the probability above multiplied by each other:
\[ 1 - P(Y > y) = 1 - P((x_1 > y)(x_2 > y) \ldots (x_n > y)). \]
The probability of \(X_i > y\) is equal to f(y) the cumulative distribution function (CDF). The CDF is also equal to, and we can plug this in for it, which is the greater than case. \[ 1 - P(Y > y) = (1 - F(y))^n \] Next, to get the distribution of the minimum we subtract one from it \[ P(Y > y) = 1-(1 - F(y))^n \] Another way to write it is: \[ P(Y > y) = 1-(\frac{k - y}{k})^n \] Next find the probability mass function of \[ y \$\$ P(Y = y) = P(Y \leq y) - P(Y \leq y - 1) \]
Substituting CDF:
\[P(Y=y) = \left[1 - \left(\frac{k-y}{k}\right)^n\right] - \left[1 - \left(\frac{k-y+1}{k}\right)^n\right] \] \[ P(Y=y) = \left(\frac{k-y+1}{k}\right)^n - \left(\frac{k-y}{k}\right)^n \]
hint: answers for a b and c should be similar/ rounding errors of each other
p_failure = 1/10 #probability of failure in any year
(Hint: the probability is equivalent to not failing during the first 8 years..)ie fails in the 9th yr of later
The geometric probability formula is P(X=x)= (1-p) ^ ((x-1))
#I tried using $ above but I couldnt figure out how to add the whole (x-1) as the power
#probability of failure after 8 years
p_8_years = (1 - p_failure)^(8 - 1) * p_failure
p_8_years
## [1] 0.04782969
Geometric distribution: Expected Value is \[E(X) = \frac{1}{p}\] Geometric distribution: Standard deviation is \[SD(X) = \sqrt \frac{1-p}{p^2}\]
# Calculate the expected value
expected_value = 1 / p_failure
# Calculate the standard deviation
standard_deviation = sqrt((1 - p_failure) / (p_failure^2))
expected_value
## [1] 10
standard_deviation
## [1] 9.486833
Use CDF of the exponential distribution \[P(x>8)=1-{P(X \leq 8)}\] and use lambda as 1/10 for expected life time of 10yrs
lambda <- 1/10
# Calculate the probability of not failing, or surviving for 8 years
p_surviving_8_years <- 1 - pexp(8, rate = lambda) #reminder- calculate cdf with pexp
p_surviving_8_years
## [1] 0.449329
For EV and SD using 1/lambda, use e to clarify its for exponential
e_expected_value <- 1 / lambda
# Calculate the standard deviation
e_standard_deviation <- 1 / lambda
e_expected_value
## [1] 10
e_standard_deviation
## [1] 10
(Hint: 0 success in 8 years) aka k=0 failures n=8 years
Binomial probability formula: probability of experiencing exactly k failures is equal to (n k) the binomial coefficient times probability of failure in each year to the k power of failures, times 1−p, probability of success
# P of zero failures in 8 years
k <- 0
n <- 8
#P of failure in a year
p_failure <- 1/10
# binomial probability
probability_zero_failures <- dbinom(k, size = n, prob = p_failure)
probability_zero_failures
## [1] 0.4304672
binomial distribution: EX = np sd= \[ \sqrt \ (n*p*(1-p))\]
b_expected_value <- n * p_failure
b_standard_deviation <- sqrt(n * p_failure * (1 - p_failure))
b_expected_value
## [1] 0.8
b_standard_deviation
## [1] 0.8485281
Note to self - when using ‘tex’ its added to the top of the code chunk ```{=tex} rather than the $$ Note look into the headings and how to create part a, b in r so it looks better