Probability
Load Packages
library(knitr)
library(matlib)Problem Set 1
The answers are in the following pages.
Problem Set 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.).
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..)
What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as an exponential.
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)
What is the probability that the machine will fail after 8 years?. Provide also the expected value and standard deviation. Model as a Poisson.
Answer
- Here, each trial is outcome in each year, which can be a success or a failure. Per manufacturer’s warranty, we expect 1 failure every 10 years. It’s a case of Geometric Distribution. Therefore, “probability of machine failing after 10 years” is equivalent to “1 - probability of machine not failing after 10 years”.
Let’s designate p_failure as “probability of failure 10 years” i.e. 1 failure in 10 years.
Let’s designate p_success = 1 - p_failure.
Let t be number of trials.
Let p_t_success be the probability of success in t years. It’s requied to find the probability of failure after 8 years. Therefore, the machine will succeed for 7 years.
p_failure <- 0.1
p_success <- 1 - p_failure
t <- 8
p_t_success <- ((p_success)^(t - 1)) * (p_failure)^(1)
paste("P(failure after 8 years) =", p_t_success)## [1] "P(failure after 8 years) = 0.04782969"
Let E be the Expected Value, which is calculated below, using formula:
E <- 1/p_failure
paste("Expected Value =", E)## [1] "Expected Value = 10"
Let sd be the Standard Deviation, which is calculated below, using formula:
sd <- sqrt((1 - p_failure) / (p_failure)^2)
paste("Standard Deviation =", sd)## [1] "Standard Deviation = 9.48683298050514"
- The formula for Exponential Distribution is: f(x;Lambda) = (e^( -(Lambda * x) ).
Let p_t_success_exp be the probability of success in t years, modeled in exponential manner.
Let Lambda be the parameter for Exponential Distribution.
Lambda <- p_failure
p_t_success_exp <- ( exp(-(Lambda * t)) )
paste("P(t >= 8 years) =", p_t_success_exp)## [1] "P(t >= 8 years) = 0.449328964117222"
Let E_exp be the Expected Value, modeled in exponential manner, which is calculated below, using formula:
E_exp <- 1/Lambda
paste("Expected Value =", E_exp)## [1] "Expected Value = 10"
Let sd_exp be the Standard Deviation, modeled in exponential manner, which is calculated below, using formula:
sd_exp <- sqrt((1/Lambda^2))
paste("Standard Deviation =", sd_exp)## [1] "Standard Deviation = 10"
- The formula for Binomial Distribution is: P(t > 8) = Choose(8, 0) * p_success^0 * p_failure^8.
Let p_t_success_binom be the probability of success in t years, modeled in binomial manner.
p_t_success_binom <- choose(8, 0) * ((p_failure)^0) * ((p_success)^8)
paste("P(t >= 8 years) =", p_t_success_binom)## [1] "P(t >= 8 years) = 0.43046721"
Let E_binom be the Expected Value, modeled in binommial manner, which is calculated below, using formula:
E_binom <- t * p_failure
paste("Expected Value =", E_binom)## [1] "Expected Value = 0.8"
Let sd_binom be the Standard Deviation, modeled in binommial manner, which is calculated below, using formula:
sd_binom <- sqrt(t * p_failure * p_success)
paste("Standard Deviation =", sd_binom)## [1] "Standard Deviation = 0.848528137423857"
- The formula for Poisson Distribution is: P(t = 8) = (Lambda^8) * e^(-Lambda)/8!, where Lambda average of outcomes i.e. Expected Value, which we computed earlier as 10.
Let p_t_success_poisson be the probability of success in t years, modeled in Poisson manner.
Lambda <- 10
p_t_success_poisson <- (exp(-1 * Lambda) * Lambda^8) / factorial(8)
paste("P(t >= 8 years) =", p_t_success_poisson)## [1] "P(t >= 8 years) = 0.11259903214902"
Let E_poisson, which we used before:
E_poisson <- Lambda
paste("Expected Value =", E_poisson)## [1] "Expected Value = 10"
Let sd_poisson be the Standard Deviation, modeled in Poisson manner, which is calculated below, using formula:
sd_Poisson <- sqrt(Lambda)
paste("Standard Deviation =", sd_Poisson)## [1] "Standard Deviation = 3.16227766016838"
Marker: 605-07