The R Project SVN R

Rev

Rev 68948 | Rev 77691 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68948 Rev 70982
Line 1... Line 1...
1
% File src/library/stats/man/Poisson.Rd
1
% File src/library/stats/man/Poisson.Rd
2
% Part of the R package, https://www.R-project.org
2
% Part of the R package, https://www.R-project.org
3
% Copyright 1995-2014 R Core Team
3
% Copyright 1995-2016 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{Poisson}
6
\name{Poisson}
7
\alias{Poisson}
7
\alias{Poisson}
8
\alias{dpois}
8
\alias{dpois}
Line 38... Line 38...
38
 
38
 
39
  Invalid \code{lambda} will result in return value \code{NaN}, with a warning.
39
  Invalid \code{lambda} will result in return value \code{NaN}, with a warning.
40
 
40
 
41
  The length of the result is determined by \code{n} for
41
  The length of the result is determined by \code{n} for
42
  \code{rpois}, and is the maximum of the lengths of the
42
  \code{rpois}, and is the maximum of the lengths of the
43
  numerical arguments for the other functions.  
43
  numerical arguments for the other functions.
44
  
44
 
45
  The numerical arguments other than \code{n} are recycled to the
45
  The numerical arguments other than \code{n} are recycled to the
46
  length of the result.  Only the first elements of the logical
46
  length of the result.  Only the first elements of the logical
47
  arguments are used.
47
  arguments are used.
48
}
48
}
49
\details{
49
\details{
Line 51... Line 51...
51
%-- please leave the linebreaking for the next two ! --
51
%-- please leave the linebreaking for the next two ! --
52
  \deqn{p(x) = \frac{\lambda^x e^{-\lambda}}{x!}}{p(x) = \lambda^x exp(-\lambda)/x!}
52
  \deqn{p(x) = \frac{\lambda^x e^{-\lambda}}{x!}}{p(x) = \lambda^x exp(-\lambda)/x!}
53
  for \eqn{x = 0, 1, 2, \ldots} .
53
  for \eqn{x = 0, 1, 2, \ldots} .
54
  The mean and variance are \eqn{E(X) = Var(X) = \lambda}.
54
  The mean and variance are \eqn{E(X) = Var(X) = \lambda}.
55
 
55
 
-
 
56
  Note that \eqn{\lambda = 0} is really a limit case (setting
-
 
57
  \eqn{0^0 = 1}) resulting in a point mass at \eqn{0}, see also the example.
-
 
58
 
56
  If an element of \code{x} is not integer, the result of \code{dpois}
59
  If an element of \code{x} is not integer, the result of \code{dpois}
57
  is zero, with a warning.
60
  is zero, with a warning.
58
  \eqn{p(x)} is computed using Loader's algorithm, see the reference in
61
  \eqn{p(x)} is computed using Loader's algorithm, see the reference in
59
  \code{\link{dbinom}}.
62
  \code{\link{dbinom}}.
60
 
63
 
Line 99... Line 102...
99
par(mfrow = c(2, 1))
102
par(mfrow = c(2, 1))
100
x <- seq(-0.01, 5, 0.01)
103
x <- seq(-0.01, 5, 0.01)
101
plot(x, ppois(x, 1), type = "s", ylab = "F(x)", main = "Poisson(1) CDF")
104
plot(x, ppois(x, 1), type = "s", ylab = "F(x)", main = "Poisson(1) CDF")
102
plot(x, pbinom(x, 100, 0.01), type = "s", ylab = "F(x)",
105
plot(x, pbinom(x, 100, 0.01), type = "s", ylab = "F(x)",
103
     main = "Binomial(100, 0.01) CDF")
106
     main = "Binomial(100, 0.01) CDF")
-
 
107
 
-
 
108
## The (limit) case  lambda = 0 :
-
 
109
stopifnot(identical(dpois(0,0), 1),
-
 
110
	  identical(ppois(0,0), 1),
-
 
111
	  identical(qpois(1,0), 0))
104
}
112
}
105
\keyword{distribution}
113
\keyword{distribution}