1 Find the distribution of Y

  • section 5.1.6
  • most of what follows is taken almost directly from solution set presented in the above problem
  • From the above link: “Then, the total possible number of assignments for the entire collection of random variables X1;X2; :::;Xn is kn.”

total possible number of assignments \[k^n \]

  • The total number of ways to get Y=1 is below
    • This is the total possible combinations- combinations that aren’t equal to 1 \[k^n-(k-1)^n\]
  • total number of ways to get y=2
    • is total combinations, minus combintaions that are not equal to 2, minus the total amount of combinations that are equal to 1 and therefore must be excluded \[\frac{k^n-(k-2)^n -(k^n-(k-1)^n)}{k^n}\]
  • extrapolating to any value of j

\[\frac{(k-j+1)^n - (k-j)^n}{k^n}\]

2

Geometric

  • From wikipedia

  • From above formulas for gemoetrics the cdf equation is \(1-q^{(k+1)}\)
    • 0.612579511
  • Expected Value\(E(x)= \frac{1}{p}\)
    • 10 years before a failure
  • From wiki we can see the variance for gemoetric distibution is \(\frac{(1-p)}{p^2}\)
    • SD= \(\sqrt{\frac{(1-p)}{p^2}}\)
## caclulate probability with cdf equation
p=.1
q=.9
k=8
paste("probability that the machine will fail after 8 years using gemoetric distribution is", 1-q^(k+1))
## [1] "probability that the machine will fail after 8 years using gemoetric distribution is 0.612579511"
## compare using geometric function
paste("compare probability using geom function",pgeom(8, 0.1))
## [1] "compare probability using geom function 0.612579511"
## solve for expected value
paste("expected value is", 1/p)
## [1] "expected value is 10"
##solve for sd
paste("Standard deviation equals",sqrt(q/p**2))
## [1] "Standard deviation equals 9.48683298050514"

B exponential

## find probability
lambda_1 <- .1
x=8
my_prob <- 1- exp(-lambda_1*x)


paste("probability that the machine will fail after 8 years using exponential distribution is", my_prob)
## [1] "probability that the machine will fail after 8 years using exponential distribution is 0.550671035882778"
## compare using exponential function
paste("compare probability using exponential function",pexp(8, 0.1))
## [1] "compare probability using exponential function 0.550671035882778"
## solve for expected value
paste("expected value is", 1/lambda_1)
## [1] "expected value is 10"
##solve for sd
paste("Standard deviation equals",sqrt(1/lambda_1**2))
## [1] "Standard deviation equals 10"

C Binomial

  • From wikipedia
  • probability
    • \({n \choose k} p^k(1-p)^{n-k}\)
    • 0.4304672
  • Expected Value\(E(x)= n*p\)
    • .8 failures in 8 years
  • From wiki we can see the variance for gemoetric distibution is \(np(1-p)\)
    • SD= \(\sqrt{np(1-p)}\)
  • Our hint tells us to assume p has x=0 successes in first 8 years
## Sovle for probability
n <- 8
k <- 0
p <- .1
q <- .9
my_prob <- choose(n,k)*p^k*(q)^(n-k)

paste("probability that the machine will fail after 8 years using binomial distribution is", my_prob)
## [1] "probability that the machine will fail after 8 years using binomial distribution is 0.43046721"
## compare using binomial function
paste("compare probability using geom function",pbinom(0,8,.1))
## [1] "compare probability using geom function 0.43046721"
## solve for expected value
paste("expected value is", n*p)
## [1] "expected value is 0.8"
##solve for sd
paste("Standard deviation equals",sqrt(n*p*(1-p)))
## [1] "Standard deviation equals 0.848528137423857"

D Poisson

  • From wikipedia
  • probability
    • \(\frac{λ^k *e^{-λ})}{K!}\)
  • Expected Value\(E(x)= λ\)
    • .8
  • From wiki we can see the variance for gemoetric distibution is \(np(1-p)\)
    • SD= \(\sqrt{np(1-p)}\)
    • 0.894427190999916
  • Our hint tells us to assume p has x=0 successes in first 8 years

  • For our homework discussion I already built the poisson so I copy pasted the distribution function from there

## calculate probability
find_lambda <- function(probability,N){
    N*(probability)
}

poisson_prob <- function(lambda,x_occurences){
    poisson_prob <- (lambda**(x_occurences)*exp(1)**(-lambda))/(factorial(x_occurences))
    return(poisson_prob)
}                 

probability <- 1/10
N=8
x_occurences <- 0


my_lambda <- find_lambda(probability,N)
my_poisson_probability <- poisson_prob(lambda=my_lambda,x_occurences)
paste("My poisson lambda is",my_lambda," and the probability of  ",x_occurences," failures in",N," years is ",my_poisson_probability)
## [1] "My poisson lambda is 0.8  and the probability of   0  failures in 8  years is  0.449328964117222"
## compare iwth poisson function
ppois(.1,.8)
## [1] 0.449329
## Expected value
paste("expected value is",my_lambda)
## [1] "expected value is 0.8"
## SD
paste("Std deviation is",sqrt(my_lambda))
## [1] "Std deviation is 0.894427190999916"