Refrences: https://math.dartmouth.edu/archive/m20f10/public_html/HW5Solutions.pdf
The distribution of Y can be found by the following:
For 1 <= j <= k, m(j) = ((k-j+1)^n - (k-j)^n) / k^n
To find the distribution function, we would need to calculate the number of way to assign X1 - Xn values between j and k having at least one Xi equal j and then divide by all the ways to assign X1-Xn values from 1-k without any conditions.
p <- 0.1
n <- 8
Probability of failure after 8 years: P(x=n) = ((1-p)^n-1)*p
# Using dgeom()
dgeom(n,p)
## [1] 0.04304672
((1-p)^(n-1))*p
## [1] 0.04782969
Expected value: 1/p
1/p
## [1] 10
Standard Deviation: sqrt((1-p)/(p^2))
sqrt((1-p)/(p^2))
## [1] 9.486833
#Using dexp
dexp(n,p)
## [1] 0.0449329
#Using exponential distribution formula
0.1*(exp(1)^-(p*n))
## [1] 0.0449329
Expected value: 1/p
1/p
## [1] 10
Standard Deviation: sqrt((1/p)^2)
sqrt((1/p)^2)
## [1] 10
#Using dbinom
dbinom(0,n,p)
## [1] 0.4304672
#Using Binomial distribution formula
choose(n,0)*(p^0)*((1-p)^(n-0))
## [1] 0.4304672
Expected value: n*p
n*p
## [1] 0.8
Standard Deviation: sqrt(nxpx(1-p))
sqrt(n*p*(1-p))
## [1] 0.8485281
#Using dpois
dpois(0,n*p)
## [1] 0.449329
#Using Poisson approximation formula
((exp(1)^-(n*p))*((n*p)^0))/factorial(0)
## [1] 0.449329
Expected value: n*p
n*p
## [1] 0.8
Standard Deviation: sqrt(n*p)
sqrt(n*p)
## [1] 0.8944272
ppois(1,1000/500, lower.tail=F)