Grando 7 Discussion

Chapter 5.1 Exercise 13

The Poisson distribution with parameter λ = .3 has been assigned for the outcome of an experiment. Let X be the outcome function. Find \(P(X = 0)\), \(P(X = 1)\), and \(P(X > 1)\).


\(P(X = 0)\)

Answer:

The cumulative poisson distribution function is:

\[P\left( X\le x \right) ={e}^{-\lambda}\sum _{ i=0 }^{ x }{ \frac{{\lambda}^{i}}{i!} } \]

So, by inserting the variables \(x=0\) and \(\lambda=0.3\), we get the following result

library(ggplot2)
lam = 0.3
x = 0
(result <- round(exp(-lam) * (lam^x/(factorial(x))), 3))
## [1] 0.741
ggplot(data.frame(val = seq(0, 10)), aes(val)) + geom_line(aes(y = dpois(val, 
    0.3)), colour = "black") + geom_vline(xintercept = x, color = "black", 
    alpha = 0.75) + geom_text(aes(x = x, y = 0.5, label = sprintf("X = %s\n", 
    result)), color = "black", angle = 90) + labs(x = "X - Value", 
    y = "Probability") + scale_x_continuous(breaks = c(0, 1, 
    2, 3, 4, 5, 6, 7, 8, 9, 10))

R builtin check:

round(dpois(0, 0.3), 3)
## [1] 0.741

\(P(X = 1)\)

Answer:

lam = 0.3
x = 1
(result <- round(exp(-lam) * (lam^x/(factorial(x))), 3))
## [1] 0.222
ggplot(data.frame(val = seq(0, 10)), aes(val)) + geom_line(aes(y = dpois(val, 
    0.3)), colour = "black") + geom_vline(xintercept = x, color = "black", 
    alpha = 0.75) + geom_text(aes(x = x, y = 0.5, label = sprintf("X = %s\n", 
    result)), color = "black", angle = 90) + labs(x = "X - Value", 
    y = "Probability") + scale_x_continuous(breaks = c(0, 1, 
    2, 3, 4, 5, 6, 7, 8, 9, 10))

round(dpois(1, 0.3), 3)
## [1] 0.222

\(P(X > 1)\)

For this one, we just need to sum the values up to \(X = 1\) and subtract from 1:

Answer:

lam = 0.3
(result <- round(1 - exp(-lam) * (lam^0/(factorial(0)) + lam^1/(factorial(1))), 
    3))
## [1] 0.037
ggplot(data.frame(val = seq(0, 10)), aes(val)) + geom_line(aes(y = dpois(val, 
    0.3)), colour = "black") + geom_vline(xintercept = 2, color = "black", 
    alpha = 0.75) + geom_text(aes(x = 2, y = 0.4, label = sprintf("Sum of probabilities to the right = %s\n", 
    result)), color = "black", angle = 90) + labs(x = "X - Value", 
    y = "Probability") + scale_x_continuous(breaks = c(0, 1, 
    2, 3, 4, 5, 6, 7, 8, 9, 10))

round(ppois(1, 0.3, lower.tail = FALSE), 3)
## [1] 0.037