Using the pdf
vec <- ceiling(runif(10000000,0,10))
dim(vec) <- c(1000000,10)
mins <- apply(vec, 1, min)
(length(mins[mins <= 3]) - length(mins[mins <= 2]))/1000000
## [1] 0.079273
(1-.2)**10 - (1-.3)**10
## [1] 0.07912666
As we’ll see below, some distributions make for better survival models than others!
Modeled as t trials, with each trial representing a year, before a success with \(E(t)\) = 10
Since the mean is 10, \(p=.1\)
\(p(t\le 8)\quad =\quad 1-p(t> 8)\quad\)
\(\quad =\quad 1-{ .9 }^{ 8 }\)
=0.5695328
pgeom(7, .1, lower.tail = TRUE, log.p = FALSE) #default in R is n failures instead of n trials
## [1] 0.5695328
\(E(t)=10\)
\(var(t)\quad =\quad \frac { 1-p }{ { p }^{ 2 } }\) \(\sigma = sqrt(var(t))\)
sqrt((1-.1)/.1**2)
## [1] 9.486833
Bootstrapped
samples <- rgeom(1000000, .1)
length(samples[samples <= 7])/length(samples) #(P(t <= 8))
## [1] 0.569949
mean(samples) + 1 #Add the 1 success in
## [1] 9.993256
sd(samples)
## [1] 9.490153
Modeled with t following an exponential distribution
\(\lambda=1/10\)
\(\int _{ 0 }^{ 8 }{ 1/10{ e }^{ -x/10 }dx }\)
\({ e }^{ -x/10 }\overset { 8 }{ \underset { 0 }{ | } }\)
=$1-{ e }^{ -8/10 $
0.550671
pexp(8,.1)
## [1] 0.550671
\(E(t)=10\)
\(var(t)=100\)
\(\sigma = 10\)
Bootstrapped
samples <- rexp(1000000, .1)
length(samples[samples <= 8])/length(samples) #(P(t <= 8))
## [1] 0.550958
mean(samples)
## [1] 9.987042
sd(samples)
## [1] 9.978184
Modeled as expecting 1 failure in 10 trials(years), since time to failure needs a distribution with suppoort on \((0,\infty )\)
If E(failues) = 1 and n = 10 then p = .1.
1-pbinom(0,8,.1) #p(at least 1 failure) in the first 8 years
## [1] 0.5695328
Since we’re not really modelling time to failure, it makes sense to take the expected amount of failures in 8 years, along with the variance in the number of failures.
\(E(f) = np=.8\)
\(var(f) = np(1-p)\)
\(\sigma\) = 0.8485281
Alternatively, we could model this as a Poisson point process with \(\lambda=.1\) . Interarrival time (time between failures) would be exponentially distributed with mean \(1/\lambda\) or 10. This is a more appropriate way of modeling surivival time, but we’ve already computed all of the statistics in part b.
Bootstrapped
samples <- rbinom(1000000,8,.1)
1-length(samples[samples ==0])/length(samples) #(P(t <= 8))
## [1] 0.569319
mean(samples)
## [1] 0.799679
sd(samples)
## [1] 0.8483367
Modeled with t following a Poisson distribution
\(\lambda=10\)
ppois(8, 10)
## [1] 0.3328197
Both \(E(x)\) and \(var(x)\) = \(\lambda = 10\)
\(\sigma =\) 3.1622777
Bootstrapped
samples <- rpois(1000000,10)
length(samples[samples <= 8])/length(samples) #(P(t <= 8))
## [1] 0.333116
mean(samples)
## [1] 10.00306
sd(samples)
## [1] 3.163645