Site icon R-bloggers

Poisson Functions in R Programming

[This article was first published on Data Analysis in R » Quick Guide for Statistics & R » finnstats, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The post Poisson Functions in R Programming appeared first on finnstats.

If you want to read the original article, click here Poisson Functions in R Programming.

Are you looking for the latest Data Science Job Vacancies / Internship then click here finnstats.

We encourage that you read this article from finnstats to stay up to date..

Poisson Functions in R Programming, the likelihood of a certain number of events occurring in a given period of space or time if these occurrences occur at a known constant mean rate is represented by the Poisson distribution (free of the period since the ultimate event).

Siméon Denis Poisson is the name given to the Poisson distribution (French Mathematician).

Cluster Meaning-Cluster or area sampling in a nutshell » finnstats

With the help of R’s built-in functions, many probability distributions may be simply implemented.

Poisson Functions in R Programming

In R, there are four Poisson functions to choose from:

Function              Description

dpois     Poisson probability mass function (Probability function)

ppois     Poisson distribution (Cumulative distribution function)

qpois     Poisson quantile function

rpois      Poisson pseudorandom number generation

1. Poisson Probability Mass Function- dpois()

For any value of k, the R dpois function can be used to calculate the Poisson probability function with mean lambda. The arguments of the function are summarised in the code below.

Data Visualization Graphs-ggside with ggplot » finnstats

Syntax:

dpois(k,lambda, log)

where,

 k: number of successful events that happened in an interval

lambda: mean per interval

log: If TRUE then the function returns probability in form of log.

Coefficient of Variation Example » Acceptable | Not Acceptable» finnstats

dpois(2, 3)
[1] 0.2240418
dpois(6, 6)
[1] 0.1606231

2. Poisson Distribution- ppois()

The ppois function can be used to compute the probability of a variable X following a Poisson distribution with values equal to or lower than X. The arguments are listed below:

Syntax:

ppois(q, lambda, lower.tail, log)

where,

 q: number of successful events that happened in an interval

lambda: mean per interval

lower.tail: If TRUE, the left tail is taken into account; if FALSE, the right tail is taken into account.

log: If TRUE then the function returns probability in form of a log.

Types of Regression Techniques Guide » finnstats

ppois(2, 3)
 [1] 0.4231901
ppois(6, 6)
[1] 0.6063028

3. Poisson pseudorandom-rpois()

The rpois function can be used to draw q observations from a Poisson distribution. The arguments of the function are summarised in the code below.

Syntax:

rpois(q, lambda)

where,

q: number of random numbers needed

lambda: mean per interval

How to calculate Hamming Distance in R » finnstats

rpois(2, 3)
[1] 4 1
rpois(6, 6)
[1]  9  2  9  9  1 10

4. Poisson quantile function-qpois()

The associated Poisson quantiles for a collection of probabilities can be obtained using the R qpois function.

Syntax:

qpois(q, lambda, lower.tail, log)

where,

 q: number of successful events that happened in an interval

lambda: mean per interval

lower.tail: If TRUE, the left tail is taken into account; if FALSE, the right tail is taken into account.

log: If TRUE, the function returns probability as a logarithm.

Funnel Chart in R-Interactive Funnel Plot » finnstats

y <- c(.021, .053, .21, .32)
qpois(y, 2)
[1] 0 0 1 1
qpois(y, 6)
[1] 2 2 4 5

Subscribe to our newsletter!

To read more visit Poisson Functions in R Programming.

If you are interested to learn more about data science, you can find more articles here finnstats.

The post Poisson Functions in R Programming appeared first on finnstats.

To leave a comment for the author, please follow the link and comment on their blog: Data Analysis in R » Quick Guide for Statistics & R » finnstats.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.