![]() |
VOOZH | about |
The Poisson distribution is a probability distribution used to model the number of times an event occurs in a fixed interval of time or space. It assumes that the events occur independently and at a constant average rate.
Formula:
Parameters:
R programming language provides built-in support for Poisson distribution through four core functions.
The dpois() function calculates the probability of observing exactly k events in a Poisson distribution.
Syntax:
dpois(k, lambda, log = FALSE)
Parameters:
Output:
[1] 0.2240418
[1] 0.1606231
The ppois() function calculates the cumulative probability of having k or fewer events.
Syntax:
ppois(q, lambda, lower.tail = TRUE, log = FALSE)
Parameters:
TRUE, calculates P(X ≤ q); if FALSE, calculates P(X > q)Output:
[1] 0.4231901
[1] 0.6063028
The rpois() function generates random numbers following a Poisson distribution.
Syntax:
rpois(n, lambda)
Output:
[1] 2 3
[1] 6 7 6 10 9 4
The qpois() function calculates the smallest value k such that the cumulative probability is at least p.
Syntax:
qpois(p, lambda, lower.tail = TRUE, log = FALSE)
Parameters:
TRUE, computes lower tail; otherwise upper tailOutput:
[1] 0 0 0 1
[1] 1 2 3 4
These functions allow us to work with Poisson-distributed data in R programming language.