library(readxl)
QuizModuleParms2019 <- read_excel("C:/Users/suk2d/OneDrive/Willamette/Fall 2019/GSM 5103/Quiz 1/QuizModuleParms2019.xlsx")
library(skimr)
umaint <- runif(10000, 11.52, 21.83)
hist(umaint)
nmaint <- rnorm(10000, mean(umaint), sd(umaint))
hist(nmaint)
ulabor <- runif(10000, 1.46, 7.6)
hist(ulabor)
nlabor <- rnorm(10000, mean(ulabor), sd(ulabor))
hist(nlabor)
umat <- runif(10000, 3.79, 9.31)
hist(umat)
nmat <- rnorm(10000, mean(umat), sd(umat))
hist(nmat)
ulease <- runif(10000, 399409, 408342)
hist(ulease)
nlease <- rnorm(10000, mean(ulease), sd(ulease))
hist(nlease)
uprod <- runif(10000, 14629, 33347)
hist(uprod)
nprod <- rnorm(10000, mean(uprod), sd(uprod))
hist(nprod)
uloss <- runif(10000, 1620.53, 10682.34)
hist(uloss)
nloss <- rnorm(10000, mean(uloss), sd(uloss))
hist(nloss)
table(((nprod*(nmaint+nlabor+nmat))-nlease)>=0)
##
## FALSE TRUE
## 592 9408
No_fail_normal_breakeven <- data.matrix(prop.table(table(((nprod*(nmaint+nlabor+nmat))-nlease)>=0)))
colnames(No_fail_normal_breakeven) <- "Breakeven"
t.test((nprod*(nmaint+nlabor+nmat))-nlease)
##
## One Sample t-test
##
## data: (nprod * (nmaint + nlabor + nmat)) - nlease
## t = 146.47, df = 9999, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 257756.9 264749.8
## sample estimates:
## mean of x
## 261253.3
table(((uprod*(umaint+ulabor+umat))-ulease)>=0)
##
## FALSE TRUE
## 532 9468
No_fail_unif_breakeven <- data.matrix(prop.table(table(((uprod*(umaint+ulabor+umat))-ulease)>=0)))
colnames(No_fail_unif_breakeven) <- "Breakeven"
t.test((uprod*(umaint+ulabor+umat))-ulease)
##
## One Sample t-test
##
## data: (uprod * (umaint + ulabor + umat)) - ulease
## t = 148.53, df = 9999, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 258677.9 265597.0
## sample estimates:
## mean of x
## 262137.5
From normal distribution, breakeven is met 94.08% of the time; from uniform distribution, breakeven is met 94.68% of the time. This seems like a worthwhile investment. The 95% confidence interval for normal distribution is: 2.577569310^{5}, 2.647497710^{5} and uniform distribution is: 2.586779510^{5}, 2.655969510^{5} (both in dollars).
actual_fails <- rbinom(10000, 1, 0.19)
hist(actual_fails)
table(actual_fails>0)
##
## FALSE TRUE
## 8091 1909
prop.table(table(actual_fails>0))
##
## FALSE TRUE
## 0.8091 0.1909
Breakeven <- ((nprod-(nloss*actual_fails))*(nmaint+nlabor+nmat))-nlease
table(Breakeven>0)
##
## FALSE TRUE
## 1102 8898
prop.table(table(Breakeven>0))
##
## FALSE TRUE
## 0.1102 0.8898
t.test(Breakeven)
##
## One Sample t-test
##
## data: Breakeven
## t = 119.72, df = 9999, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 224902.6 232389.9
## sample estimates:
## mean of x
## 228646.3
Instead of ~95% breakeven projection, calculations slightly worsen to ~90% breakeven projection. The 95% confidence interval of returns ranges from $228616 to $236042, so it seems worth it.
#half_fails <- rbinom(10000, 1, 0.5)
half_fails <- runif(10000)
Breakevenhalf <- ((nprod-(nloss*half_fails*actual_fails))*(nmaint+nlabor+nmat))-nlease
table(Breakevenhalf>0)
##
## FALSE TRUE
## 794 9206
prop.table(table(Breakevenhalf>0))
##
## FALSE TRUE
## 0.0794 0.9206
t.test(Breakevenhalf)
##
## One Sample t-test
##
## data: Breakevenhalf
## t = 134.06, df = 9999, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 241232.1 248391.4
## sample estimates:
## mean of x
## 244811.8
Realistically, the breakeven projection is somewhere in between 90% and 95%. The 95% confidence interval of returns ranges from $244353 to $251426, which is an improvement over extension #1 so the investment should be worth it.
customerfail <- rpois(10000, 0.477)
hist(customerfail)
Breakevenfail <- ((nprod-(nloss*half_fails*actual_fails*4))*(nmaint+nlabor+nmat))-nlease
table(Breakevenfail>0)
##
## FALSE TRUE
## 1579 8421
prop.table(table(Breakevenfail>0))
##
## FALSE TRUE
## 0.1579 0.8421
t.test(Breakevenfail)
##
## One Sample t-test
##
## data: Breakevenfail
## t = 78.666, df = 9999, p-value < 2.2e-16
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## 190615.8 200358.1
## sample estimates:
## mean of x
## 195487
The breakeven projection here is ~85%. The 95% confidence interval of returns ranges from $195240 to $204829, which is still generating returns so the investment should be worth it.