Pois | R Documentation |
The Poisson distribution is a discrete probability distribution that models
the number of events occurring in a fixed interval of time or space, given
that the events occur with a constant rate \lambda > 0
and
independently of the time since the last event.
Pois(lambda = 1)
## S4 method for signature 'Pois,numeric'
d(distr, x, log = FALSE)
## S4 method for signature 'Pois,numeric'
p(distr, q, lower.tail = TRUE, log.p = FALSE)
## S4 method for signature 'Pois,numeric'
qn(distr, p, lower.tail = TRUE, log.p = FALSE)
## S4 method for signature 'Pois,numeric'
r(distr, n)
## S4 method for signature 'Pois'
mean(x)
## S4 method for signature 'Pois'
median(x)
## S4 method for signature 'Pois'
mode(x)
## S4 method for signature 'Pois'
var(x)
## S4 method for signature 'Pois'
sd(x)
## S4 method for signature 'Pois'
skew(x)
## S4 method for signature 'Pois'
kurt(x)
## S4 method for signature 'Pois'
entro(x)
## S4 method for signature 'Pois'
finf(x)
llpois(x, lambda)
## S4 method for signature 'Pois,numeric'
ll(distr, x)
epois(x, type = "mle", ...)
## S4 method for signature 'Pois,numeric'
mle(distr, x, na.rm = FALSE)
## S4 method for signature 'Pois,numeric'
me(distr, x, na.rm = FALSE)
vpois(lambda, type = "mle")
## S4 method for signature 'Pois'
avar_mle(distr)
## S4 method for signature 'Pois'
avar_me(distr)
lambda |
numeric. The distribution parameter. |
distr |
an object of class |
x |
For the density function, |
log , log.p |
logical. Should the logarithm of the probability be returned? |
q |
numeric. Vector of quantiles. |
lower.tail |
logical. If TRUE (default), probabilities are
|
p |
numeric. Vector of probabilities. |
n |
number of observations. If |
type |
character, case ignored. The estimator type (mle or me). |
... |
extra arguments. |
na.rm |
logical. Should the |
The probability mass function (PMF) of the Poisson distribution is:
P(X = k) = \frac{\lambda^k e^{-\lambda}}{k!}, \quad k \in
\mathbb{N}_0.
Each type of function returns a different type of object:
Distribution Functions: When supplied with one argument (distr
), the
d()
, p()
, q()
, r()
, ll()
functions return the density, cumulative
probability, quantile, random sample generator, and log-likelihood functions,
respectively. When supplied with both arguments (distr
and x
), they
evaluate the aforementioned functions directly.
Moments: Returns a numeric, either vector or matrix depending on the moment
and the distribution. The moments()
function returns a list with all the
available methods.
Estimation: Returns a list, the estimators of the unknown parameters. Note that in distribution families like the binomial, multinomial, and negative binomial, the size is not returned, since it is considered known.
Variance: Returns a named matrix. The asymptotic covariance matrix of the estimator.
Functions from the stats
package: dpois()
, ppois()
, qpois()
,
rpois()
# -----------------------------------------------------
# Pois Distribution Example
# -----------------------------------------------------
# Create the distribution
lambda <- 5
D <- Pois(lambda)
# ------------------
# dpqr Functions
# ------------------
d(D, 0:10) # density function
p(D, 0:10) # distribution function
qn(D, c(0.4, 0.8)) # inverse distribution function
x <- r(D, 100) # random generator function
# alternative way to use the function
df <- d(D) ; df(x) # df is a function itself
# ------------------
# Moments
# ------------------
mean(D) # Expectation
median(D) # Median
mode(D) # Mode
var(D) # Variance
sd(D) # Standard Deviation
skew(D) # Skewness
kurt(D) # Excess Kurtosis
entro(D) # Entropy
finf(D) # Fisher Information Matrix
# List of all available moments
mom <- moments(D)
mom$mean # expectation
# ------------------
# Point Estimation
# ------------------
ll(D, x)
llpois(x, lambda)
epois(x, type = "mle")
epois(x, type = "me")
mle(D, x)
me(D, x)
e(D, x, type = "mle")
mle("pois", x) # the distr argument can be a character
# ------------------
# Estimator Variance
# ------------------
vpois(lambda, type = "mle")
vpois(lambda, type = "me")
avar_mle(D)
avar_me(D)
v(D, type = "mle")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.