As the discussion said, I picked my own values for N, X, and p. From those values I calculated lambda and t. To start my code off I assigned those variables.
N = 200
X = 14
p = 0.04
t = 2
lam = 4
Since I assessed it as the easier of the two methods to model I started off with a Binomial Distribution. I ran the barplot twice, the second time with a limit to better see the distribution. Last I saved the probability value I wanted to calculate for later comparison with the Poisson model.
binom_dist = dbinom(0:N, N, p)
barplot(binom_dist, main="Binomial Distribution")
# For a better visual
barplot(binom_dist, xlim=c(0,30), main="Binomial Distribution w/ Limit")
# Determining probability of getting X>=14
# P(X>=14 | p=0.04) = 1 - P(X<=13)
binom_result = 1 - pbinom(X-1, N, p)
I moved on to the Poisson Distribution and found the generated visuals very similar to the Binomial Distribution. I also calculated and saved the probability to compare later.
poiss_dist = dpois(0:N, lam*t)
barplot(poiss_dist, main="Poisson Distribution")
# For a better visual
barplot(poiss_dist, xlim=c(0,30), main="Poisson Distribution w/ Limit")
# Determining Probability of getting X>=14
# P(X>=14 | lam=4, t=2) = 1 - P(X<=13)
poiss_result = 1 - ppois(X-1,lam*t)
As you see with the results below, the two probability calculations are within fractions of a percentage point with each other.
## Probability Results
## Binomial: 0.0312118
## Poisson: 0.0341807