distr (version 2.6)

Pois-class: Class "Pois"

Description

The Poisson distribution has density

$$p(x) = \frac{\lambda^x e^{-\lambda}}{x!}$$ for $x = 0, 1, 2, \ldots$. The mean and variance are $E(X) = Var(X) = \lambda$.

C.f. rpois

Arguments

Objects from the Class

Objects can be created by calls of the form Pois(lambda). This object is a Poisson distribution.

Slots

img
Object of class "Naturals": The space of the image of this distribution has got dimension 1 and the name "Natural Space".
param
Object of class "PoisParameter": the parameter of this distribution (lambda), declared at its instantiation
r
Object of class "function": generates random numbers (calls function rpois)
d
Object of class "function": density function (calls function dpois)
p
Object of class "function": cumulative function (calls function ppois)
q
Object of class "function": inverse of the cumulative function (calls function qpois). The quantile is defined as the smallest value $x$ such that $F(x) \ge p$, where $F$ is the distribution function.
support
Object of class "numeric": a (sorted) vector containing the support of the discrete density function
.withArith
logical: used internally to issue warnings as to interpretation of arithmetics
.withSim
logical: used internally to issue warnings as to accuracy
.logExact
logical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function
.lowerExact
logical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function
Symmetry
object of class "DistributionSymmetry"; used internally to avoid unnecessary calculations.

Extends

Class "DiscreteDistribution", directly. Class "UnivariateDistribution", by class "DiscreteDistribution". Class "Distribution", by class "DiscreteDistribution".

Methods

+
signature(e1 = "Pois", e2 = "Pois"): For the Poisson distribution the exact convolution formula is implemented thereby improving the general numerical approximation.
initialize
signature(.Object = "Pois"): initialize method
lambda
signature(object = "Pois"): returns the slot lambda of the parameter of the distribution
lambda<-
signature(object = "Pois"): modifies the slot lambda of the parameter of the distribution

See Also

PoisParameter-class DiscreteDistribution-class Naturals-class rpois

Examples

Run this code
P <- Pois(lambda = 1) # P is a Poisson distribution with lambda = 1.
r(P)(1) # one random number generated from this distribution, e.g. 1
d(P)(1) # Density of this distribution is 0.3678794 for x = 1.
p(P)(0.4) # Probability that x < 0.4 is 0.3678794.
q(P)(.1) # x = 0 is the smallest value x such that p(B)(x) >= 0.1.
lambda(P) # lambda of this distribution is 1.
lambda(P) <- 2 # lambda of this distribution is now 2.
R <- Pois(lambda = 3) # R is a Poisson distribution with lambda = 2.
S <- P + R # R is a Poisson distribution with lambda = 5(=2+3).

Run the code above in your browser using DataCamp Workspace