Problem 1

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.079003
(1-.2)**10 - (1-.3)**10
## [1] 0.07912666

Problem 2

As we’ll see below, some distributions make for better survival models than others!

a)

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.569192
mean(samples) + 1 #Add the 1 success in
## [1] 9.990389
sd(samples)
## [1] 9.463304

b)

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.551051
mean(samples)
## [1] 9.984899
sd(samples)
## [1] 9.976616

c)

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

Bootstrapped

samples <- rbinom(1000000,8,.1)

1-length(samples[samples ==0])/length(samples) #(P(t <= 8))
## [1] 0.569561
mean(samples)
## [1] 0.799781
sd(samples)
## [1] 0.8481073

d)

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.332755
mean(samples)
## [1] 10.00107
sd(samples)
## [1] 3.160352

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.